fix(pipeline): update environment variable naming for component-specific images in stage generation
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
ef9c74a43e
commit
36f4604e6a
@ -38,7 +38,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("Pipeline", "Using ${buildAgentImage} as build agent image for ${component.name}")
|
log.info("Pipeline", "Using ${buildAgentImage} as build agent image for ${component.name}")
|
||||||
env.buildAgentImage = buildAgentImage
|
env."${component.name}_buildAgentImage" = buildAgentImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
@ -49,7 +49,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
containers: [
|
containers: [
|
||||||
containerTemplate(
|
containerTemplate(
|
||||||
name: 'dep-resolver',
|
name: 'dep-resolver',
|
||||||
image: env.buildAgentImage,
|
image: env."${component.name}_buildAgentImage",
|
||||||
ttyEnabled: true,
|
ttyEnabled: true,
|
||||||
command: 'sleep',
|
command: 'sleep',
|
||||||
args: 'infinity'
|
args: 'infinity'
|
||||||
@ -60,7 +60,8 @@ def generateComponentStages(component, configurations) {
|
|||||||
container('dep-resolver') {
|
container('dep-resolver') {
|
||||||
script {
|
script {
|
||||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||||
log.info("Pipeline", "Using ${env.buildAgentImage} as build agent image for dependencies resolving")
|
def buildAgentImage = env."${component.name}_buildAgentImage"
|
||||||
|
log.info("Pipeline", "Using ${buildAgentImage} as build agent image for dependencies resolving")
|
||||||
def sourceFetcher = new SourceFetcher(this)
|
def sourceFetcher = new SourceFetcher(this)
|
||||||
sourceFetcher.fetch(configurations)
|
sourceFetcher.fetch(configurations)
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("Pipeline", "Using ${linter.linter} with image ${linter.containerImage} as linter for ${component.name}")
|
log.info("Pipeline", "Using ${linter.linter} with image ${linter.containerImage} as linter for ${component.name}")
|
||||||
env.linterContainerImage = linter.containerImage
|
env."${component.name}_linterContainerImage" = linter.containerImage
|
||||||
} else {
|
} else {
|
||||||
log.info("Pipeline", "Code linting is not enabled for ${component.name}, skipping...")
|
log.info("Pipeline", "Code linting is not enabled for ${component.name}, skipping...")
|
||||||
}
|
}
|
||||||
@ -123,7 +124,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
containers: [
|
containers: [
|
||||||
containerTemplate(
|
containerTemplate(
|
||||||
name: 'code-linter',
|
name: 'code-linter',
|
||||||
image: env.linterContainerImage,
|
image: env."${component.name}_linterContainerImage",
|
||||||
ttyEnabled: true,
|
ttyEnabled: true,
|
||||||
command: 'sleep',
|
command: 'sleep',
|
||||||
args: 'infinity'
|
args: 'infinity'
|
||||||
@ -190,7 +191,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
log.error("Pipeline", "SAST scanner ${sastScannerType.scanner} is not supported for ${component.language}, skipping SAST scanning")
|
log.error("Pipeline", "SAST scanner ${sastScannerType.scanner} is not supported for ${component.language}, skipping SAST scanning")
|
||||||
} else {
|
} else {
|
||||||
log.info("Pipeline", "Using ${sastScanner} as SAST scanner for ${component.name}")
|
log.info("Pipeline", "Using ${sastScanner} as SAST scanner for ${component.name}")
|
||||||
env.sastScannerContainerImage = sastScannerType.containerImage
|
env."${component.name}_sastScannerContainerImage" = sastScannerType.containerImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +209,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
containers: [
|
containers: [
|
||||||
containerTemplate(
|
containerTemplate(
|
||||||
name: 'sast-scanner',
|
name: 'sast-scanner',
|
||||||
image: env.sastScannerContainerImage,
|
image: env."${component.name}_sastScannerContainerImage",
|
||||||
ttyEnabled: true,
|
ttyEnabled: true,
|
||||||
command: 'sleep',
|
command: 'sleep',
|
||||||
args: 'infinity'
|
args: 'infinity'
|
||||||
@ -285,7 +286,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
containers: [
|
containers: [
|
||||||
containerTemplate(
|
containerTemplate(
|
||||||
name: 'build-agent',
|
name: 'build-agent',
|
||||||
image: env.buildAgentImage,
|
image: env."${component.name}_buildAgentImage",
|
||||||
ttyEnabled: true,
|
ttyEnabled: true,
|
||||||
command: 'sleep',
|
command: 'sleep',
|
||||||
args: 'infinity'
|
args: 'infinity'
|
||||||
@ -296,7 +297,8 @@ def generateComponentStages(component, configurations) {
|
|||||||
container('build-agent') {
|
container('build-agent') {
|
||||||
script {
|
script {
|
||||||
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
|
||||||
log.info("Pipeline", "Using ${env.buildAgentImage} as build agent image for compilation & packaging")
|
def buildAgentImage = env."${component.name}_buildAgentImage"
|
||||||
|
log.info("Pipeline", "Using ${buildAgentImage} as build agent image for compilation & packaging")
|
||||||
|
|
||||||
def sourceFetcher = new SourceFetcher(this)
|
def sourceFetcher = new SourceFetcher(this)
|
||||||
sourceFetcher.fetch(configurations)
|
sourceFetcher.fetch(configurations)
|
||||||
@ -366,7 +368,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
env.imageBuilderImage = imageBuilder.image
|
env."${component.name}_imageBuilderImage" = imageBuilder.image
|
||||||
log.info("Pipeline", "Using ${imageBuilder.builder} (image: ${imageBuilder.image}) as image builder for ${component.name}")
|
log.info("Pipeline", "Using ${imageBuilder.builder} (image: ${imageBuilder.image}) as image builder for ${component.name}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +380,7 @@ def generateComponentStages(component, configurations) {
|
|||||||
containers: [
|
containers: [
|
||||||
containerTemplate(
|
containerTemplate(
|
||||||
name: 'image-builder',
|
name: 'image-builder',
|
||||||
image: env.imageBuilderImage,
|
image: env."${component.name}_imageBuilderImage",
|
||||||
privileged: true,
|
privileged: true,
|
||||||
ttyEnabled: true,
|
ttyEnabled: true,
|
||||||
command: 'sleep',
|
command: 'sleep',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user