Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pipeline {
buildDiscarder(logRotator(artifactNumToKeepStr: '10', numToKeepStr: branch_name == 'master' ? '15' : '10'))
timeout(time: 180, unit: 'MINUTES')
skipStagesAfterUnstable()
disableConcurrentBuilds()
}

triggers {
Expand Down Expand Up @@ -243,6 +244,21 @@ pipeline {
}

stages {
stage('Check skip build') {
steps {
script {
// Skip builds triggered by maven-release-plugin commits (e.g. "prepare release") to avoid infinite loop of builds during the release process.
// These commits are part of the release process and should not trigger a new CI build
def lastCommitMsg = sh(script: 'git --no-pager log -1 --pretty=%s', returnStdout: true).trim()
if (lastCommitMsg.startsWith('[maven-release-plugin] prepare release')) {
Comment on lines +250 to +253
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says we want to skip builds triggered by maven-release-plugin commits, but the condition only matches the specific prefix "[maven-release-plugin] prepare release". Maven release typically also creates a "prepare for next development iteration" commit (and potentially other maven-release-plugin messages), which will still trigger CI and defeat the stated goal. Consider matching on the common "[maven-release-plugin]" prefix and/or including the other release-plugin commit messages in the check (e.g., via regex).

Suggested change
// Skip builds triggered by maven-release-plugin commits (e.g. "prepare release") to avoid infinite loop of builds during the release process.
// These commits are part of the release process and should not trigger a new CI build
def lastCommitMsg = sh(script: 'git --no-pager log -1 --pretty=%s', returnStdout: true).trim()
if (lastCommitMsg.startsWith('[maven-release-plugin] prepare release')) {
// Skip builds triggered by maven-release-plugin commits (for example "prepare release"
// and "prepare for next development iteration") to avoid infinite loop of builds during
// the release process. These commits are part of the release process and should not
// trigger a new CI build.
def lastCommitMsg = sh(script: 'git --no-pager log -1 --pretty=%s', returnStdout: true).trim()
if (lastCommitMsg.startsWith('[maven-release-plugin]')) {

Copilot uses AI. Check for mistakes.
echo "Skipping build triggered by release commit: ${lastCommitMsg}"
currentBuild.description = "Skipped: release commit"
currentBuild.result = 'NOT_BUILT'
error("Build skipped - triggered by release process commit: ${lastCommitMsg}")
Comment on lines +256 to +257
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting currentBuild.result to 'NOT_BUILT' and then calling error(...) will still throw an exception that is treated as a build failure unless it is caught/handled. If the intent is a cleanly skipped build (not a failed one) for SCM/status checks, wrap the abort in catchError(buildResult: 'NOT_BUILT', stageResult: 'NOT_BUILT') (or an equivalent pattern) and avoid leaving the build in a FAILURE state.

Suggested change
currentBuild.result = 'NOT_BUILT'
error("Build skipped - triggered by release process commit: ${lastCommitMsg}")
catchError(buildResult: 'NOT_BUILT', stageResult: 'NOT_BUILT') {
error("Build skipped - triggered by release process commit: ${lastCommitMsg}")
}

Copilot uses AI. Check for mistakes.
}
}
}
}
stage('Preliminary steps') {
steps {

Expand Down
Loading