Skip to content

Add option to not fail the build if version already exists#1145

Merged
rantoniuk merged 4 commits intojenkinsci:masterfrom
rantoniuk:copilot/add-option-to-ignore-existing-version
Dec 17, 2025
Merged

Add option to not fail the build if version already exists#1145
rantoniuk merged 4 commits intojenkinsci:masterfrom
rantoniuk:copilot/add-option-to-ignore-existing-version

Conversation

@rantoniuk
Copy link
Member

@rantoniuk rantoniuk commented Dec 17, 2025

This pull request adds a new option to the Jira Version Creator and Builder steps, allowing users to choose whether a build should fail if the specified Jira version already exists. By default, builds will still fail if the version exists, but this can now be configured via the UI and pipeline.

Fixes #750

  • I have updated/added relevant documentation in the docs/ directory
  • I have verified that the Code Coverage is not lower than before / that all the changes are covered as needed
  • I have tested my changes with a Jira Cloud / Jira Server

Copilot AI review requested due to automatic review settings December 17, 2025 00:54
@rantoniuk rantoniuk requested a review from a team as a code owner December 17, 2025 00:54
Copy link
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

This PR adds a configurable failIfAlreadyExists option to both JiraVersionCreator and JiraVersionCreatorBuilder, allowing users to choose whether builds should fail when a specified Jira version already exists. The default behavior (failing on existing versions) is preserved for backward compatibility.

Key Changes:

  • Added failIfAlreadyExists boolean field with true as default to maintain backward compatibility
  • Implemented readResolve() methods in both classes to handle deserialization of old configurations
  • Refactored VersionCreator.perform() to accept parameters via setters rather than method arguments

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/main/java/hudson/plugins/jira/VersionCreator.java Core logic updated to conditionally fail builds based on failIfAlreadyExists flag; removed obsolete finished(Result.FAILURE) call from exception handler; added setter methods for configuration
src/main/java/hudson/plugins/jira/JiraVersionCreatorBuilder.java Added failIfAlreadyExists field with readResolve() for backward compatibility; updated perform() to use new setter-based API
src/main/java/hudson/plugins/jira/JiraVersionCreator.java Added failIfAlreadyExists field with readResolve() for backward compatibility; updated perform() to use new setter-based API
src/test/java/hudson/plugins/jira/VersionCreatorTest.java Updated existing tests to use new setter-based API; added test for new failIfAlreadyExists=false behavior; reorganized imports
src/main/resources/hudson/plugins/jira/JiraVersionCreatorBuilder/config.jelly Added checkbox UI element for failIfAlreadyExists option with default="true"
src/main/resources/hudson/plugins/jira/JiraVersionCreator/config.jelly Added checkbox UI element for failIfAlreadyExists option with default="true"
src/main/resources/hudson/plugins/jira/JiraVersionCreatorBuilder/help-failIfAlreadyExists.html New help file documenting the failIfAlreadyExists option
src/main/resources/hudson/plugins/jira/JiraVersionCreator/help-failIfAlreadyExists.html New help file documenting the failIfAlreadyExists option
src/main/webapp/help-version-create.html Updated to reflect new configurable behavior
README.md Restructured documentation links and removed Contributing section (moved to CONTRIBUTING.md) - appears unrelated to this PR
CONTRIBUTING.md Added backward-compatibility guideline and updated reference links - partially unrelated to this PR

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

@rantoniuk rantoniuk removed the request for review from a team December 17, 2025 01:22
Copy link
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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.


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

@rantoniuk rantoniuk enabled auto-merge (squash) December 17, 2025 13:20
@rantoniuk rantoniuk merged commit 7404b0b into jenkinsci:master Dec 17, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create new version - option to not fail build if version already exists

3 participants