Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

HAP-305 - Issue tracker items in release build

* Changes in the model
  • Loading branch information...
commit b9b96dd3362d6944fd6a0c41ebb8bb6a8a9d2b80 1 parent f9ab847
Shay Yaakov authored
View
3  build-info-api/src/main/java/org/jfrog/build/api/BuildInfoFields.java
@@ -41,7 +41,4 @@
String RELEASE_ENABLED = "promotion.enabled";
String RELEASE_COMMENT = "promotion.comment";
String BUILD_ROOT = "build.root";
- String BUILD_ISSUE_TRACKER_NAME = "build.issues.tracker.name";
- String BUILD_ISSUE_TRACKER_VERSION = "build.issues.tracker.version";
- String BUILD_AFFECTED_ISSUES = "build.issues.affected";
}
View
1  build-info-api/src/main/java/org/jfrog/build/api/BuildInfoProperties.java
@@ -30,6 +30,7 @@
*/
String BUILD_INFO_PROP_PREFIX = BUILD_INFO_PREFIX + "property.";
String BUILD_INFO_LICENSE_CONTROL_PREFIX = BUILD_INFO_PREFIX + "licenseControl.";
+ String BUILD_INFO_ISSUES_TRACKER_PREFIX = BUILD_INFO_PREFIX + "issues.";
/**
* Prefix for build info properties that are coming from the CI server.
View
44 build-info-api/src/main/java/org/jfrog/build/api/Issue.java
@@ -10,6 +10,7 @@
private String key;
private String url;
private String summary;
+ private boolean aggregated;
public Issue() {
}
@@ -18,6 +19,7 @@ public Issue(String key, String url, String summary) {
this.key = key;
this.url = url;
this.summary = summary;
+ this.aggregated = false;
}
public String getKey() {
@@ -43,4 +45,46 @@ public String getSummary() {
public void setSummary(String summary) {
this.summary = summary;
}
+
+ public boolean isAggregated() {
+ return aggregated;
+ }
+
+ public void setAggregated(boolean aggregated) {
+ this.aggregated = aggregated;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof Issue)) {
+ return false;
+ }
+
+ Issue that = (Issue) o;
+
+ if (key != null ? !key.equals(that.key) : that.key != null) {
+ return false;
+ }
+
+ if (url != null ? !url.equals(that.url) : that.url != null) {
+ return false;
+ }
+
+ if (summary != null ? !summary.equals(that.summary) : that.summary != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = (key != null ? key.hashCode() : 0);
+ result = 31 * result + (url != null ? url.hashCode() : 0);
+ result = 31 * result + (summary != null ? summary.hashCode() : 0);
+ return result;
+ }
}
View
30 build-info-api/src/main/java/org/jfrog/build/api/Issues.java
@@ -1,9 +1,9 @@
package org.jfrog.build.api;
-import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import java.io.Serializable;
-import java.util.List;
+import java.util.Set;
/**
* @author Noam Y. Tenne
@@ -11,7 +11,9 @@
public class Issues implements Serializable {
private IssueTracker tracker;
- private List<Issue> affectedIssues;
+ private boolean aggregateBuildIssues;
+ private String aggregationBuildStatus;
+ private Set<Issue> affectedIssues;
public IssueTracker getTracker() {
return tracker;
@@ -21,18 +23,34 @@ public void setTracker(IssueTracker tracker) {
this.tracker = tracker;
}
- public List<Issue> getAffectedIssues() {
+ public Set<Issue> getAffectedIssues() {
return affectedIssues;
}
public void addIssue(Issue issue) {
if (affectedIssues == null) {
- affectedIssues = Lists.newArrayList();
+ affectedIssues = Sets.newHashSet();
}
affectedIssues.add(issue);
}
- public void setAffectedIssues(List<Issue> affectedIssues) {
+ public void setAffectedIssues(Set<Issue> affectedIssues) {
this.affectedIssues = affectedIssues;
}
+
+ public boolean isAggregateBuildIssues() {
+ return aggregateBuildIssues;
+ }
+
+ public void setAggregateBuildIssues(boolean aggregateBuildIssues) {
+ this.aggregateBuildIssues = aggregateBuildIssues;
+ }
+
+ public String getAggregationBuildStatus() {
+ return aggregationBuildStatus;
+ }
+
+ public void setAggregationBuildStatus(String aggregationBuildStatus) {
+ this.aggregationBuildStatus = aggregationBuildStatus;
+ }
}
View
14 build-info-api/src/main/java/org/jfrog/build/api/IssuesTrackerFields.java
@@ -0,0 +1,14 @@
+package org.jfrog.build.api;
+
+/**
+ * All the issue tracker related fields which exist inside the build info JSON
+ *
+ * @author Shay Yaakov
+ */
+public interface IssuesTrackerFields {
+ String ISSUES_TRACKER_NAME = "tracker.name";
+ String ISSUES_TRACKER_VERSION = "tracker.version";
+ String AFFECTED_ISSUES = "affectedIssues";
+ String AGGREGATE_BUILD_ISSUES = "aggregateBuildIssues";
+ String AGGREGATION_BUILD_STATUS = "aggregationBuildStatus";
+}
View
110 build-info-client/src/main/java/org/jfrog/build/client/ArtifactoryClientConfiguration.java
@@ -17,8 +17,8 @@
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.google.common.io.Closeables;
import org.apache.commons.lang.StringUtils;
import org.jfrog.build.api.Build;
@@ -30,15 +30,15 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.TreeMap;
import static org.jfrog.build.api.BuildInfoConfigProperties.*;
import static org.jfrog.build.api.BuildInfoFields.*;
-import static org.jfrog.build.api.BuildInfoProperties.BUILD_INFO_LICENSE_CONTROL_PREFIX;
-import static org.jfrog.build.api.BuildInfoProperties.BUILD_INFO_PREFIX;
+import static org.jfrog.build.api.BuildInfoProperties.*;
+import static org.jfrog.build.api.IssuesTrackerFields.*;
import static org.jfrog.build.api.LicenseControlFields.*;
import static org.jfrog.build.client.ClientConfigurationFields.*;
import static org.jfrog.build.client.ClientProperties.*;
@@ -570,9 +570,72 @@ public Boolean isAutoDiscover() {
}
}
+ public class IssuesTrackerHandler extends PrefixPropertyHandler {
+ public IssuesTrackerHandler() {
+ super(root, BUILD_INFO_ISSUES_TRACKER_PREFIX);
+ }
+
+ public String getIssueTrackerName() {
+ return getStringValue(ISSUES_TRACKER_NAME);
+ }
+
+ public void setIssueTrackerName(String issueTrackerName) {
+ setStringValue(ISSUES_TRACKER_NAME, issueTrackerName);
+ }
+
+ public String getIssueTrackerVersion() {
+ return getStringValue(ISSUES_TRACKER_VERSION);
+ }
+
+ public void setIssueTrackerVersion(String issueTrackerVersion) {
+ setStringValue(ISSUES_TRACKER_VERSION, issueTrackerVersion);
+ }
+
+ public boolean getAggregateBuildIssues() {
+ return getBooleanValue(AGGREGATE_BUILD_ISSUES);
+ }
+
+ public void setAggregateBuildIssues(boolean aggregateBuildIssues) {
+ setBooleanValue(AGGREGATE_BUILD_ISSUES, aggregateBuildIssues);
+ }
+
+ public String getAggregationBuildStatus() {
+ return getStringValue(AGGREGATION_BUILD_STATUS);
+ }
+
+ public void setAggregationBuildStatus(String aggregationBuildStatus) {
+ setStringValue(AGGREGATION_BUILD_STATUS, aggregationBuildStatus);
+ }
+
+ public String getAffectedIssues() {
+ return getStringValue(AFFECTED_ISSUES);
+ }
+
+ public void setAffectedIssues(String affectedIssues) {
+ setStringValue(AFFECTED_ISSUES, affectedIssues);
+ }
+
+ public Set<Issue> getAffectedIssuesSet() {
+ Set<Issue> affectedIssuesSet = Sets.newHashSet();
+ String affectedIssues = getStringValue(AFFECTED_ISSUES);
+ if (StringUtils.isNotBlank(affectedIssues)) {
+ String[] issuePairs = affectedIssues.split(",");
+ for (String pair : issuePairs) {
+ String[] idAndUrl = pair.split(">>");
+ if (idAndUrl.length == 3) {
+ affectedIssuesSet.add(new Issue(idAndUrl[0], idAndUrl[1], idAndUrl[2]));
+ }
+ }
+ }
+ return affectedIssuesSet;
+ }
+ }
+
public class BuildInfoHandler extends PrefixPropertyHandler {
public final LicenseControlHandler licenseControl = new LicenseControlHandler();
+ public final IssuesTrackerHandler issues = new IssuesTrackerHandler();
+
private final Predicate<String> buildVariablesPredicate;
public BuildInfoHandler() {
@@ -754,45 +817,6 @@ public String getBuildRoot() {
return getStringValue(BUILD_ROOT);
}
- public String getIssueTrackerName() {
- return getStringValue(BUILD_ISSUE_TRACKER_NAME);
- }
-
- public void setIssueTrackerName(String issueTrackerName) {
- setStringValue(BUILD_ISSUE_TRACKER_NAME, issueTrackerName);
- }
-
- public String getIssueTrackerVersion() {
- return getStringValue(BUILD_ISSUE_TRACKER_VERSION);
- }
-
- public void setIssueTrackerVersion(String issueTrackerVersion) {
- setStringValue(BUILD_ISSUE_TRACKER_VERSION, issueTrackerVersion);
- }
-
- public String getAffectedIssues() {
- return getStringValue(BUILD_AFFECTED_ISSUES);
- }
-
- public void setAffectedIssues(String affectedIssues) {
- setStringValue(BUILD_AFFECTED_ISSUES, affectedIssues);
- }
-
- public List<Issue> getAffectedIssuesList() {
- List<Issue> affectedIssuesList = Lists.newArrayList();
- String affectedIssues = getStringValue(BUILD_AFFECTED_ISSUES);
- if (StringUtils.isNotBlank(affectedIssues)) {
- String[] issuePairs = affectedIssues.split(",");
- for (String pair : issuePairs) {
- String[] idAndUrl = pair.split(">>");
- if (idAndUrl.length == 3) {
- affectedIssuesList.add(new Issue(idAndUrl[0], idAndUrl[1], idAndUrl[2]));
- }
- }
- }
- return affectedIssuesList;
- }
-
public void addBuildVariables(Map<String, String> buildVariables) {
for (Map.Entry<String, String> entry : buildVariables.entrySet()) {
addBuildVariable(entry.getKey(), entry.getValue());
View
12 ...c/main/groovy/org/jfrog/gradle/plugin/artifactory/extractor/GradleBuildInfoExtractor.java
@@ -186,13 +186,15 @@ public Build extract(Project rootProject, BuildInfoExtractorSpec spec) {
.ciUser(principal).user(artifactoryPrincipal).build());
}
- String issueTrackerName = clientConf.info.getIssueTrackerName();
+ String issueTrackerName = clientConf.info.issues.getIssueTrackerName();
if (StringUtils.isNotBlank(issueTrackerName)) {
Issues issues = new Issues();
- issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.getIssueTrackerVersion()));
- List<Issue> affectedIssuesList = clientConf.info.getAffectedIssuesList();
- if (!affectedIssuesList.isEmpty()) {
- issues.setAffectedIssues(affectedIssuesList);
+ issues.setAggregateBuildIssues(clientConf.info.issues.getAggregateBuildIssues());
+ issues.setAggregationBuildStatus(clientConf.info.issues.getAggregationBuildStatus());
+ issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.issues.getIssueTrackerVersion()));
+ Set<Issue> affectedIssuesSet = clientConf.info.issues.getAffectedIssuesSet();
+ if (!affectedIssuesSet.isEmpty()) {
+ issues.setAffectedIssues(affectedIssuesSet);
}
bib.issues(issues);
}
View
48 ...ractor-ivy/src/main/java/org/jfrog/build/extractor/listener/ArtifactoryBuildListener.java
@@ -14,16 +14,31 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.Ant;
-import org.jfrog.build.api.*;
+import org.jfrog.build.api.Agent;
+import org.jfrog.build.api.Build;
+import org.jfrog.build.api.BuildAgent;
+import org.jfrog.build.api.BuildRetention;
+import org.jfrog.build.api.BuildType;
+import org.jfrog.build.api.Issue;
+import org.jfrog.build.api.IssueTracker;
+import org.jfrog.build.api.Issues;
+import org.jfrog.build.api.LicenseControl;
import org.jfrog.build.api.builder.BuildInfoBuilder;
-import org.jfrog.build.client.*;
+import org.jfrog.build.client.ArtifactoryBuildInfoClient;
+import org.jfrog.build.client.ArtifactoryClientConfiguration;
+import org.jfrog.build.client.DeployDetails;
+import org.jfrog.build.client.IncludeExcludePatterns;
+import org.jfrog.build.client.PatternMatcher;
import org.jfrog.build.context.BuildContext;
import org.jfrog.build.extractor.BuildInfoExtractorUtils;
import org.jfrog.build.extractor.trigger.ArtifactoryBuildInfoTrigger;
import org.jfrog.build.util.IvyBuildInfoLog;
import java.io.IOException;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Properties;
+import java.util.Set;
/**
@@ -43,12 +58,15 @@ public ArtifactoryBuildListener() {
DEPENDENCY_TRIGGER.setEvent(EndResolveEvent.NAME);
PUBLISH_TRIGGER.setEvent(StartArtifactPublishEvent.NAME);
Project project = (Project) IvyContext.peekInContextStack(IvyTask.ANT_PROJECT_CONTEXT_KEY);
- ArtifactoryClientConfiguration clientConf = new ArtifactoryClientConfiguration(new IvyBuildInfoLog(project));
+ ArtifactoryClientConfiguration clientConf = new ArtifactoryClientConfiguration(
+ new IvyBuildInfoLog(project));
Properties props = getMergedEnvAndSystemProps();
clientConf.fillFromProperties(props);
ctx = new BuildContext(clientConf);
} catch (Exception e) {
- RuntimeException re = new RuntimeException("Fail to initialize the Ivy listeners for the Artifactory Ivy plugin, due to: " + e.getMessage(), e);
+ RuntimeException re = new RuntimeException(
+ "Fail to initialize the Ivy listeners for the Artifactory Ivy plugin, due to: " + e.getMessage(),
+ e);
re.printStackTrace();
throw re;
}
@@ -94,7 +112,8 @@ public void taskStarted(BuildEvent event) {
}
super.taskStarted(event);
} catch (Exception e) {
- RuntimeException re = new RuntimeException("Fail to add the Ivy listeners for the Artifactory Ivy plugin, due to: " + e.getMessage(), e);
+ RuntimeException re = new RuntimeException(
+ "Fail to add the Ivy listeners for the Artifactory Ivy plugin, due to: " + e.getMessage(), e);
re.printStackTrace();
throw re;
}
@@ -116,7 +135,8 @@ public void buildFinished(BuildEvent event) {
try {
doDeploy(event);
} catch (Exception e) {
- RuntimeException re = new RuntimeException("Fail to activate deployment using the Artifactory Ivy plugin, due to: " + e.getMessage(), e);
+ RuntimeException re = new RuntimeException(
+ "Fail to activate deployment using the Artifactory Ivy plugin, due to: " + e.getMessage(), e);
re.printStackTrace();
throw re;
}
@@ -201,13 +221,15 @@ private void doDeploy(BuildEvent event) {
}
builder.buildRetention(buildRetention);
- String issueTrackerName = clientConf.info.getIssueTrackerName();
+ String issueTrackerName = clientConf.info.issues.getIssueTrackerName();
if (StringUtils.isNotBlank(issueTrackerName)) {
Issues issues = new Issues();
- issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.getIssueTrackerVersion()));
- List<Issue> affectedIssuesList = clientConf.info.getAffectedIssuesList();
- if (!affectedIssuesList.isEmpty()) {
- issues.setAffectedIssues(affectedIssuesList);
+ issues.setAggregateBuildIssues(clientConf.info.issues.getAggregateBuildIssues());
+ issues.setAggregationBuildStatus(clientConf.info.issues.getAggregationBuildStatus());
+ issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.issues.getIssueTrackerVersion()));
+ Set<Issue> affectedIssuesSet = clientConf.info.issues.getAffectedIssuesSet();
+ if (!affectedIssuesSet.isEmpty()) {
+ issues.setAffectedIssues(affectedIssuesSet);
}
builder.issues(issues);
}
@@ -238,7 +260,7 @@ private void doDeploy(BuildEvent event) {
}
private void deployArtifacts(Project project, ArtifactoryBuildInfoClient client, Set<DeployDetails> deployDetails,
- IncludeExcludePatterns patterns) throws IOException {
+ IncludeExcludePatterns patterns) throws IOException {
for (DeployDetails deployDetail : deployDetails) {
String artifactPath = deployDetail.getArtifactPath();
if (PatternMatcher.pathConflicts(artifactPath, patterns)) {
View
14 ...-maven3/src/main/java/org/jfrog/build/extractor/maven/BuildInfoModelPropertyResolver.java
@@ -26,9 +26,9 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import static org.jfrog.build.api.BuildInfoFields.*;
@@ -102,13 +102,15 @@ public BuildInfoBuilder resolveProperties(ExecutionEvent event, ArtifactoryClien
builder.buildRetention(buildRetention);
builder.artifactoryPrincipal(clientConf.publisher.getName());
- String issueTrackerName = clientConf.info.getIssueTrackerName();
+ String issueTrackerName = clientConf.info.issues.getIssueTrackerName();
if (StringUtils.isNotBlank(issueTrackerName)) {
Issues issues = new Issues();
- issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.getIssueTrackerVersion()));
- List<Issue> affectedIssuesList = clientConf.info.getAffectedIssuesList();
- if (!affectedIssuesList.isEmpty()) {
- issues.setAffectedIssues(affectedIssuesList);
+ issues.setAggregateBuildIssues(clientConf.info.issues.getAggregateBuildIssues());
+ issues.setAggregationBuildStatus(clientConf.info.issues.getAggregationBuildStatus());
+ issues.setTracker(new IssueTracker(issueTrackerName, clientConf.info.issues.getIssueTrackerVersion()));
+ Set<Issue> affectedIssuesSet = clientConf.info.issues.getAffectedIssuesSet();
+ if (!affectedIssuesSet.isEmpty()) {
+ issues.setAffectedIssues(affectedIssuesSet);
}
builder.issues(issues);
}
Please sign in to comment.
Something went wrong with that request. Please try again.