Allow to specify git branch instead of pull request id, Allow to break the build#93
Conversation
…eed attention AmadeusITGroup#92 Allow to specify git branch instead of pull request id Also includes existing PRs for AmadeusITGroup#22 and AmadeusITGroup#19
| public String getStashPullRequestId() throws StashConfigurationException { | ||
| String result = config.getPullRequestId(); | ||
|
|
||
| if(StringUtils.isNotBlank(config.getPullRequestBranch())) { |
There was a problem hiding this comment.
This is the main part for #92 - doing this in StashIssueReportingPostJob directly was not that easy (obscure junit test failures) but it would probably cleaner to move it there.
| LOGGER.error("Something unexpected went wrong: {}", e.getMessage(), e); | ||
| } | ||
|
|
||
| failBuildIfNecessary(project, issueReport); |
There was a problem hiding this comment.
Main part for #91 - needs to be outside of try... catch since the fail build should even work, if there is no pull request (yet)
| Long size = (Long) response.get("size"); | ||
| if(size==0) { | ||
| throw new GitBranchNotFoundOrNotUniqueException("Found no PR for branch "+branchName + " in repo "+repository); | ||
| } else if(size==1) { |
There was a problem hiding this comment.
What if you run a git-flow branching scheme and make a hotfix commit with PR towards both develop and master (if they happen to be in sync). That case would likely trigger size == 2 and still be valid, right?
|
+1 for this. we also do have feature branch builds where we don't know what the corresponding PR id is |
|
Thanks @t-8ch for the pointer. So I agree, in order to get predictable behaviour and find max 1 PR you would need to specify both source and target branch. I still think that would be useful if implemented that way. Alas, I'm also waiting for jenkinsci/bitbucket-branch-source-plugin#25 and once this will be merged we can probably start using PR builds (vs feature branch builds), in which case we would have the PR ID available again |
#91 Allow to break the build if there are issues that need attention
#92 Allow to specify git branch instead of pull request id
Also includes existing PRs for #22 and #19