fix(argo): enhance ciOriginUrl construction in ArgoApplicationVersionUpdater to handle optional port in repository URL

Signed-off-by: zhenyus <zhenyus@mathmast.com>
This commit is contained in:
zhenyus 2025-06-23 16:16:08 +08:00
parent decc7e90f9
commit 190c20cae0

View File

@ -55,7 +55,11 @@ class ArgoApplicationVersionUpdater {
if (userSpecifiedArgoControlledRepo) { if (userSpecifiedArgoControlledRepo) {
// argoControlledRepo is a git url, so we need add username and password to the url // argoControlledRepo is a git url, so we need add username and password to the url
def argoControlledRepoUrlObj = new URL(component.argoControlledRepo) def argoControlledRepoUrlObj = new URL(component.argoControlledRepo)
ciOriginUrl = "${argoControlledRepoUrlObj.protocol}://${steps.env.OPS_GIT_USERNAME}:${steps.env.OPS_GIT_PASSWORD}@${argoControlledRepoUrlObj.host}${argoControlledRepoUrlObj.path}" if (argoControlledRepoUrlObj.port != null) {
ciOriginUrl = "${argoControlledRepoUrlObj.protocol}://${steps.env.OPS_GIT_USERNAME}:${steps.env.OPS_GIT_PASSWORD}@${argoControlledRepoUrlObj.host}:${argoControlledRepoUrlObj.port}${argoControlledRepoUrlObj.path}"
} else {
ciOriginUrl = "${argoControlledRepoUrlObj.protocol}://${steps.env.OPS_GIT_USERNAME}:${steps.env.OPS_GIT_PASSWORD}@${argoControlledRepoUrlObj.host}${argoControlledRepoUrlObj.path}"
}
} }
steps.sh """ steps.sh """
#!/bin/bash #!/bin/bash