mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-20 05:19:40 +02:00
helmExecute triggered by buildExecute (#4521)
This commit is contained in:
parent
47f4b1e42d
commit
d6d3b6b091
@ -271,7 +271,7 @@ func helmExecuteMetadata() config.StepData {
|
||||
{
|
||||
Name: "chartPath",
|
||||
ResourceRef: []config.ResourceReference{},
|
||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS"},
|
||||
Scope: []string{"GENERAL", "PARAMETERS", "STAGES", "STEPS"},
|
||||
Type: "string",
|
||||
Mandatory: false,
|
||||
Aliases: []config.Alias{{Name: "helmChartPath"}},
|
||||
|
@ -58,6 +58,7 @@ spec:
|
||||
type: string
|
||||
description: Defines the chart path for helm. chartPath is mandatory for install/upgrade/publish commands.
|
||||
scope:
|
||||
- GENERAL
|
||||
- PARAMETERS
|
||||
- STAGES
|
||||
- STEPS
|
||||
|
@ -314,4 +314,41 @@ class BuildExecuteTest extends BasePiperTest {
|
||||
)
|
||||
assertThat(buildToolCalled, is(true))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHelmExecuteCalledWhenConfigured() {
|
||||
def helmExecuteCalled = false
|
||||
helper.registerAllowedMethod('helmExecute', [Map.class], { m ->
|
||||
helmExecuteCalled = true
|
||||
return
|
||||
})
|
||||
helper.registerAllowedMethod('npmExecuteScripts', [Map.class], { m ->
|
||||
})
|
||||
|
||||
stepRule.step.buildExecute(
|
||||
script: nullScript,
|
||||
buildTool: 'npm',
|
||||
helmExecute: true
|
||||
)
|
||||
|
||||
assertThat(helmExecuteCalled, is(true))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHelmExecuteNotCalledWhenNotConfigured() {
|
||||
def helmExecuteCalled = false
|
||||
helper.registerAllowedMethod('helmExecute', [Map.class], { m ->
|
||||
helmExecuteCalled = true
|
||||
return
|
||||
})
|
||||
helper.registerAllowedMethod('npmExecuteScripts', [Map.class], { m ->
|
||||
})
|
||||
stepRule.step.buildExecute(
|
||||
script: nullScript,
|
||||
buildTool: 'npm',
|
||||
helmExecute: false
|
||||
)
|
||||
|
||||
assertThat(helmExecuteCalled, is(false))
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ import static com.sap.piper.Prerequisites.checkScript
|
||||
/** For buildTool npm: Execute npm install (boolean, default 'true') */
|
||||
'npmInstall',
|
||||
/** For buildTool npm: List of npm run scripts to execute */
|
||||
'npmRunScripts'
|
||||
'npmRunScripts',
|
||||
/** toggles if a helmExecute is triggered at end of the step after invoking the build tool */
|
||||
'helmExecute'
|
||||
])
|
||||
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
||||
|
||||
@ -100,5 +102,9 @@ void call(Map parameters = [:]) {
|
||||
error "[${STEP_NAME}] buildTool not set and no dockerImage & dockerCommand provided."
|
||||
}
|
||||
}
|
||||
|
||||
if(config.helmExecute) {
|
||||
helmExecute script: script
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user