1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-30 05:59:39 +02:00

rename parameter dockerfile

This commit is contained in:
Christopher Fenner 2020-11-13 07:02:39 +01:00
parent da4cc6e5c1
commit 2a570685b8
No known key found for this signature in database
GPG Key ID: 1D72FE34B3FECE9C
4 changed files with 11 additions and 8 deletions

View File

@ -95,7 +95,7 @@ func runHadolint(config hadolintExecuteOptions, utils hadolintUtils) error {
log.Entry().Debug("No configuration file found.") log.Entry().Debug("No configuration file found.")
} }
// execute scan command // execute scan command
runCommand := fmt.Sprintf("hadolint %s %s", config.DockerFile, strings.Join(options, " ")) runCommand := fmt.Sprintf("hadolint %s %s", config.Dockerfile, strings.Join(options, " "))
runCommandTokens := tokenize(runCommand) runCommandTokens := tokenize(runCommand)
err := utils.RunExecutable(runCommandTokens[0], runCommandTokens[1:]...) err := utils.RunExecutable(runCommandTokens[0], runCommandTokens[1:]...)

View File

@ -17,7 +17,7 @@ type hadolintExecuteOptions struct {
ConfigurationURL string `json:"configurationUrl,omitempty"` ConfigurationURL string `json:"configurationUrl,omitempty"`
ConfigurationUsername string `json:"configurationUsername,omitempty"` ConfigurationUsername string `json:"configurationUsername,omitempty"`
ConfigurationPassword string `json:"configurationPassword,omitempty"` ConfigurationPassword string `json:"configurationPassword,omitempty"`
DockerFile string `json:"dockerFile,omitempty"` Dockerfile string `json:"dockerfile,omitempty"`
ConfigurationFile string `json:"configurationFile,omitempty"` ConfigurationFile string `json:"configurationFile,omitempty"`
ReportFile string `json:"reportFile,omitempty"` ReportFile string `json:"reportFile,omitempty"`
} }
@ -85,7 +85,7 @@ func addHadolintExecuteFlags(cmd *cobra.Command, stepConfig *hadolintExecuteOpti
cmd.Flags().StringVar(&stepConfig.ConfigurationURL, "configurationUrl", os.Getenv("PIPER_configurationUrl"), "URL pointing to the .hadolint.yaml exclude configuration to be used for linting. Also have a look at `configurationFile` which could avoid central configuration download in case the file is part of your repository.") cmd.Flags().StringVar(&stepConfig.ConfigurationURL, "configurationUrl", os.Getenv("PIPER_configurationUrl"), "URL pointing to the .hadolint.yaml exclude configuration to be used for linting. Also have a look at `configurationFile` which could avoid central configuration download in case the file is part of your repository.")
cmd.Flags().StringVar(&stepConfig.ConfigurationUsername, "configurationUsername", os.Getenv("PIPER_configurationUsername"), "The username to authenticate") cmd.Flags().StringVar(&stepConfig.ConfigurationUsername, "configurationUsername", os.Getenv("PIPER_configurationUsername"), "The username to authenticate")
cmd.Flags().StringVar(&stepConfig.ConfigurationPassword, "configurationPassword", os.Getenv("PIPER_configurationPassword"), "The password to authenticate") cmd.Flags().StringVar(&stepConfig.ConfigurationPassword, "configurationPassword", os.Getenv("PIPER_configurationPassword"), "The password to authenticate")
cmd.Flags().StringVar(&stepConfig.DockerFile, "dockerFile", `./Dockerfile`, "Dockerfile to be used for the assessment.") cmd.Flags().StringVar(&stepConfig.Dockerfile, "dockerfile", `./Dockerfile`, "Dockerfile to be used for the assessment.")
cmd.Flags().StringVar(&stepConfig.ConfigurationFile, "configurationFile", `.hadolint.yaml`, "Name of the configuration file used locally within the step. If a file with this name is detected as part of your repo downloading the central configuration via `configurationUrl` will be skipped. If you change the file's name make sure your stashing configuration also reflects this.") cmd.Flags().StringVar(&stepConfig.ConfigurationFile, "configurationFile", `.hadolint.yaml`, "Name of the configuration file used locally within the step. If a file with this name is detected as part of your repo downloading the central configuration via `configurationUrl` will be skipped. If you change the file's name make sure your stashing configuration also reflects this.")
cmd.Flags().StringVar(&stepConfig.ReportFile, "reportFile", `hadolint.xml`, "Name of the result file used locally within the step.") cmd.Flags().StringVar(&stepConfig.ReportFile, "reportFile", `hadolint.xml`, "Name of the result file used locally within the step.")
@ -138,12 +138,12 @@ func hadolintExecuteMetadata() config.StepData {
Aliases: []config.Alias{}, Aliases: []config.Alias{},
}, },
{ {
Name: "dockerFile", Name: "dockerfile",
ResourceRef: []config.ResourceReference{}, ResourceRef: []config.ResourceReference{},
Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"}, Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
Type: "string", Type: "string",
Mandatory: false, Mandatory: false,
Aliases: []config.Alias{}, Aliases: []config.Alias{{Name: "dockerFile"}},
}, },
{ {
Name: "configurationFile", Name: "configurationFile",

View File

@ -16,7 +16,7 @@ func TestRunHadolintExecute(t *testing.T) {
clientMock := &mocks.HadolintClient{} clientMock := &mocks.HadolintClient{}
runnerMock := &piperMocks.ExecMockRunner{} runnerMock := &piperMocks.ExecMockRunner{}
config := hadolintExecuteOptions{ config := hadolintExecuteOptions{
DockerFile: "./Dockerfile", // default Dockerfile: "./Dockerfile", // default
ConfigurationFile: ".hadolint.yaml", // default ConfigurationFile: ".hadolint.yaml", // default
} }
@ -49,7 +49,7 @@ func TestRunHadolintExecute(t *testing.T) {
clientMock := &mocks.HadolintClient{} clientMock := &mocks.HadolintClient{}
runnerMock := &piperMocks.ExecMockRunner{} runnerMock := &piperMocks.ExecMockRunner{}
config := hadolintExecuteOptions{ config := hadolintExecuteOptions{
DockerFile: "./Dockerfile", // default Dockerfile: "./Dockerfile", // default
ConfigurationFile: ".hadolint.yaml", // default ConfigurationFile: ".hadolint.yaml", // default
ConfigurationURL: "https://myconfig", ConfigurationURL: "https://myconfig",
} }

View File

@ -44,7 +44,10 @@ spec:
- name: configurationCredentialsId - name: configurationCredentialsId
type: secret type: secret
param: password param: password
- name: dockerFile - name: dockerfile
aliases:
- name: dockerFile
deprecated: true
type: string type: string
description: Dockerfile to be used for the assessment. description: Dockerfile to be used for the assessment.
mandatory: false mandatory: false