refactor(executeFreeleapsPipeline): streamline commit message linting logic and improve conditional checks

Signed-off-by: 孙振宇 <>
This commit is contained in:
孙振宇 2025-02-04 12:11:42 +08:00
parent e574581d02
commit bc29cf3514

View File

@ -25,6 +25,11 @@ def call(Closure closure) {
stages { stages {
stage("Commit Linting If Enabled") { stage("Commit Linting If Enabled") {
when {
expression {
return configurations.commitMessageLintEnabled != null && configurations.commitMessageLintEnabled
}
}
agent { agent {
kubernetes { kubernetes {
defaultContainer 'commit-message-linter' defaultContainer 'commit-message-linter'
@ -52,11 +57,6 @@ spec:
} }
steps { steps {
script { script {
def enabled = configurations.commitMessageLintEnabled
if (enabled == null || !enabled) {
log.warn("Pipeline","Commit message linting is disabled")
} else if (enabled) {
log.info("Pipeline","Commit message linting is enabled") log.info("Pipeline","Commit message linting is enabled")
sourceFetcher.fetch(configurations) sourceFetcher.fetch(configurations)
@ -65,7 +65,6 @@ spec:
} }
} }
} }
}
stage("Execute Mode Detection") { stage("Execute Mode Detection") {
steps { steps {
@ -74,7 +73,7 @@ spec:
if (executeMode == null || executeMode.isEmpty()) { if (executeMode == null || executeMode.isEmpty()) {
log.warn("Pipeline","Not set executeMode, using fully as default execute mode") log.warn("Pipeline","Not set executeMode, using fully as default execute mode")
env.executeMode = "fully" env.executeMode = "fully"
} else if (executeMode == 'on-demand' && serviceGitRepoType != 'monorepo') { } else if (executeMode == 'on-demand' && configurations.serviceGitRepoType != 'monorepo') {
log.warn("Pipeline","serviceGirRepoType is not monorepo, on-demand mode is not supported, using fully mode") log.warn("Pipeline","serviceGirRepoType is not monorepo, on-demand mode is not supported, using fully mode")
env.executeMode = "fully" env.executeMode = "fully"
} else { } else {