Skip to content

chore(QTDI-2347): prevent concurrent builds and skip release-triggered builds in Jenkinsfile#1218

Open
lxia-talend wants to merge 1 commit intomasterfrom
lxia/QTDI-2347_component-runtime_two-commits-building-at-the-same-time
Open

chore(QTDI-2347): prevent concurrent builds and skip release-triggered builds in Jenkinsfile#1218
lxia-talend wants to merge 1 commit intomasterfrom
lxia/QTDI-2347_component-runtime_two-commits-building-at-the-same-time

Conversation

@lxia-talend
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Jenkins declarative pipeline to reduce build contention and avoid CI loops caused by release automation commits.

Changes:

  • Disables concurrent builds for the Jenkins pipeline job.
  • Adds an early stage that attempts to skip builds triggered by maven-release-plugin “prepare release” commits.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Jenkinsfile
Comment on lines +250 to +253
// 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')) {
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.
Comment thread Jenkinsfile
Comment on lines +256 to +257
currentBuild.result = 'NOT_BUILT'
error("Build skipped - triggered by release process commit: ${lastCommitMsg}")
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants