Skip to content

Commit 7c1c340

Browse files
committed
[JENKINS-53535] Make Bitbucket Server, Owner and repository environment variables for Bitbucket Team/Project based jobs
Fix missing git extension BitbucketEnvVarExtension in method BitbucketSCMSource.build, lost in resolution of merge conflicts after the cherry-pick of the feature from 933.x branch.
1 parent d3bc076 commit 7c1c340

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketEndpointConfiguration;
4444
import com.cloudbees.jenkins.plugins.bitbucket.endpoints.BitbucketServerEndpoint;
4545
import com.cloudbees.jenkins.plugins.bitbucket.hooks.HasPullRequests;
46+
import com.cloudbees.jenkins.plugins.bitbucket.impl.extension.BitbucketEnvVarExtension;
4647
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils;
4748
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketApiUtils.BitbucketSupplier;
4849
import com.cloudbees.jenkins.plugins.bitbucket.impl.util.BitbucketCredentials;
@@ -1011,6 +1012,7 @@ public SCM build(@NonNull SCMHead head, @CheckForNull SCMRevision revision) {
10111012
BitbucketAuthenticator authenticator = authenticator();
10121013
return new BitbucketGitSCMBuilder(this, head, revision, credentialsId)
10131014
.withExtension(new GitClientAuthenticatorExtension(authenticator == null || sshAuth ? null : authenticator.getCredentialsForSCM()))
1015+
.withExtension(new BitbucketEnvVarExtension(getRepoOwner(), getRepository(), getProjectKey(), getServerUrl()))
10141016
.withCloneLinks(primaryCloneLinks, mirrorCloneLinks)
10151017
.withTraits(traits)
10161018
.build();

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/impl/extension/BitbucketEnvVarExtension.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import hudson.plugins.git.GitSCM;
77
import hudson.plugins.git.extensions.GitSCMExtension;
88
import java.util.Map;
9+
import org.kohsuke.stapler.DataBoundConstructor;
910

1011
public class BitbucketEnvVarExtension extends GitSCMExtension {
1112

@@ -14,6 +15,7 @@ public class BitbucketEnvVarExtension extends GitSCMExtension {
1415
private final String projectKey;
1516
private final String serverURL;
1617

18+
@DataBoundConstructor
1719
public BitbucketEnvVarExtension(@Nullable String owner, @NonNull String repository, @Nullable String projectKey, @NonNull String serverURL) {
1820
this.owner = owner;
1921
this.repository = repository;

0 commit comments

Comments
 (0)