Skip to content

Commit

Permalink
Rename use-go-internal-modules to use-go-internal-sap-modules (#12339)
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperMalachowski authored Nov 14, 2024
1 parent 0274472 commit 555ad37
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/actions/image-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ runs:
- uses: docker://europe-docker.pkg.dev/kyma-project/prod/image-builder:v20241112-fd0d9381
id: build
with:
args: --name=${{ inputs.image-name }} --context=${{ inputs.context }} --dockerfile=${{ inputs.dockerfile }} --azure-access-token=${{ inputs.ado-token }} --oidc-token=${{ inputs.oidc-token }} ${{ steps.prepare-build-args.outputs.build-args }} ${{ steps.prepare-tags.outputs.tags }} --export-tags=${{ inputs.export-tags }} --config=${{ inputs.config }} --env-file=${{ inputs.env-file }} --build-in-ado=true --use-go-internal-modules=${{ inputs.use-go-internal-sap-modules }}
args: --name=${{ inputs.image-name }} --context=${{ inputs.context }} --dockerfile=${{ inputs.dockerfile }} --azure-access-token=${{ inputs.ado-token }} --oidc-token=${{ inputs.oidc-token }} ${{ steps.prepare-build-args.outputs.build-args }} ${{ steps.prepare-tags.outputs.tags }} --export-tags=${{ inputs.export-tags }} --config=${{ inputs.config }} --env-file=${{ inputs.env-file }} --build-in-ado=true --use-go-internal-sap-modules=${{ inputs.use-go-internal-sap-modules }}
34 changes: 17 additions & 17 deletions cmd/image-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ type options struct {
platforms sets.Strings
exportTags bool
// signOnly only sign images. No build will be performed.
signOnly bool
imagesToSign sets.Strings
buildInADO bool
adoPreviewRun bool
adoPreviewRunYamlPath string
parseTagsOnly bool
oidcToken string
azureAccessToken string
ciSystem CISystem
gitState GitStateConfig
debug bool
dryRun bool
tagsOutputFile string
useGoInternalModules bool
signOnly bool
imagesToSign sets.Strings
buildInADO bool
adoPreviewRun bool
adoPreviewRunYamlPath string
parseTagsOnly bool
oidcToken string
azureAccessToken string
ciSystem CISystem
gitState GitStateConfig
debug bool
dryRun bool
tagsOutputFile string
useGoInternalSAPModules bool
}

type Logger interface {
Expand Down Expand Up @@ -257,8 +257,8 @@ func prepareADOTemplateParameters(options options) (adopipelines.OCIImageBuilder
templateParameters.SetAuthorization(options.oidcToken)
}

if options.useGoInternalModules {
templateParameters.SetUseGoInternalModules()
if options.useGoInternalSAPModules {
templateParameters.SetUseGoInternalSAPModules()
}

err := templateParameters.Validate()
Expand Down Expand Up @@ -838,7 +838,7 @@ func (o *options) gatherOptions(flagSet *flag.FlagSet) *flag.FlagSet {
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")
flagSet.StringVar(&o.tagsOutputFile, "tags-output-file", "/generated-tags.json", "Path to file where generated tags will be written as JSON")
flagSet.BoolVar(&o.useGoInternalModules, "use-go-internal-modules", false, "Allow access to Go internal modules in ADO backend")
flagSet.BoolVar(&o.useGoInternalSAPModules, "use-go-interna-sap-modules", false, "Allow access to Go internal modules in ADO backend")

return flagSet
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/azuredevops/pipelines/templatesParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ func (p OCIImageBuilderTemplateParams) SetAuthorization(authorizationToken strin
p["Authorization"] = authorizationToken
}

// SetUseGoInternalModules sets UseGoInternalModules parameter.
// SetUseGoInternalSAPModules sets UseGoInternalModules parameter.
// This parameter is used to setup access to internal Go modules.
// Modules are fetched with go mod vendor command.
func (p OCIImageBuilderTemplateParams) SetUseGoInternalModules() {
p["UseGoInternalModules"] = "true"
func (p OCIImageBuilderTemplateParams) SetUseGoInternalSAPModules() {
p["UseGoInternalSAPModules"] = "true"
}

// Validate validates if required OCIImageBuilderTemplateParams are set.
Expand Down
6 changes: 3 additions & 3 deletions pkg/azuredevops/pipelines/templatesParams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ var _ = Describe("Test OCIImageBuilderTemplateParams", func() {
Expect(params["Authorization"]).To(Equal("some-token"))
})

It("sets the correct useGoInternalModules", func() {
params.SetUseGoInternalModules()
Expect(params["UseGoInternalModules"]).To(Equal("true"))
It("sets the correct UseGoInternalSAPModules", func() {
params.SetUseGoInternalSAPModules()
Expect(params["UseGoInternalSAPModules"]).To(Equal("true"))
})

// TODO: Improve assertions with more specific matchers and values.
Expand Down

0 comments on commit 555ad37

Please sign in to comment.