refactor(executeFreeleapsPipeline): streamline commit message linting logic and improve conditional checks
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
e574581d02
commit
bc29cf3514
@ -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,17 +57,11 @@ spec:
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def enabled = configurations.commitMessageLintEnabled
|
log.info("Pipeline","Commit message linting is enabled")
|
||||||
|
sourceFetcher.fetch(configurations)
|
||||||
|
|
||||||
if (enabled == null || !enabled) {
|
def linter = new CommitMessageLinter(this)
|
||||||
log.warn("Pipeline","Commit message linting is disabled")
|
linter.lint(configurations)
|
||||||
} else if (enabled) {
|
|
||||||
log.info("Pipeline","Commit message linting is enabled")
|
|
||||||
sourceFetcher.fetch(configurations)
|
|
||||||
|
|
||||||
def linter = new CommitMessageLinter(this)
|
|
||||||
linter.lint(configurations)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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 {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user