Java Code Examples for hudson.model.AbstractBuild#getUrl()
The following examples show how to use
hudson.model.AbstractBuild#getUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuildBeginInfo.java From qy-wechat-notification-plugin with Apache License 2.0 | 5 votes |
public BuildBeginInfo(String projectName, AbstractBuild<?, ?> build, NotificationConfig config){ //获取请求参数 List<ParametersAction> parameterList = build.getActions(ParametersAction.class); if(parameterList!=null && parameterList.size()>0){ for(ParametersAction p : parameterList){ for(ParameterValue pv : p.getParameters()){ this.params.put(pv.getName(), pv.getValue()); } } } //预计时间 if(build.getProject().getEstimatedDuration()>0){ this.durationTime = build.getProject().getEstimatedDuration(); } //控制台地址 StringBuilder urlBuilder = new StringBuilder(); String jenkinsUrl = NotificationUtil.getJenkinsUrl(); if(StringUtils.isNotEmpty(jenkinsUrl)){ String buildUrl = build.getUrl(); urlBuilder.append(jenkinsUrl); if(!jenkinsUrl.endsWith("/")){ urlBuilder.append("/"); } urlBuilder.append(buildUrl); if(!buildUrl.endsWith("/")){ urlBuilder.append("/"); } urlBuilder.append("console"); } this.consoleUrl = urlBuilder.toString(); //工程名称 this.projectName = projectName; //环境名称 if(config.topicName!=null){ topicName = config.topicName; } }
Example 2
Source File: PhabricatorBuildWrapper.java From phabricator-jenkins-plugin with MIT License | 5 votes |
/** * Abort running builds when new build referencing same revision is scheduled to run */ @Override public void preCheckout(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException { String abortOnRevisionId = getAbortOnRevisionId(build); // If ABORT_ON_REVISION_ID is available if (!CommonUtils.isBlank(abortOnRevisionId)) { // Create a cause of interruption PhabricatorCauseOfInterruption causeOfInterruption = new PhabricatorCauseOfInterruption(build.getUrl()); Run upstreamRun = getUpstreamRun(build); // Get the running builds that were scheduled before the current one RunList<AbstractBuild> runningBuilds = (RunList<AbstractBuild>) build.getProject().getBuilds(); for (AbstractBuild runningBuild : runningBuilds) { Executor executor = runningBuild.getExecutor(); Run runningBuildUpstreamRun = getUpstreamRun(runningBuild); // Ignore builds that were triggered by the same upstream build // Find builds triggered with the same ABORT_ON_REVISION_ID_FIELD if (runningBuild.isBuilding() && runningBuild.number < build.number && abortOnRevisionId.equals(getAbortOnRevisionId(runningBuild)) && (upstreamRun == null || runningBuildUpstreamRun == null || !upstreamRun.equals(runningBuildUpstreamRun)) && executor != null) { // Abort the builds executor.interrupt(Result.ABORTED, causeOfInterruption); } } } }
Example 3
Source File: TestUtility.java From gitlab-plugin with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("ConstantConditions") static String formatNote(AbstractBuild build, String note) { String buildUrl = Jenkins.getInstance().getRootUrl() + build.getUrl(); return MessageFormat.format(note, build.getResult(), build.getParent().getDisplayName(), BUILD_NUMBER, buildUrl); }