Github token not working
Hi! I'm trying to integrate my EasyBuild with GitHub, but I always receive a:
ERROR: Token validation failed, not installing it. Please verify your token and try again.
I check the log file:
== 2021-04-29 12:29:07,586 build_log.py:227 INFO This is EasyBuild 4.3.3 (framework: 4.3.3, easyblocks: 4.3.3) on host Naboo.
== 2021-04-29 12:29:07,616 build_log.py:230 INFO Command line: --buildpath='/home/eb/build' --containerpath='/home/eb/containers' --github-user='efirvida' --install-github-token --installpath='/home/eb' --packagepath='/home/eb/packages' --prefix='/home/eb' --repositorypath='/home/eb/ebfiles_repo' --sourcepath='/home/eb/sources'
== 2021-04-29 12:29:07,617 build_log.py:232 INFO Using /tmp/eb-zvw3_uqv as temporary directory
== 2021-04-29 12:29:07,618 robot.py:58 INFO Using robot path(s): ['/home/eb/software/EasyBuild/4.3.3/easybuild/easyconfigs']
== 2021-04-29 12:29:07,618 options.py:1649 INFO Using default external modules metadata cfg files: ['/home/eb/software/EasyBuild/4.3.3/etc/cray_external_modules_metadata.cfg', '/home/eb/software/EasyBuild/4.3.3/etc/ohpc_external_modules_metadata.cfg']
== 2021-04-29 12:29:07,627 systemtools.py:879 INFO Found Python version 3.9
== 2021-04-29 12:29:07,627 systemtools.py:899 INFO Running EasyBuild with Python 3 (version 3.9)
== 2021-04-29 12:29:07,627 filetools.py:2426 INFO /tmp/fake_vsc_3auh_rnq moved to /tmp/eb-zvw3_uqv/fake_vsc_3auh_rnq
== 2021-04-29 12:29:07,627 hooks.py:111 INFO No location for hooks implementation provided, no hooks defined
== 2021-04-29 12:29:07,627 hooks.py:142 INFO Defined hooks verified, all known hooks:
== 2021-04-29 12:29:07,627 environment.py:91 INFO Environment variable LMOD_QUIET set to 1 (previously undefined)
== 2021-04-29 12:29:07,627 environment.py:91 INFO Environment variable LMOD_IGNORE_CACHE set to 1 (previously undefined)
== 2021-04-29 12:29:07,627 environment.py:91 INFO Environment variable LMOD_REDIRECT set to no (previously undefined)
== 2021-04-29 12:29:07,627 environment.py:91 INFO Environment variable LMOD_EXTENDED_DEFAULT set to no (previously undefined)
== 2021-04-29 12:29:07,628 modules.py:291 INFO Full path for Lmod command is /usr/share/lmod/lmod/libexec/lmod, so using it
== 2021-04-29 12:29:07,628 modules.py:435 INFO Prepended list of module paths with path used by EasyBuild: /home/eb/modules/all
== 2021-04-29 12:29:07,628 run.py:222 INFO running cmd: type module
== 2021-04-29 12:29:07,658 modules.py:232 INFO Found Lmod version 8.4.23
== 2021-04-29 12:29:07,658 modules.py:240 INFO Converted actual version to '8.4.23'
== 2021-04-29 12:29:07,810 github.py:2083 WARNING Failed to obtain GitHub token for efirvida
Use the following procedure to install a GitHub token in your keyring:
$ python -c 'import getpass, keyring; keyring.set_password("github_token", "efirvida", getpass.getpass())'
== 2021-04-29 12:29:19,872 github.py:2142 WARNING Sanity check on token failed; token doesn't match pattern '^[0-9a-f]{40}'
== 2021-04-29 12:29:20,640 github.py:2153 INFO GitHub token can be used for authenticated GitHub access, validation passed
== 2021-04-29 12:29:20,642 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:124 in __init__): Token validation failed, not installing it. Please verify your token and try again. (at easybuild/tools/github.py:2122 in install_github_token)
But seems that the token never match the pattern no matter what I use to paste it.
I also try to install it in the keyring using this:
python -c 'import getpass, keyring; keyring.set_password("github_token", "efirvida", "MY_TOKEN")'
but when I try to check the integration it fails too:
$ eb --check-github
== Temporary log file in case of crash /tmp/eb-06ndpo45/easybuild-846_yqqk.log
Checking status of GitHub integration...
Making sure we're online...OK
* GitHub user...efirvida => OK
* GitHub token...ghp..UVT (len: 40) => FAIL (validation failed)
* git command...OK ("git version 2.31.1; ")
* GitPython module...OK (GitPython version 3.1.14)
* push access to efirvida/easybuild-easyconfigs repo @ GitHub...FAIL (unexpected exception: 'Checking out branch \'main\' from [email protected]:efirvida/easybuild-easyconfigs.git failed: "Failed to fetch branch \'main\' from [email protected]:efirvida/easybuild-easyconfigs.git: Cmd(\'git\') failed due to: exit code(128)\\n cmdline: git fetch -v pr_target_account_efirvida_kWdqy\\n stderr: \'fatal: Could not read from remote repository.\\n\\nPlease make sure you have the correct access rights\\nand the repository exists.\'"')
* creating gists...OK
* location to Git working dirs... not found (suboptimal)
One or more checks FAILed, GitHub configuration not fully complete!
See http://easybuild.readthedocs.org/en/latest/Integration_with_GitHub.html#configuration for help.
Status of GitHub integration:
* --from-pr: OK
* --new-pr: not supported
* --review-pr: OK
* --update-pr: not supported
* --upload-test-report: not supported
I was thinking that may be an error with my token or my access but I test it using PyGithub and it works just fine, so I don't know where is the problem.
Thank in advance!
@efirvida GitHub switched to a new token format. We fixed the checks that EasyBuild does in EasyBuild 4.3.4 (see https://github.com/easybuilders/easybuild-framework/pull/3632), so make sure you're using the latest EasyBuild version.
@efirvida GitHub switched to a new token format. We fixed the checks that EasyBuild does in EasyBuild 4.3.4 (see easybuilders/easybuild-framework#3632), so make sure you're using the latest EasyBuild version.
Thanks!, I was using Web 4.3.3, so I upgrade it, and now is working.
Traceback (most recent call last):
File "/usr/lib64/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/eb/software/EasyBuild/4.3.4/lib/python3.9/site-packages/easybuild/main.py", line 544, in <module>
main()
File "/home/eb/software/EasyBuild/4.3.4/lib/python3.9/site-packages/easybuild/main.py", line 251, in main
install_github_token(options.github_user, silent=build_option('silent'))
File "/home/eb/software/EasyBuild/4.3.4/lib/python3.9/site-packages/easybuild/tools/github.py", line 2149, in install_github_token
keyring.set_password(KEYRING_GITHUB_TOKEN, github_user, token)
File "/usr/local/lib/python3.9/site-packages/keyring/core.py", line 60, in set_password
get_keyring().set_password(service_name, username, password)
File "/usr/local/lib/python3.9/site-packages/keyring/backends/fail.py", line 25, in get_password
raise NoKeyringError(msg)
keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details.
I receive this error so seems that using keyrings.alt is mandatory now, but after installing it the integration is complete.