I have a Azure DevOps pipeline in which I am adding two remotes. When using the JFrog Extension for Azure Pipelines and the included conan upload task, this task will not use the configured remote, but always the last added. Is there any solution to this or what am I missing?
I hope the following describes the setup well enough:
Service connection with technical user to add,update,delete pre released packages (typically branch based releases)
- task: ArtifactoryConan@1
displayName: "Add conan develop remote"
inputs:
conanCommand: "Add Remote"
remoteName: "develop"
artifactoryService: "Artifactory_Develop"
conanRepo: "develop"
purgeExistingRemotes: false
conanUserHome: "$(Pipeline.Workspace)"
Service connection with a restricted technical user to only add to a release repo, but not update or delete
- task: ArtifactoryConan@1
displayName: "Add conan release remote"
inputs:
conanCommand: "Add Remote"
remoteName: "release"
artifactoryService: "Artifactory_Release"
conanRepo: "release"
purgeExistingRemotes: false
conanUserHome: "$(Pipeline.Workspace)"
Based on branches, I would like to upload and publish my Conan artifacts to the dedicated repository, using the dedicated service connection:
- task: ArtifactoryConan@1
displayName: "Conan upload develop repo"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
conanCommand: "Upload"
remoteName: "develop"
patternOrReference: "$(conan_package_name)/$(conan_package_version)@$(project_name)/$(conan_channel)"
extraArguments: "--all -c"
buildName: "$(Build.DefinitionName)"
buildNumber: "$(Build.BuildNumber)"
conanUserHome: "$(Pipeline.Workspace)"
The conan upload task seems to be always using the last added remote?
2020-06-02T10:43:03.3661883Z ##[section]Starting: Conan upload develop repo
2020-06-02T10:43:03.3669805Z ==============================================================================
2020-06-02T10:43:03.3670263Z Task : Artifactory Conan
2020-06-02T10:43:03.3670628Z Description : This task runs a Conan command.
2020-06-02T10:43:03.3670974Z Version : 1.9.4
2020-06-02T10:43:03.3671273Z Author : JFrog
2020-06-02T10:43:03.3671597Z Help : Run Conan command.
2020-06-02T10:43:03.3671999Z ==============================================================================
2020-06-02T10:43:03.8219651Z Running Conan build tool from: /usr/local/bin/conan
2020-06-02T10:43:03.8220128Z Conan User Home: /__w/1
2020-06-02T10:43:03.8245768Z Running Conan command at: /__w/1/s
2020-06-02T10:43:03.8257251Z [command]/usr/local/bin/conan upload --all -c HelloWorld/1.0@Hello/develop
2020-06-02T10:43:04.2091929Z Uploading to remote 'release':
2020-06-02T10:43:04.2165470Z
2020-06-02T10:43:04.2166636Z Uploading HelloWorld/1.0@Hello/develop to remote 'release'
After adding the "-r (--remote) option in the "extraArguments", the correct remote was used:
- task: ArtifactoryConan@1
displayName: "Conan upload develop repo"
inputs:
conanCommand: "Upload"
remoteName: "MYREMOTE" # this is not working
patternOrReference: "$(conan_package_name)/$(conan_package_version)@$(project_name)/$(conan_channel)"
extraArguments: "--all -c -r MYREMOTE" # this is
buildName: "$(Build.DefinitionName)"
buildNumber: "$(Build.BuildNumber)"
conanUserHome: "$(Pipeline.Workspace)"