fix(pipeline): update SourceFetcher to use dynamic git credentials ID

Signed-off-by: 孙振宇 <>
This commit is contained in:
孙振宇 2025-02-07 15:57:10 +08:00
parent 044f96d525
commit 9352de5270

View File

@ -15,7 +15,9 @@ import com.freeleaps.devops.enums.CodeLinterTypes
import com.freeleaps.devops.enums.ImageBuilderTypes
def generateComponentStages(component, configurations) {
return [
def stages = []
stages.addAll([
// Build Agent Setup
stage("${component.name} :: Build Agent Setup") {
script {
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
@ -40,7 +42,7 @@ def generateComponentStages(component, configurations) {
}
}
},
// Dependencies Resolving
stage("${component.name} :: Dependencies Resolving") {
podTemplate(
label: "dep-resolver-${component.name}",
@ -81,7 +83,11 @@ def generateComponentStages(component, configurations) {
}
}
},
])
if (component.lintEnabled != null && component.lintEnabled) {
stages.addAll([
// Code Linter Environment Preparation
stage("${component.name} :: Code Linter Preparation") {
script {
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
@ -110,13 +116,8 @@ def generateComponentStages(component, configurations) {
}
}
},
stage("${component.name} :: Code Linting If Enabled") {
when {
expression {
return (env.executeMode == "fully" || env.changedComponents.contains(component.name)) && env.linterContainerImage != null && !env.linterContainerImage.isEmpty()
}
}
// Code Linting
stage("${component.name} :: Code Linting") {
podTemplate(
label: "code-linter-${component.name}",
containers: [
@ -149,8 +150,13 @@ def generateComponentStages(component, configurations) {
}
}
}
},
}
])
}
if (component.sastEnabled != null && component.sastEnabled) {
stages.addAll([
// SAST Scanner Environment Preparation
stage("${component.name} :: SAST Scanner Preparation") {
script {
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
@ -174,8 +180,8 @@ def generateComponentStages(component, configurations) {
}
}
},
stage("${component.name} :: SAST Scanning If Enabled") {
// SAST Scanning
stage("${component.name} :: SAST Scanning") {
when {
expression {
return (env.executeMode == "fully" || env.changedComponents.contains(component.name)) && env.sastScannerContainerImage != null && !env.sastScannerContainerImage.isEmpty()
@ -213,8 +219,13 @@ def generateComponentStages(component, configurations) {
}
}
}
},
}
])
}
if (component.semanticReleaseEnabled != null && component.semanticReleaseEnabled) {
stages.addAll([
// Semantic Release Environment Preparation
stage("${component.name} :: Semantic Release Preparation") {
script {
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
@ -231,8 +242,8 @@ def generateComponentStages(component, configurations) {
}
}
},
stage("${component.name} :: Semantic Releasing If Enabled") {
// Semantic Releasing
stage("${component.name} :: Semantic Releasing") {
when {
expression {
return (env.executeMode == "fully" || env.changedComponents.contains(component.name)) && env.semanticReleasingContainerImage != null && !env.semanticReleasingContainerImage.isEmpty()
@ -268,8 +279,12 @@ def generateComponentStages(component, configurations) {
}
}
}
},
}
])
}
stages.addAll([
// Compilation & Packaging
stage("${component.name} :: Compilation & Packaging") {
podTemplate(
label: "build-agent-${component.name}",
@ -319,7 +334,7 @@ def generateComponentStages(component, configurations) {
}
}
},
// Image Builder Setup
stage("${component.name} :: Image Builder Setup") {
script {
if (env.executeMode == "fully" || env.changedComponents.contains(component.name)) {
@ -340,7 +355,7 @@ def generateComponentStages(component, configurations) {
}
}
},
// Image Building & Publishing
stage("${component.name} :: Image Building & Publishing") {
when {
expression {
@ -400,11 +415,8 @@ def generateComponentStages(component, configurations) {
}
}
}
// stage("${component.name} :: Argo Application Version Updating (Deploying)") {
// }
]
])
return stages
}
def call(Closure closure) {