Skip to content
Permalink
Browse files

JENKINS-41677 Expose display URLs in environment variables

  • Loading branch information...
i386 committed Feb 2, 2017
1 parent 3b5e95f commit 8d7efadfff4c5a652bcbebb2869e463fc93820c4
Showing with 28 additions and 0 deletions.
  1. +28 −0 src/main/java/org/jenkinsci/plugins/displayurlapi/EnvironmentContributorImpl.java
@@ -0,0 +1,28 @@
package org.jenkinsci.plugins.displayurlapi;

import hudson.EnvVars;
import hudson.Extension;
import hudson.model.EnvironmentContributor;
import hudson.model.Job;
import hudson.model.Run;
import hudson.model.TaskListener;

import javax.annotation.Nonnull;
import java.io.IOException;

@Extension
public class EnvironmentContributorImpl extends EnvironmentContributor {
@Override
public void buildEnvironmentFor(@Nonnull Run r, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException {
super.buildEnvironmentFor(r, envs, listener);
envs.put("RUN_DISPLAY_URL", DisplayURLProvider.get().getRunURL(r));
envs.put("RUN_CHANGES_DISPLAY_URL", DisplayURLProvider.get().getChangesURL(r));

}

@Override
public void buildEnvironmentFor(@Nonnull Job j, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException {
super.buildEnvironmentFor(j, envs, listener);
envs.put("JOB_DISPLAY_URL", DisplayURLProvider.get().getJobURL(j));
}
}

0 comments on commit 8d7efad

Please sign in to comment.
You can’t perform that action at this time.