Conan does not find packages since GitLab update to 13.11.1
Summary
This is a major regression introduced between GitLab 13.9.1 and 13.11.1. We will most likely have to make a roll back in our company.
The issue is present on GitLab.com too. It occurs both on Windows & Linux.
Conan fails to fetch packages since GitLab update to 13.11.1. Conan returns this error while the package has not changed :
ERROR: Unable to find 'mypackage/0.2.0@mygroup+myproject/stable' in remotes
I have tried to to identify the root cause and I think it is related to the JWT token. Indeed, when authenticating with a remote, Conan generates a temporary session token (JWT). When the token expires, Conan should generate a new one. It seems this mechanism is broken since the update.
I came up to this conclusion when I found this workaround : running a conan user
command fix the issue. It looks like it forces Conan to renew the JWT token :
conan user vdsbenoit -p mytoken -r gitlab
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 11:40:25,359]
DEBUG :tracer.py [157]: CONAN_API: authenticate(remote_name=gitlab,password=**********,skip_auth=False) [2021-04-28 11:40:25,366]
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 11:40:25,371]
DEBUG :tracer.py [157]: CONAN_API: get_remote_by_name() [2021-04-28 11:40:25,374]
DEBUG :rest_client_common.py[160]: REST: ping: https://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 11:40:25,394]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 11:40:25,517]
DEBUG :rest_client_common.py[94]: REST: Authenticate to get access_token: https://our.gitlab.instance.com/api/v4/packages/conan/v1/users/authenticate [2021-04-28 11:40:25,517]
User of remote 'gitlab' is already 'vdsbenoit'
After running this command, I can fetch & search package as I could before the update. However, it seems it does not last for long. I did it yesterday afternoon and I had to renew the operation today in the morning.
Steps to reproduce
I have noticed this issue also occurs if no credentials have been set to a Conan remote. I can reproduce the issue by running conan user -c
Requirements
- Have a GitLab channel configured in your conan remotes. For instance :
conan remote list
conan-center: https://conan.bintray.com [Verify SSL: True]
gitlab.com: https://gitlab.com/api/v4/packages/conan [Verify SSL: True]
- Have a Conan package on a private GitLab project. This is required to prevent anonymous authentication.
Steps
Considering an conan-auth-bug
package exists on the channel
- run
conan user -c
- run
conan search conan-auth-bug* -r gitlab.com
Conan should prompt for some credentials but does not.
Example Project
https://gitlab.com/vdsbenoit/conan-auth-bug
This is a private project to prevent anonymous authentication. Please ping me and I'll add you in the members of the project.
Debug info
▶ conan search conan-auth-bug -r gitlab.com
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\bvanderstappen\.conan\conan.conf' [2021-04-28 13:05:52,614]
DEBUG :tracer.py [157]: CONAN_API: search_recipes(remote_name=gitlab.com,case_sensitive=False) [2021-04-28 13:05:52,619]
DEBUG :rest_client_common.py[160]: REST: ping: https://gitlab.com/api/v4/packages/conan/v1/ping [2021-04-28 13:05:52,631]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 13:05:52,953]
DEBUG :rest_client_common.py[188]: REST: get: https://gitlab.com/api/v4/packages/conan/v1/conans/search?q=conan-auth-bug [2021-04-28 13:05:52,954]
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\bvanderstappen\.conan\conan.conf' [2021-04-28 13:05:53,312]
DEBUG :tracer.py [157]: CONAN_API: get_remote_by_name() [2021-04-28 13:05:53,320]
Existing package recipes:
conan-auth-bug/0.1@vdsbenoit+conan-auth-bug/stable
~\workspace\conan\sandbox_create ◷ 13:05:53
▶ conan user -c
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\bvanderstappen\.conan\conan.conf' [2021-04-28 13:06:08,436]
DEBUG :tracer.py [157]: CONAN_API: users_clean() [2021-04-28 13:06:08,441]
~\workspace\conan\sandbox_create ◷ 13:06:08
▶ conan search conan-auth-bug -r gitlab.com
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\bvanderstappen\.conan\conan.conf' [2021-04-28 13:06:10,998]
DEBUG :tracer.py [157]: CONAN_API: search_recipes(remote_name=gitlab.com,case_sensitive=False) [2021-04-28 13:06:11,002]
DEBUG :rest_client_common.py[160]: REST: ping: https://gitlab.com/api/v4/packages/conan/v1/ping [2021-04-28 13:06:11,015]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 13:06:11,552]
DEBUG :rest_client_common.py[188]: REST: get: https://gitlab.com/api/v4/packages/conan/v1/conans/search?q=conan-auth-bug [2021-04-28 13:06:11,553]
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\bvanderstappen\.conan\conan.conf' [2021-04-28 13:06:11,830]
DEBUG :tracer.py [157]: CONAN_API: get_remote_by_name() [2021-04-28 13:06:11,836]
There are no packages matching the 'conan-auth-bug' pattern
What is the current bug behavior?
Conan returns an error saying the package does not exits while it does.
What is the expected correct behavior?
Conan should prompt the user when the JWT token has expired or does not exits. The user should then either enter his credentials or Conan should get the credentials from the environment variables.
Relevant logs and/or screenshots
Due to IP, I have manually refactored my package into mypackage
.
Debug info
~\workspace ◷ 11:07:19
▶ $env:CONAN_LOGGING_LEVEL="10"
~\workspace
▶ conan -v
Conan version 1.35.2
Before JWT renewal
search command
~\workspace ◷ 11:07:24
▶ conan search mypackage* -r gitlab
DEBUG :conan_api.py [177]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 11:07:27,215]
DEBUG :tracer.py [157]: CONAN_API: search_recipes(remote_name=gitlab,case_sensitive=False) [2021-04-28 11:07:27,231]
DEBUG :rest_client_common.py[160]: REST: ping: https://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 11:07:27,243]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 11:07:27,444]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/search?q=mypackage%2A [2021-04-28 11:07:27,445]
DEBUG :conan_api.py [177]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 11:07:27,524]
DEBUG :tracer.py [157]: CONAN_API: get_remote_by_name() [2021-04-28 11:07:27,534]
There are no packages matching the 'mypackage*' pattern
install command
~\workspace\conan\sandbox_consume ◷ 11:46:39
▶ conan install .
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 11:46:42,234]
DEBUG :tracer.py [157]: CONAN_API: install(path=.,name=None,version=None,user=None,channel=None,settings=None,options=None,env=None,profile_names=None,profile_build=ProfileData(profiles=None, settings=None, options=None, env=None),remote_name=None,verify=None,manifests=None,manifests_interactive=None,build=None,update=False,generators=None,no_imports=False,install_folder=None,lockfile=None,lockfile_out=None) [2021-04-28 11:46:42,241]
DEBUG :profile_loader.py[117]: PROFILE LOAD: C:\Users\vdsbenoit\.conan\profiles\default [2021-04-28 11:46:42,248]
INFO :settings_preprocessor.py[56]: Setting 'compiler.runtime' not declared, automatically adjusted to 'MD' [2021-04-28 11:46:42,358]
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
mypackage/0.2.0@mygroup+myproject/stable: Not found in local cache, looking in remotes...
mypackage/0.2.0@mygroup+myproject/stable: Trying with 'gitlab'...
DEBUG :rest_client_common.py[160]: REST: ping: https://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 11:46:42,399]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 11:46:42,580]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/download_urls [2021-04-28 11:46:42,587]
DEBUG :rest_client_common.py[30]: REST ERROR: <class 'conans.errors.NotFoundException'> [2021-04-28 11:46:42,659]
mypackage/0.2.0@mygroup+myproject/stable: Trying with 'conan-center'...
DEBUG :rest_client_common.py[160]: REST: ping: https://conan.bintray.com/v1/ping [2021-04-28 11:46:42,665]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: ['complex_search', 'checksum_deploy', 'revisions', 'matrix_params'] [2021-04-28 11:46:42,934]
DEBUG :rest_client_common.py[188]: REST: get: https://conan.bintray.com/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/download_urls [2021-04-28 11:46:42,939]
DEBUG :rest_client_common.py[30]: REST ERROR: <class 'conans.errors.NotFoundException'> [2021-04-28 11:46:42,971]
ERROR: Unable to find 'mypackage/0.2.0@mygroup+myproject/stable' in remotes
Force JWT renewal
Let's note that I have my username & token set in the CONAN_LOGIN_USERNAME
and CONAN_PASSWORD
environment variables. Therefore, Conan should get the credentials automatically from the environment when the JWT token expires.
conan user command
~\workspace\conan\sandbox_consume ◷ 12:24:30
▶ conan user -p -r gitlab
Remote 'gitlab' username: Got username 'vdsbenoit' from environment
Please enter a password for "vdsbenoit" account: Got password '******' from environment
User of remote 'gitlab' is already 'vdsbenoit'
After JWT renewal
search command
~\workspace\conan\sandbox_consume ◷ 12:32:27
▶ conan search mypackage* -r gitlab
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 12:32:56,143]
DEBUG :tracer.py [157]: CONAN_API: search_recipes(remote_name=gitlab,case_sensitive=False) [2021-04-28 12:32:56,149]
DEBUG :rest_client_common.py[160]: REST: ping: https://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 12:32:56,162]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 12:32:56,306]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/search?q=mypackage%2A [2021-04-28 12:32:56,307]
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 12:32:56,376]
DEBUG :tracer.py [157]: CONAN_API: get_remote_by_name() [2021-04-28 12:32:56,383]
Existing package recipes:
mypackage/0.1.0@mygroup+myproject/stable
mypackage/0.1.2@mygroup+myproject/stable
mypackage/0.2.0@mygroup+myproject/stable
install command
~\workspace\conan\sandbox_consume ◷ 12:32:56
▶ conan install .
DEBUG :conan_api.py [176]: INIT: Using config 'C:\Users\vdsbenoit\.conan\conan.conf' [2021-04-28 12:33:01,754]
DEBUG :tracer.py [157]: CONAN_API: install(path=.,name=None,version=None,user=None,channel=None,settings=None,options=None,env=None,profile_names=None,profile_build=ProfileData(profiles=None, settings=None, options=None, env=None),remote_name=None,verify=None,manifests=None,manifests_interactive=None,build=None,update=False,generators=None,no_imports=False,install_folder=None,lockfile=None,lockfile_out=None) [2021-04-28 12:33:01,760]
DEBUG :profile_loader.py[117]: PROFILE LOAD: C:\Users\vdsbenoit\.conan\profiles\default [2021-04-28 12:33:01,762]
INFO :settings_preprocessor.py[56]: Setting 'compiler.runtime' not declared, automatically adjusted to 'MD' [2021-04-28 12:33:01,821]
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
mypackage/0.2.0@mygroup+myproject/stable: Not found in local cache, looking in remotes...
mypackage/0.2.0@mygroup+myproject/stable: Trying with 'gitlab2'...
DEBUG :rest_client_common.py[160]: REST: ping: http://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 12:33:01,855]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 12:33:02,036]
DEBUG :rest_client_common.py[188]: REST: get: http://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/download_urls [2021-04-28 12:33:02,040]
DEBUG :rest_client_common.py[30]: REST ERROR: <class 'conans.errors.NotFoundException'> [2021-04-28 12:33:02,119]
mypackage/0.2.0@mygroup+myproject/stable: Trying with 'gitlab'...
DEBUG :rest_client_common.py[160]: REST: ping: https://our.gitlab.instance.com/api/v4/packages/conan/v1/ping [2021-04-28 12:33:02,128]
DEBUG :rest_client.py [58]: REST: Cached capabilities for the remote: [] [2021-04-28 12:33:02,164]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/download_urls [2021-04-28 12:33:02,167]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/export/conanmanifest.txt [2021-04-28 12:33:02,338]
Downloading conanmanifest.txt completed [1.99k]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/export/conanfile.py [2021-04-28 12:33:02,426]
Downloading conanfile.py completed [1.71k]
mypackage/0.2.0@mygroup+myproject/stable: Downloaded recipe revision 0
DEBUG :graph_builder.py[417]: GRAPH: new_node: mypackage/0.2.0@mygroup+myproject/stable [2021-04-28 12:33:02,451]
DEBUG :graph_builder.py[68]: GRAPH: Time to load deps 0.6260342597961426 [2021-04-28 12:33:02,452]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/download_urls [2021-04-28 12:33:02,466]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/0/conaninfo.txt [2021-04-28 12:33:02,600]
conanfile.txt: Installing package
Requirements
mypackage/0.2.0@mygroup+myproject/stable from 'gitlab' - Downloaded
Packages
mypackage/0.2.0@mygroup+myproject/stable:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Download
Installing (downloading, building) binaries...
mypackage/0.2.0@mygroup+myproject/stable: Retrieving package 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 from remote 'gitlab'
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 [2021-04-28 12:33:02,626]
DEBUG :rest_client_common.py[188]: REST: get: https://our.gitlab.instance.com/api/v4/packages/conan/v1/conans/mypackage/0.2.0/mygroup+myproject/stable/packages/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/download_urls [2021-04-28 12:33:02,705]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/0/conanmanifest.txt [2021-04-28 12:33:02,953]
Downloading conanmanifest.txt completed [1.00k]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/0/conaninfo.txt [2021-04-28 12:33:03,032]
Downloading conaninfo.txt completed [0.27k]
DEBUG :file_downloader.py[129]: DOWNLOAD: https://our.gitlab.instance.com/api/v4/packages/conan/v1/files/mypackage/0.2.0/mygroup+myproject/stable/0/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/0/conan_package.tgz [2021-04-28 12:33:03,116]
Downloading conan_package.tgz completed [27.44k]
Decompressing conan_package.tgz completed [0.00k]
mypackage/0.2.0@mygroup+myproject/stable: Package installed 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
mypackage/0.2.0@mygroup+myproject/stable: Downloaded package revision 0
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
Output of checks
This bug happens on GitLab.com
Possible fixes
I do not have a turnkey solution. However, since it is a regression, there should be a way to roll back to GitLab 13.9 state.