fix(pipeline): correct stage closure syntax in component stage generation
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
b906867e36
commit
ef9c74a43e
@ -18,7 +18,7 @@ def generateComponentStages(component, configurations) {
|
||||
def stages = []
|
||||
stages.addAll([
|
||||
// Build Agent Setup
|
||||
stage("${component.name} :: Build Agent Setup") {
|
||||
{stage("${component.name} :: Build Agent Setup") {
|
||||
script {
|
||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||
def buildAgentImage = component.buildAgentImage
|
||||
@ -41,9 +41,9 @@ def generateComponentStages(component, configurations) {
|
||||
env.buildAgentImage = buildAgentImage
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
// Dependencies Resolving
|
||||
stage("${component.name} :: Dependencies Resolving") {
|
||||
{stage("${component.name} :: Dependencies Resolving") {
|
||||
podTemplate(
|
||||
label: "dep-resolver-${component.name}",
|
||||
containers: [
|
||||
@ -82,13 +82,13 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
])
|
||||
|
||||
if (component.lintEnabled != null && component.lintEnabled) {
|
||||
stages.addAll([
|
||||
// Code Linter Environment Preparation
|
||||
stage("${component.name} :: Code Linter Preparation") {
|
||||
{stage("${component.name} :: Code Linter Preparation") {
|
||||
script {
|
||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||
if (component.lintEnabled != null && component.lintEnabled) {
|
||||
@ -115,9 +115,9 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
// Code Linting
|
||||
stage("${component.name} :: Code Linting") {
|
||||
{stage("${component.name} :: Code Linting") {
|
||||
podTemplate(
|
||||
label: "code-linter-${component.name}",
|
||||
containers: [
|
||||
@ -166,14 +166,14 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
])
|
||||
}
|
||||
|
||||
if (component.sastEnabled != null && component.sastEnabled) {
|
||||
stages.addAll([
|
||||
// SAST Scanner Environment Preparation
|
||||
stage("${component.name} :: SAST Scanner Preparation") {
|
||||
{stage("${component.name} :: SAST Scanner Preparation") {
|
||||
script {
|
||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||
if (component.sastEnabled != null && component.sastEnabled) {
|
||||
@ -195,9 +195,9 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
// SAST Scanning
|
||||
stage("${component.name} :: SAST Scanning") {
|
||||
{stage("${component.name} :: SAST Scanning") {
|
||||
when {
|
||||
expression {
|
||||
return (env.executeMode == "fully" || env.changedComponents.contains(component.name)) && env.sastScannerContainerImage != null && !env.sastScannerContainerImage.isEmpty()
|
||||
@ -235,14 +235,14 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
])
|
||||
}
|
||||
|
||||
if (component.semanticReleaseEnabled != null && component.semanticReleaseEnabled) {
|
||||
stages.addAll([
|
||||
// Semantic Releasing
|
||||
stage("${component.name} :: Semantic Releasing") {
|
||||
{stage("${component.name} :: Semantic Releasing") {
|
||||
podTemplate(
|
||||
label: "semantic-releasing-${component.name}",
|
||||
containers: [
|
||||
@ -273,13 +273,13 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
])
|
||||
}
|
||||
|
||||
stages.addAll([
|
||||
// Compilation & Packaging
|
||||
stage("${component.name} :: Compilation & Packaging") {
|
||||
{stage("${component.name} :: Compilation & Packaging") {
|
||||
podTemplate(
|
||||
label: "build-agent-${component.name}",
|
||||
containers: [
|
||||
@ -349,9 +349,9 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
// Image Builder Setup
|
||||
stage("${component.name} :: Image Builder Setup") {
|
||||
{stage("${component.name} :: Image Builder Setup") {
|
||||
script {
|
||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||
log.info("Pipeline", "Ready to setup image builder for ${component.name}")
|
||||
@ -370,9 +370,9 @@ def generateComponentStages(component, configurations) {
|
||||
log.info("Pipeline", "Using ${imageBuilder.builder} (image: ${imageBuilder.image}) as image builder for ${component.name}")
|
||||
}
|
||||
}
|
||||
},
|
||||
}},
|
||||
// Image Building & Publishing
|
||||
stage("${component.name} :: Image Building & Publishing") {
|
||||
{stage("${component.name} :: Image Building & Publishing") {
|
||||
podTemplate(
|
||||
label: "image-builder-${component.name}",
|
||||
containers: [
|
||||
@ -441,11 +441,11 @@ def generateComponentStages(component, configurations) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
])
|
||||
return {
|
||||
stages.each { stage ->
|
||||
stage.call()
|
||||
stages.each { stageClosure ->
|
||||
stageClosure()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -555,7 +555,7 @@ spec:
|
||||
steps {
|
||||
script {
|
||||
def componentStages = configurations.components.collectEntries { component ->
|
||||
["Generated Stage :: ${component}": generateComponentStages(component, configurations)]
|
||||
["Generated Stage :: ${component.name}": generateComponentStages(component, configurations)]
|
||||
}
|
||||
parallel componentStages
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user