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 {
stage("Commit Linting If Enabled") {
when {
expression {
return configurations.commitMessageLintEnabled != null && configurations.commitMessageLintEnabled
}
}
agent {
kubernetes {
defaultContainer 'commit-message-linter'
@ -52,17 +57,11 @@ spec:
}
steps {
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")
sourceFetcher.fetch(configurations)
log.info("Pipeline","Commit message linting is enabled")
sourceFetcher.fetch(configurations)
def linter = new CommitMessageLinter(this)
linter.lint(configurations)
}
def linter = new CommitMessageLinter(this)
linter.lint(configurations)
}
}
}
@ -74,7 +73,7 @@ spec:
if (executeMode == null || executeMode.isEmpty()) {
log.warn("Pipeline","Not set executeMode, using fully as default execute mode")
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")
env.executeMode = "fully"
} else {