From 36d14dd722d5a4e776e9c8204c63f24610dc7155 Mon Sep 17 00:00:00 2001 From: Przemek Pokrywka <12400578+dekiel@users.noreply.github.com> Date: Mon, 7 Oct 2024 09:00:46 +0200 Subject: [PATCH] Removed parameter to test kaniko from pr. (#12086) --- cmd/image-builder/main.go | 4 -- cmd/image-builder/main_test.go | 40 +++++++++---------- pkg/azuredevops/pipelines/templatesParams.go | 7 ---- .../pipelines/templatesParams_test.go | 4 -- 4 files changed, 19 insertions(+), 36 deletions(-) diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go index e9b156f4e918..936d3c1bf7ba 100644 --- a/cmd/image-builder/main.go +++ b/cmd/image-builder/main.go @@ -53,7 +53,6 @@ type options struct { buildInADO bool adoPreviewRun bool adoPreviewRunYamlPath string - testKanikoBuildConfig bool parseTagsOnly bool oidcToken string azureAccessToken string @@ -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()) } @@ -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") diff --git a/cmd/image-builder/main_test.go b/cmd/image-builder/main_test.go index 221c08033cbd..db4cdb49ea6a 100644 --- a/cmd/image-builder/main_test.go +++ b/cmd/image-builder/main_test.go @@ -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=", }, }, { @@ -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=", }, }, } diff --git a/pkg/azuredevops/pipelines/templatesParams.go b/pkg/azuredevops/pipelines/templatesParams.go index adc94d5625f4..62eeb463b890 100644 --- a/pkg/azuredevops/pipelines/templatesParams.go +++ b/pkg/azuredevops/pipelines/templatesParams.go @@ -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) { diff --git a/pkg/azuredevops/pipelines/templatesParams_test.go b/pkg/azuredevops/pipelines/templatesParams_test.go index 01a11618c4e5..632e843e2303 100644 --- a/pkg/azuredevops/pipelines/templatesParams_test.go +++ b/pkg/azuredevops/pipelines/templatesParams_test.go @@ -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"))