Skip to content

Commit

Permalink
Added build arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
satr committed Sep 21, 2023
1 parent 46e695e commit 0d06f41
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
22 changes: 12 additions & 10 deletions pipeline-runner/steps/build_acr.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func createACRBuildContainers(appName string, pipelineInfo *model.PipelineInfo,
SecurityContext: buildContainerSecContext,
}
if isUsingBuildKit(pipelineInfo) {
containerCommand = getBuildahContainerCommand(containerRegistry, secretMountsArgsString,
containerCommand = getBuildahContainerCommand(pipelineInfo, containerRegistry, secretMountsArgsString,
componentImage.Context, componentImage.Dockerfile, componentImage.ImagePath,
clusterTypeImage, clusterNameImage)
container.Command = containerCommand
Expand Down Expand Up @@ -318,19 +318,21 @@ func getBuildAcrJobContainerVolumeMounts(azureServicePrincipleContext string, bu
return volumeMounts
}

func getBuildahContainerCommand(containerImageRegistry, secretArgsString, context,
dockerFileName, imageTag, clusterTypeImageTag, clusterNameImageTag string) []string {
func getBuildahContainerCommand(pipelineInfo *model.PipelineInfo, containerImageRegistry, secretArgsString, context, dockerFileName, imageTag, clusterTypeImageTag, clusterNameImageTag string) []string {
return []string{
"/bin/bash",
"-c",
fmt.Sprintf("/usr/bin/buildah login --username ${BUILDAH_USERNAME} --password ${BUILDAH_PASSWORD} %s "+
"&& /usr/bin/buildah build --storage-driver=vfs --isolation=chroot "+
fmt.Sprintf("/usr/bin/buildah login --username ${BUILDAH_USERNAME} --password ${BUILDAH_PASSWORD} %s && "+
"/usr/bin/buildah build --storage-driver=vfs --isolation=chroot "+
"--jobs 0 %s --file %s%s "+
"--tag %s --tag %s --tag %s "+
"%s "+
"&& /usr/bin/buildah push --storage-driver=vfs --all %s "+
"&& /usr/bin/buildah push --storage-driver=vfs --all %s "+
"&& /usr/bin/buildah push --storage-driver=vfs --all %s ",
"--build-arg RADIX_GIT_COMMIT_HASH=\"${RADIX_GIT_COMMIT_HASH}\" "+
"--build-arg RADIX_GIT_TAGS=\"${RADIX_GIT_TAGS}\" "+
"--build-arg BRANCH=\"${BRANCH}\" "+
"--build-arg TARGET_ENVIRONMENTS=\"${TARGET_ENVIRONMENTS}\" "+
"--tag %s --tag %s --tag %s %s && "+
"/usr/bin/buildah push --storage-driver=vfs %s && "+
"/usr/bin/buildah push --storage-driver=vfs %s && "+
"/usr/bin/buildah push --storage-driver=vfs %s",
containerImageRegistry, secretArgsString, context, dockerFileName,
imageTag, clusterTypeImageTag, clusterNameImageTag,
context,
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/utils/branch/path_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ func TestMatchesPattern(t *testing.T) {
assert.False(t, MatchesPattern("v\\d+\\.\\d+\\.\\d+", "v1q.0.2"))
assert.False(t, MatchesPattern("v\\d+\\.\\d+\\.\\d+", "v1..2"))
assert.False(t, MatchesPattern("v\\d+\\.\\d+\\.\\d+", "v1.2"))
assert.False(t, MatchesPattern("v\\d+\\.\\d+\\.\\d+\\.*", "v1.2.20-asdf"))
}

0 comments on commit 0d06f41

Please sign in to comment.