Skip to content

Commit

Permalink
Merge pull request #83 from tzachs/JENKINS-41635
Browse files Browse the repository at this point in the history
JENKINS-41635 - fixed. BITBUCKET_PAYLOAD environment variable is now available in pipelines also
  • Loading branch information
tzachs authored Feb 26, 2022
2 parents abefaee + e1fb614 commit 7bba779
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ triggers{
```

**Changelog**
#### TBD #### (26. Feb 2022)
- JENKINS-41635 - fixed. This required a change in Jenkins minimum version from 2.204.1 to 2.303.1

#### 215.vfe32d14d1f47 #### (04. Feb 2022)
- Fixed NPE

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<!-- <spotbugs.skip>true</spotbugs.skip>-->
<jenkins.version>2.204.1</jenkins.version>
<jenkins.version>2.303.1</jenkins.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.level>8</java.level>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.cloudbees.jenkins.plugins;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.model.AbstractBuild;
import hudson.model.EnvironmentContributingAction;
import hudson.model.InvisibleAction;
import hudson.model.Run;

import javax.annotation.Nonnull;
import java.util.logging.Level;
Expand All @@ -27,10 +28,11 @@ public String getPayload() {
}

@Override
public void buildEnvVars(AbstractBuild<?, ?> abstractBuild, EnvVars envVars) {
public void buildEnvironment(@NonNull Run<?, ?> run, @NonNull EnvVars env) {
EnvironmentContributingAction.super.buildEnvironment(run, env);
final String payload = getPayload();
LOGGER.log(Level.FINEST, "Injecting BITBUCKET_PAYLOAD: {0}", payload);
envVars.put("BITBUCKET_PAYLOAD", payload);
env.put("BITBUCKET_PAYLOAD", payload);
}

private static final Logger LOGGER = Logger.getLogger(BitBucketPayload.class.getName());
Expand Down

0 comments on commit 7bba779

Please sign in to comment.