You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-07-13 01:30:24 +02:00
npmExecuteScripts: allow passing a list of build descriptors to execute scripts for (#2312)
This change extends the npmExecuteScripts step to support execution of npm scripts for specific modules. Previously, it was not possible to execute npm scripts only for specific modules. Now, if the parameter buildDesriptorList is set the scripts defined by the runScripts parameter will be executed for the modules defined by buildDescriptorList. Note, in this case the buildDescriptorExcludeList will be ignored.
This commit is contained in:
@ -20,6 +20,7 @@ type npmExecuteScriptsOptions struct {
|
||||
VirtualFrameBuffer bool `json:"virtualFrameBuffer,omitempty"`
|
||||
ScriptOptions []string `json:"scriptOptions,omitempty"`
|
||||
BuildDescriptorExcludeList []string `json:"buildDescriptorExcludeList,omitempty"`
|
||||
BuildDescriptorList []string `json:"buildDescriptorList,omitempty"`
|
||||
}
|
||||
|
||||
// NpmExecuteScriptsCommand Execute npm run scripts on all npm packages in a project
|
||||
@ -85,6 +86,7 @@ func addNpmExecuteScriptsFlags(cmd *cobra.Command, stepConfig *npmExecuteScripts
|
||||
cmd.Flags().BoolVar(&stepConfig.VirtualFrameBuffer, "virtualFrameBuffer", false, "(Linux only) Start a virtual frame buffer in the background. This allows you to run a web browser without the need for an X server. Note that xvfb needs to be installed in the execution environment.")
|
||||
cmd.Flags().StringSliceVar(&stepConfig.ScriptOptions, "scriptOptions", []string{}, "Options are passed to all runScripts calls separated by a '--'. './piper npmExecuteScripts --runScripts ci-e2e --scriptOptions '--tag1' will correspond to 'npm run ci-e2e -- --tag1'")
|
||||
cmd.Flags().StringSliceVar(&stepConfig.BuildDescriptorExcludeList, "buildDescriptorExcludeList", []string{`deployment/**`}, "List of build descriptors and therefore modules to exclude from execution of the npm scripts. The elements can either be a path to the build descriptor or a pattern.")
|
||||
cmd.Flags().StringSliceVar(&stepConfig.BuildDescriptorList, "buildDescriptorList", []string{}, "List of build descriptors and therefore modules for execution of the npm scripts. The elements have to be paths to the build descriptors. **If set, buildDescriptorExcludeList will be ignored.**")
|
||||
|
||||
}
|
||||
|
||||
@ -146,6 +148,14 @@ func npmExecuteScriptsMetadata() config.StepData {
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{},
|
||||
},
|
||||
{
|
||||
Name: "buildDescriptorList",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
|
||||
Type: "[]string",
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user