Conan 2 Registry Upload Does Not Obey --force
Summary
conan upload --force fails when using the CI_JOB_TOKEN authentication with a recipe revision that already exists
Steps to reproduce
conan upload --force on a package that already exists
Example Project
What is the current bug behavior?
Upload fails with 400 bad request
What is the expected correct behavior?
Conan upload should override the existing package
Relevant logs and/or screenshots
$ if [[ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]]; then
conan remote add $CONAN_REMOTE_RELEASE_NAME $CONAN_REMOTE_RELEASE_REPOSITORY --force
conan upload ${CONAN_RECIPE_NAME}/${CONAN_RECIPE_VERSION} --remote ${CONAN_REMOTE_RELEASE_NAME} -c --force
fi
WARN: Remote url already existing in remote 'ohaswt01-conan-release'. Having different remotes with same URL is not recommended. Adding duplicated remote url because '--force'.
======== Uploading to remote conan-remote-release ========
-------- Checking server for existing packages --------
tinyxml2/10.0.0: Checking which revisions exist in the remote server
Connecting to remote 'conan-remote-release' anonymously
tinyxml2/10.0.0: Recipe 'tinyxml2/10.0.0#832c7f8038cef53f6427577d6e66a7a8' already in server, forcing upload
-------- Preparing artifacts for upload --------
tinyxml2/10.0.0:3187e1641ce39a949bc96bc38731fa04b151a3b4: Compressing conan_package.tgz
-------- Uploading artifacts --------
Remote 'conan-remote-release' needs authentication, obtaining credentials
Using NETRC Authentication for remote: <REMOTE>
Authenticated in remote 'conan-remote-release' with user 'gitlab-ci-token'
tinyxml2/10.0.0: Uploading recipe 'tinyxml2/10.0.0#832c7f8038cef53f6427577d6e66a7a8' (3.1KB)
ERROR:
Error uploading file: conan_export.tgz, '{"message":"400 Bad request - Validation failed: File name already exists for the given recipe revision, package reference, and package revision"}'
ERROR:
Error uploading file: conanfile.py, '{"message":"400 Bad request - Validation failed: File name already exists for the given recipe revision, package reference, and package revision"}'
ERROR:
Error uploading file: conanmanifest.txt, '{"message":"400 Bad request - Validation failed: File name already exists for the given recipe revision, package reference, and package revision"}'
ERROR: Execute upload again to retry upload the failed files: conan_export.tgz, conanfile.py, conanmanifest.txt. [Remote: conan-remote-release]
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)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.