Skip to content

Commit

Permalink
Emit warning instead of failing if Code Dx doesn't support branches
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercamp committed Jan 10, 2023
1 parent 13bb604 commit cf709c8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
Expand Up @@ -40,17 +40,16 @@ public String getBaseBranchName() {
public void validate(CodeDxVersion codedxVersion, String targetBranch, String baseBranch) throws IOException, InterruptedException {
if (targetBranch == null) {
// no target branch, nothing branch-related to do here
this.targetBranchName = null;
this.baseBranchName = null;
return;
}

if (codedxVersion.compareTo(CodeDxVersion.MIN_FOR_BRANCHING) < 0) {
throw new AbortException(
logger.println(
"The connected Code Dx server with version " + codedxVersion + " does not support project branches. " +
"The minimum required version is " + CodeDxVersion.MIN_FOR_BRANCHING + ". Remove " +
"the target branch name or upgrade to a more recent version of Code Dx."
"The minimum required version is " + CodeDxVersion.MIN_FOR_BRANCHING + ". The target branch and base " +
"branch options will be ignored."
);
return;
}

this.targetBranchName = resolver.resolve("target branch", targetBranch);
Expand Down
16 changes: 8 additions & 8 deletions src/main/webapp/help-baseBranch.html
@@ -1,16 +1,16 @@
<div>
<span>
<p>
The Code Dx branch to use as the parent if the specified "target branch" does not exist yet.
The new branch will inherit the findings of the base branch. The branch must exist in the
Code Dx project beforehand.
</span>
<span>
</p>
<p>
This field is ignored if a "target branch" is not specified, or if the target branch already exists.
</span>
<span>
</p>
<p>
This field is required if the "target branch" does not exist yet.
</span>
<span>
</p>
<p>
("Branches" refer to branches within the Code Dx project, not SCM branches.)
</span>
</p>
</div>
17 changes: 13 additions & 4 deletions src/main/webapp/help-targetBranch.html
@@ -1,10 +1,19 @@
<div>
<span>
<p>
The Code Dx branch to store analysis results in. If the branch does not exist, it
will be created with the specified "base branch". The "base branch" parameter is required
if the target branch does not exist yet.
</span>
<span>
</p>
<p>
("Branches" refer to branches within the Code Dx project, not SCM branches.)
</span>
</p>
<p>
You can use build/environment variables to construct the target branch dynamically. For example:
<pre><code>${BRANCH_NAME}</code></pre>
would target the branch specified by that build variable.
</p>
<p>
Note: the branching feature is only supported by Code Dx versions 2022.4.0 and up. This
option is ignored for older versions.
</p>
</div>

0 comments on commit cf709c8

Please sign in to comment.