Add option to not fail the build if version already exists#1145
Conversation
There was a problem hiding this comment.
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
failIfAlreadyExistsboolean field withtrueas 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.
There was a problem hiding this comment.
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.
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
docs/directory