public WebHooksBranchImpl(Branch branch) { this.displayName = branch.getDisplayName(); this.name = branch.getName(); this.isDefaultBranch = branch.isDefaultBranch(); }
private String getBranch(SBuild build) { Branch branch = build.getBranch(); if (branch != null && branch.getName() != "<default>") { return branch.getDisplayName(); } else { return ""; } }
private void deployArtifact(BuildArtifact buildArtifact, SRunningBuild build, String baseContext, TomcatManager tomcatManager, TomcatStagingDeploy stagingDeploy) throws TomcatManagerException, IOException { assert build.getBranch() != null; File artifact = new File(build.getArtifactsDirectory(), buildArtifact.getRelativePath()); String path = baseContext + "/" + build.getBranch().getName(); String tomcatBasePath = UrlUtils.extractBaseUrl(tomcatManager.getURL()); stagingDeploy.setWebPath(tomcatBasePath + path); TomcatManagerResponse response = tomcatManager.deploy(path, artifact, true, path, artifact.length()); if (HttpStatus.SC_OK != response.getStatusCode()) { throw new TomcatManagerException(response.getReasonPhrase()); } }
if (sRunningBuild.getBranch() != null) { setBranch(sRunningBuild.getBranch()); setBranchDisplayName(getBranch().getDisplayName()); setBranchIsDefault(getBranch().isDefaultBranch()); } else { Loggers.SERVER.debug("SlackNotificationPayloadContent :: Branch is null. Either feature branch support is not configured or Teamcity does not support feature branches on this VCS");
private String getBranch(SBuild build) { Branch branch = build.getBranch(); if (branch != null && branch.getName() != "<default>") { return branch.getDisplayName(); } else { return ""; } }
public void handle(SRunningBuild build, SBuildFeatureDescriptor feature, BuildStatus buildStatus) throws IOException { LOGGER.log(Level.INFO, "Handling build status - Build Status: {0}, Branch: {1}, isSuccessful: {2}", new Object[]{buildStatus, build.getBranch() == null ? null : build.getBranch().getName(), build.getBuildStatus().isSuccessful()}); Branch branch = build.getBranch(); if (branch != null) { VcsPropertiesHelper vcsPropertiesHelper = new VcsPropertiesHelper(feature.getParameters(), vcsConstants); VcsApi vcsApi = vcsApiFactories.create(vcsPropertiesHelper); CommitStatus commitStatus = getCommitStatus(build.getBuildStatus(), buildStatus); updateStatus(build, vcsApi, commitStatus); } }
if (sRunningBuild.getBranch() != null){ setBranch(sRunningBuild.getBranch()); setBranchName(getBranch().getName()); setBranchDisplayName(getBranch().getDisplayName()); setBranchIsDefault(getBranch().isDefaultBranch()); } else { Loggers.SERVER.debug("WebHookPayloadContent :: Branch is null. Either feature branch support is not configured or Teamcity does not support feature branches on this VCS");
public void handle(SRunningBuild build, BuildTriggerDescriptor trigger, BuildStatus buildStatus) throws IOException { LOGGER.log(Level.INFO, "Handling build status - Build Status: {0}, Branch: {1}, isSuccessful: {2}", new Object[]{buildStatus, build.getBranch().getName(), build.getBuildStatus().isSuccessful()}); Branch branch = build.getBranch(); if (branch != null) { SBuildType buildType = build.getBuildType(); PullRequestPropertiesHelper pullRequestPropertiesHelper = new PullRequestPropertiesHelper(trigger.getProperties(), vcsConstants, constants); VcsApi vcsApi = vcsApiFactories.create(pullRequestPropertiesHelper); PullRequest pullRequest = vcsApi.getPullRequestForBranch(branch.getName()); JsonCustomDataStorage<PullRequestBuild> dataStorage = getJsonDataStorage(buildType, trigger); PullRequestBuild pullRequestBuild = getPullRequestBuild(pullRequestPropertiesHelper, pullRequest, dataStorage); CommitStatus commitStatus = getCommitStatus(build.getBuildStatus(), buildStatus); Comment comment = updateStatus(build, vcsApi, pullRequest, pullRequestBuild, commitStatus); if (pullRequestPropertiesHelper.getApproveOnSuccessKey()) { updateApproval(vcsApi, pullRequest, commitStatus); } pullRequestBuild = new PullRequestBuild(pullRequest, build.getBuildStatus(), comment); dataStorage.putValue(getPullRequestKey(pullRequestPropertiesHelper, pullRequest), pullRequestBuild); } }
public void handle(SRunningBuild build, BuildTriggerDescriptor trigger) throws IOException { Branch branch = build.getBranch(); if (branch != null && build.getBuildStatus().isSuccessful()) { SBuildType buildType = build.getBuildType(); VcsPropertiesHelper vcsPropertiesHelper = new VcsPropertiesHelper(trigger.getProperties(), vcsConstants); VcsApi vcsApi = vcsApiFactories.create(vcsPropertiesHelper); PullRequest pullRequest = vcsApi.getPullRequestForBranch(branch.getName()); JsonCustomDataStorage<TomcatStagingDeploy> dataStorage = getJsonDataStorage(buildType, trigger); StagingPropertiesHelper stagingPropertiesHelper = new StagingPropertiesHelper(trigger.getProperties(), constants); TomcatStagingDeploy stagingDeploy = getTomcatStagingDeploy(vcsPropertiesHelper, pullRequest, dataStorage); deploy(build, stagingPropertiesHelper, stagingDeploy); postComment(vcsApi, pullRequest, stagingDeploy); dataStorage.putValue(getPullRequestKey(vcsPropertiesHelper, pullRequest), stagingDeploy); } }