Skip to content

Commit

Permalink
Removed parameter to test kaniko from pr. (#12086)
Browse files Browse the repository at this point in the history
  • Loading branch information
dekiel authored Oct 7, 2024
1 parent 7e269a2 commit 36d14dd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 36 deletions.
4 changes: 0 additions & 4 deletions cmd/image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type options struct {
buildInADO bool
adoPreviewRun bool
adoPreviewRunYamlPath string
testKanikoBuildConfig bool
parseTagsOnly bool
oidcToken string
azureAccessToken string
Expand Down Expand Up @@ -236,8 +235,6 @@ func prepareADOTemplateParameters(options options) (adopipelines.OCIImageBuilder

templateParameters.SetExportTags(options.exportTags)

templateParameters.SetUseKanikoConfigFromPR(options.testKanikoBuildConfig)

if len(options.buildArgs) > 0 {
templateParameters.SetBuildArgs(options.buildArgs.String())
}
Expand Down Expand Up @@ -797,7 +794,6 @@ func (o *options) gatherOptions(flagSet *flag.FlagSet) *flag.FlagSet {
flagSet.BoolVar(&o.adoPreviewRun, "ado-preview-run", false, "Trigger ADO pipeline in preview mode")
flagSet.StringVar(&o.adoPreviewRunYamlPath, "ado-preview-run-yaml-path", "", "Path to yaml file with ADO pipeline definition to be used in preview mode")
flagSet.BoolVar(&o.parseTagsOnly, "parse-tags-only", false, "Only parse tags and print them to stdout")
flagSet.BoolVar(&o.testKanikoBuildConfig, "test-kaniko-build-config", false, "Verify kaniko build config for build in ADO")
flagSet.StringVar(&o.oidcToken, "oidc-token", "", "Token used to authenticate against Azure DevOps backend service")
flagSet.StringVar(&o.azureAccessToken, "azure-access-token", "", "Token used to authenticate against Azure DevOps API")

Expand Down
40 changes: 19 additions & 21 deletions cmd/image-builder/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,16 +784,15 @@ func Test_prepareADOTemplateParameters(t *testing.T) {
},
},
want: pipelines.OCIImageBuilderTemplateParams{
"Context": "",
"Dockerfile": "",
"ExportTags": "false",
"JobType": "postsubmit",
"Name": "",
"PullBaseSHA": "",
"RepoName": "",
"RepoOwner": "",
"Tags": "e3sgLkVudiAiR09MQU5HX1ZFUlNJT04iIH19LVNob3J0U0hBPXt7IC5FbnYgIkdPTEFOR19WRVJTSU9OIiB9fS17eyAuU2hvcnRTSEEgfX0=",
"UseKanikoConfigFromPR": "false",
"Context": "",
"Dockerfile": "",
"ExportTags": "false",
"JobType": "postsubmit",
"Name": "",
"PullBaseSHA": "",
"RepoName": "",
"RepoOwner": "",
"Tags": "e3sgLkVudiAiR09MQU5HX1ZFUlNJT04iIH19LVNob3J0U0hBPXt7IC5FbnYgIkdPTEFOR19WRVJTSU9OIiB9fS17eyAuU2hvcnRTSEEgfX0=",
},
},
{
Expand All @@ -809,17 +808,16 @@ func Test_prepareADOTemplateParameters(t *testing.T) {
},
},
want: pipelines.OCIImageBuilderTemplateParams{
"Context": "",
"Dockerfile": "",
"ExportTags": "false",
"JobType": "workflow_dispatch",
"Name": "",
"PullBaseSHA": "abc123",
"BaseRef": "main",
"RepoName": "",
"RepoOwner": "",
"Tags": "e3sgLkVudiAiR09MQU5HX1ZFUlNJT04iIH19LVNob3J0U0hBPXt7IC5FbnYgIkdPTEFOR19WRVJTSU9OIiB9fS17eyAuU2hvcnRTSEEgfX0=",
"UseKanikoConfigFromPR": "false",
"Context": "",
"Dockerfile": "",
"ExportTags": "false",
"JobType": "workflow_dispatch",
"Name": "",
"PullBaseSHA": "abc123",
"BaseRef": "main",
"RepoName": "",
"RepoOwner": "",
"Tags": "e3sgLkVudiAiR09MQU5HX1ZFUlNJT04iIH19LVNob3J0U0hBPXt7IC5FbnYgIkdPTEFOR19WRVJTSU9OIiB9fS17eyAuU2hvcnRTSEEgfX0=",
},
},
}
Expand Down
7 changes: 0 additions & 7 deletions pkg/azuredevops/pipelines/templatesParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ func (p OCIImageBuilderTemplateParams) SetImageTags(tags string) {
p["Tags"] = encodedTags
}

// SetUseKanikoConfigFromPR sets optional parameter UseKanikoConfigFromPR.
// If true, ADO pipeline will use a Kaniko config from PR.
// This is used for testing purposes.
func (p OCIImageBuilderTemplateParams) SetUseKanikoConfigFromPR(useKanikoFromPR bool) {
p["UseKanikoConfigFromPR"] = strconv.FormatBool(useKanikoFromPR)
}

// SetAuthorization sets Authorization parameter.
// This parameter is used to provide authorization token when running in github actions
func (p OCIImageBuilderTemplateParams) SetAuthorization(authorizationToken string) {
Expand Down
4 changes: 0 additions & 4 deletions pkg/azuredevops/pipelines/templatesParams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ var _ = Describe("Test OCIImageBuilderTemplateParams", func() {
Expect(params["Tags"]).To(Equal(expected))
})

It("sets the correct UseKanikoConfigFromPR", func() {
params.SetUseKanikoConfigFromPR(true)
Expect(params["UseKanikoConfigFromPR"]).To(Equal("true"))
})
It("sets the correct Authorization", func() {
params.SetAuthorization("some-token")
Expect(params["Authorization"]).To(Equal("some-token"))
Expand Down

0 comments on commit 36d14dd

Please sign in to comment.