Skip to content

Commit

Permalink
Add support for vcs branch and vcs message
Browse files Browse the repository at this point in the history
  • Loading branch information
talarian1 committed Dec 28, 2021
1 parent 5488b7b commit e269965
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,15 @@ public BuildInfo extract(Project rootProject) {
bib.url(buildUrl);
}
String vcsRevision = clientConf.info.getVcsRevision();
Vcs vcs = new Vcs();
if (StringUtils.isNotBlank(vcsRevision)) {
vcs.setRevision(vcsRevision);
bib.vcsRevision(vcsRevision);
}

String vcsUrl = clientConf.info.getVcsUrl();
if (StringUtils.isNotBlank(vcsUrl)) {
vcs.setUrl(vcsUrl);
bib.vcsUrl(vcsUrl);
}
Vcs vcs = new Vcs(vcsUrl, vcsRevision, clientConf.info.getVcsBranch(), clientConf.info.getVcsMessage());
if (!vcs.isEmpty()) {
bib.vcs(Arrays.asList(vcs));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,15 @@ private void doDeploy(BuildEvent event) {
if (StringUtils.isNotBlank(buildUrl)) {
builder.url(buildUrl);
}
Vcs vcs = new Vcs();
String vcsRevision = clientConf.info.getVcsRevision();
if (StringUtils.isNotBlank(vcsRevision)) {
vcs.setRevision(vcsRevision);
builder.vcsRevision(vcsRevision);
}
String vcsUrl = clientConf.info.getVcsUrl();
if (StringUtils.isNotBlank(vcsUrl)) {
vcs.setUrl(vcsUrl);
builder.vcsUrl(vcsUrl);
}
Vcs vcs = new Vcs(vcsUrl, vcsRevision, clientConf.info.getVcsBranch(), clientConf.info.getVcsMessage());
if (!vcs.isEmpty()) {
builder.vcs(Arrays.asList(vcs));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,23 @@ public BuildInfoMavenBuilder resolveProperties(ExecutionEvent event, Artifactory
BuildInfoMavenBuilder builder = resolveCoreProperties(event, clientConf).
artifactoryPrincipal(clientConf.publisher.getName()).artifactoryPluginVersion(clientConf.info.getArtifactoryPluginVersion()).
principal(clientConf.info.getPrincipal()).parentName(
clientConf.info.getParentBuildName()).
clientConf.info.getParentBuildName()).
parentNumber(clientConf.info.getParentBuildNumber());

String buildUrl = clientConf.info.getBuildUrl();
if (StringUtils.isNotBlank(buildUrl)) {
builder.url(buildUrl);
}

Vcs vcs = new Vcs();
String vcsRevision = clientConf.info.getVcsRevision();
if (StringUtils.isNotBlank(vcsRevision)) {
vcs.setRevision(vcsRevision);
builder.vcsRevision(vcsRevision);
}
String vcsUrl = clientConf.info.getVcsUrl();
if (StringUtils.isNotBlank(vcsUrl)) {
vcs.setUrl(vcsUrl);
builder.vcsUrl(vcsUrl);
}
Vcs vcs = new Vcs(vcsUrl, vcsRevision, clientConf.info.getVcsBranch(), clientConf.info.getVcsMessage());
if (!vcs.isEmpty()) {
builder.vcs(Arrays.asList(vcs));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public interface BuildInfoFields {
String BUILD_PARENT_NUMBER = "build.parentNumber";
String VCS_REVISION = "vcs.revision";
String VCS_URL = "vcs.url";
String VCS_BRANCH = "vcs.branch";
String VCS_MESSAGE = "vcs.message";
String PRINCIPAL = "principal";
String BUILD_URL = "buildUrl";
String BUILD_AGENT_NAME = "buildAgent.name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,7 @@
import static org.jfrog.build.extractor.ci.BuildInfoConfigProperties.EXPORT_FILE;
import static org.jfrog.build.extractor.ci.BuildInfoConfigProperties.INCLUDE_ENV_VARS;
import static org.jfrog.build.extractor.ci.BuildInfoConfigProperties.PROPERTIES_FILE;
import static org.jfrog.build.extractor.ci.BuildInfoFields.AGENT_NAME;
import static org.jfrog.build.extractor.ci.BuildInfoFields.AGENT_VERSION;
import static org.jfrog.build.extractor.ci.BuildInfoFields.ARTIFACTORY_PLUGIN_VERSION;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BACKWARD_COMPATIBLE_DEPLOYABLE_ARTIFACTS;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_AGENT_NAME;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_AGENT_VERSION;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_NAME;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_NUMBER;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_NUMBERS_NOT_TO_DELETE;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_PARENT_NAME;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_PARENT_NUMBER;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_PROJECT;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_RETENTION_ASYNC;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_RETENTION_COUNT;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_RETENTION_DAYS;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_RETENTION_MINIMUM_DATE;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_ROOT;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_STARTED;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_TIMESTAMP;
import static org.jfrog.build.extractor.ci.BuildInfoFields.BUILD_URL;
import static org.jfrog.build.extractor.ci.BuildInfoFields.DELETE_BUILD_ARTIFACTS;
import static org.jfrog.build.extractor.ci.BuildInfoFields.DEPLOYABLE_ARTIFACTS;
import static org.jfrog.build.extractor.ci.BuildInfoFields.ENVIRONMENT_PREFIX;
import static org.jfrog.build.extractor.ci.BuildInfoFields.GENERATED_BUILD_INFO;
import static org.jfrog.build.extractor.ci.BuildInfoFields.INCREMENTAL;
import static org.jfrog.build.extractor.ci.BuildInfoFields.MIN_CHECKSUM_DEPLOY_SIZE_KB;
import static org.jfrog.build.extractor.ci.BuildInfoFields.PRINCIPAL;
import static org.jfrog.build.extractor.ci.BuildInfoFields.RELEASE_COMMENT;
import static org.jfrog.build.extractor.ci.BuildInfoFields.RELEASE_ENABLED;
import static org.jfrog.build.extractor.ci.BuildInfoFields.RUN_PARAMETERS;
import static org.jfrog.build.extractor.ci.BuildInfoFields.VCS_REVISION;
import static org.jfrog.build.extractor.ci.BuildInfoFields.VCS_URL;
import static org.jfrog.build.extractor.ci.BuildInfoFields.*;
import static org.jfrog.build.extractor.ci.BuildInfoProperties.BUILD_INFO_ISSUES_TRACKER_PREFIX;
import static org.jfrog.build.extractor.ci.BuildInfoProperties.BUILD_INFO_PREFIX;
import static org.jfrog.build.extractor.ci.IssuesTrackerFields.AFFECTED_ISSUES;
Expand Down Expand Up @@ -1096,6 +1065,22 @@ public void setVcsUrl(String vcsUrl) {
setStringValue(VCS_URL, vcsUrl);
}

public String getVcsBranch() {
return getStringValue(VCS_BRANCH);
}

public void setVcsBranch(String vcsBranch) {
setStringValue(VCS_BRANCH, vcsBranch);
}

public String getVcsMessage() {
return getStringValue(VCS_MESSAGE);
}

public void setVcsMessage(String vcsMessage) {
setStringValue(VCS_MESSAGE, vcsMessage);
}

public String getAgentName() {
return getStringValue(AGENT_NAME);
}
Expand Down

0 comments on commit e269965

Please sign in to comment.