Conan install fails with environment variables
Summary
Our documentation states the following, regarding Add your credentials to the GitLab remote for Conan:
Alternatively, you can explicitly include your credentials in any given command. For example:
CONAN_LOGIN_USERNAME=<gitlab_username or deploy_token_username> CONAN_PASSWORD=<personal_access_token or deploy_token> conan upload Hello/0.1@mycompany/beta --all --remote=gitlab
This does not work in the context of installing a package. It only works when uploading.
Steps to reproduce
Run this in a private project on gitlab.com
stages:
- publish
- install
variables:
RECIPE: Hello/0.1@mycompany/beta
conan:publish:
stage: publish
image: conanio/gcc8
script:
- git clone --depth 1 https://github.com/conan-io/hello
- cd hello
- conan new Hello/0.1 -t
- conan remote add gitlab ${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/conan
- conan create . mycompany/beta
- CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload ${RECIPE} --all --remote=gitlab
conan:pull-auth-through-env-vars:
stage: install
image: conanio/gcc8
script:
- conan remote add gitlab ${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/conan
- CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD="${CI_JOB_TOKEN}" conan install -r gitlab ${RECIPE}
conan:pull-auth-through-configuration:
stage: install
image: conanio/gcc8
script:
- conan remote add gitlab ${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/conan
- conan user ci_user -p "${CI_JOB_TOKEN}" -r gitlab
- conan install -r gitlab ${RECIPE}
Example Project
What is the current bug behavior?
Installing fails: package is not found
What is the expected correct behavior?
Installing succeeds
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)