fix: [AH-1139]: fix pull command for helm artifact (#3593)

* fix: [AH-1139]: fix failing tests
* fix: [AH-1139]: fix failing tests
* fix: [AH-1139]: fix pull command for helm artifact
main
Shivanand Sonnad 2025-03-26 06:10:30 +00:00 committed by Harness
parent bfed597d43
commit 0c7097d4b7
2 changed files with 4 additions and 3 deletions

View File

@ -382,7 +382,7 @@ func GetDockerPullCommand(
}
func GetHelmPullCommand(image string, tag string, registryURL string) string {
return "helm pull oci://" + GetRepoURLWithoutProtocol(registryURL) + "/" + image + ":" + tag
return "helm pull oci://" + GetRepoURLWithoutProtocol(registryURL) + "/" + image + " --version " + tag
}
func GetGenericArtifactFileDownloadCommand(regURL, artifact, version, filename string) string {

View File

@ -147,7 +147,7 @@ func TestGetTagURL_ValidURL(t *testing.T) {
func TestGetPullCommand_ValidCommand(t *testing.T) {
assert.Equal(t, "docker pull example.com/image:tag",
GetPullCommand("image", "tag", "DOCKER", "https://example.com"))
assert.Equal(t, "helm pull oci://example.com/image:tag",
assert.Equal(t, "helm pull oci://example.com/image --version tag",
GetPullCommand("image", "tag", "HELM", "https://example.com"))
assert.Equal(t, "", GetPullCommand("image", "tag", "INVALID", "https://example.com"))
}
@ -157,5 +157,6 @@ func TestGetDockerPullCommand_ValidCommand(t *testing.T) {
}
func TestGetHelmPullCommand_ValidCommand(t *testing.T) {
assert.Equal(t, "helm pull oci://example.com/image:tag", GetHelmPullCommand("image", "tag", "https://example.com"))
assert.Equal(t, "helm pull oci://example.com/image --version tag",
GetHelmPullCommand("image", "tag", "https://example.com"))
}