[BUG]: CargoAuthenticate task has incorrect Uri validation when using cargoServiceConnections input #20765
Closed
4 of 7 tasks
Labels
Area: Artifacts
Area: ArtifactsPackages
Azure Artifacts Packaging Team
bug
redirect-to-dev-community
triage
New issue checklist
Task name
CargoAuthenticate
Task version
0
Issue Description
Expected:
CargoAuthenticate@0
task with thecargoServiceConnections
input, it will use the cargo service connection to the external feed in a different Azure DevOps organizationActual:
config.toml
file). These may not match, and the validation fails. The external feed is not authenticated.Snippet from: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/CargoAuthenticateV0/cargoauthenticatemain.ts#L45-L60
Specifically, pkgLocationUtils.getPackagingUris gets the
System.TeamFoundationCollectionUri
of my organization:Log:
##[debug]System.TeamFoundationCollectionUri=https://dev.azure.com/ORG_A/
and generates a list of packaging Uris for that collection:
Log:
##[debug]{"PackagingUris":["https://dev.azure.com/ORG_A/","https://pkgs.dev.azure.com/ORG_A/","https://pkgsprodcus1.pkgs.visualstudio.com/","https://pkgs.dev.azure.com/ORG_A/","https://ORG_A.pkgs.visualstudio.com/","https://pkgs.dev.azure.com/ORG_A/"],"DefaultPackagingUri":"https://pkgs.dev.azure.com/ORG_A/"}
Then the hosts are extracted into array
collectionHosts
. This is used in https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/CargoAuthenticateV0/cargoauthenticatemain.ts#L127-L131 whereisValidRegistry
compares the hosts of the registries inconfig.toml
file againstcollectionHosts
.I am using
cargoServiceConnections
task input since the registries are in different organizations. For example, theconfig.toml
file might be:Which means host
ORG_B.pkgs.visualstudio.com
does not match hostORG_A.pkgs.visualstudio.com
fromcollectionHosts
, soisValidRegistry
is false, and theCargoAuthenticate@0
task fails to connect to the external feed even though everything is configured properly in terms of the service connection.Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Ubuntu 22.04.5
Relevant log output
Full task logs with system.debug enabled
Repro steps
The text was updated successfully, but these errors were encountered: