nebula-plugins / nebula-plugins/nebula-release-plugin
DEVELOPMENT_METADATA_STRATEGY fails when branch doesn't match pattern even if not used
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 236
- Forks
- 60
- Avg merge
- 10m
- Merged PRs (30d)
- 4
Description
Consider the following config:
nebulaRelease {
shortenedBranchPattern = /(?:(?:bug|chore|feature|refactor|release)(?:-|\/))?(\d+)/
}
With that config, version evaluation will fail from any branch that doesn't match that pattern (i.e. doesn't start with a number), even if it doesn't need to (i.e. if branch is in releaseBranchPatterns, e.g. master or HEAD) like:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'foo'.
> index is out of range 0..-1 (index = 0)
stacktrace:
index is out of range 0..-1 (index = 0)
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'foo'.
Caused by: java.lang.IndexOutOfBoundsException: index is out of range 0..-1 (index = 0)
at nebula.plugin.release.NetflixOssStrategies$BuildMetadata$__clinit__closure1.doCall(NetflixOssStrategies.groovy:57)
at com.sun.proxy.$Proxy63.infer(Unknown Source)
at org.ajoberstar.gradle.git.release.semver.PartialSemVerStrategy$infer$0.call(Unknown Source)
at org.ajoberstar.gradle.git.release.semver.PartialSemVerStrategy$infer.call(Unknown Source)
at org.ajoberstar.gradle.git.release.semver.StrategyUtil$_ApplyAllChainedPartialSemVerStrategy_infer_closure1.doCall(StrategyUtil.groovy:100)
at org.ajoberstar.gradle.git.release.semver.StrategyUtil$ApplyAllChainedPartialSemVerStrategy.infer(StrategyUtil.groovy:99)
at org.ajoberstar.gradle.git.release.semver.PartialSemVerStrategy$infer.call(Unknown Source)
at org.ajoberstar.gradle.git.release.semver.SemVerStrategy.doInfer(SemVerStrategy.groovy:172)
at org.ajoberstar.gradle.git.release.semver.SemVerStrategy.infer(SemVerStrategy.groovy:146)
at org.ajoberstar.gradle.git.release.base.VersionStrategy$infer$1.call(Unknown Source)
at org.ajoberstar.gradle.git.release.base.ReleasePluginExtension$DelayedVersion.infer(ReleasePluginExtension.groovy:121)
at org.ajoberstar.gradle.git.release.base.ReleasePluginExtension$DelayedVersion.toString(ReleasePluginExtension.groovy:127)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at NetflixOssStrategies.groovy:57, in the DEVELOPMENT_METADATA_STRATEGY path, and trace how the shortenedBranchPattern match is used for release branches such as master or HEAD. Reproduce the configuration shown in the issue and verify that version evaluation no longer throws when an unmatched branch is covered by releaseBranchPatterns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- build-system, release
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100