conan-package-tools
conan-package-tools copied to clipboard
Allow uploading from MR/PRs
Description of Problem, Request, or Question
I'm trying to use CPT from a Giltab CI pipeline where Conan packages are uploaded to an Artifactory instance. My pipelines also uses rules to define the behaviour for default, feature and release branches. Conan's docs suggest to setup three repositories: release for released packages, develop for master/main/trunk/stable packages and build for feature branch artifacts or everything else, ie. MR/PR pipelines. However, when trying to upload conan packages from a MR pipeline, I'm getting the following:
Skipping upload, this is a Pull Request
I have CONAN_UPLOAD
and the following settings set:
| upload_only_when_stable | False |
| upload_only_when_tag | False |
| upload_only_recipe | False |
| upload_force | True |
| stable_branch_pattern | release/* |
| stable_channel | stable |
| channel | testing |
| upload_dependencies | all
This seems to be lines preventing the upload
if not os.getenv("CONAN_TEST_SUITE", False):
if self.ci_manager.is_pull_request():
# PENDING! can't found info for gitlab/bamboo
self.printer.print_message("Skipping upload, this is a Pull Request")
return False
My understanding is that if an upload remote is given, CPT should not prevent uploading, especially when sth. like upload_force
is set to true. It seems like one way to circumvent that check is to set CONAN_TEST_SUITE
. But, if I'm not mistaken that's an internal variable for your test suite and hence not public, right? There seems no documentation of this variable.
How can I enforce uploading packages from a MR?
Environment Details
- Conan Package Tools Version: 0.35.1
- Operating System: Linux
- Operation System Version: Debian Buster
- Docker image: custom
- Conan version: conan 1.35.2
- Python version: python 3.7.3
Steps to reproduce (Include if Applicable)
Build logs (Include if Available)
Unfortunately upload_force
just controls --force
parameter of conan upload
. Doesn't has anything to do with CPT. (I fell to the same pitfall).
Maybe upload_force
should override (most) checks of https://github.com/conan-io/conan-package-tools/blob/7eff1ff01baacbe4ec1056340eea5a49ed3e82a2/cpt/packager.py#L590