Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#234: Do not require a workspace to notify Bitbucket #425

Open
wants to merge 1 commit into
base: release/1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.FilePath;
import hudson.EnvVars;
import hudson.Launcher;
import hudson.ProxyConfiguration;
import hudson.model.*;
Expand Down Expand Up @@ -361,26 +362,29 @@
return disableInprogressNotification || processJenkinsEvent(build, null, listener, StashBuildState.INPROGRESS);
}

@Override
public boolean requiresWorkspace() {
return false;

Check warning on line 367 in src/main/java/org/jenkinsci/plugins/stashNotifier/StashNotifier.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 367 is not covered by tests
}

@Override
public boolean perform(
AbstractBuild<?, ?> build,
Launcher launcher,
BuildListener listener) {
return perform(build, null, listener, disableInprogressNotification);
return perform(build, listener, disableInprogressNotification);
}

@Override
public void perform(@NonNull Run<?, ?> run,
@NonNull FilePath workspace,
@NonNull Launcher launcher,
@NonNull EnvVars env,
@NonNull TaskListener listener) {
if (!perform(run, workspace, listener, false)) {
if (!perform(run, listener, false)) {

Check warning on line 382 in src/main/java/org/jenkinsci/plugins/stashNotifier/StashNotifier.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 382 is not covered by tests
run.setResult(Result.FAILURE);
}
}

private boolean perform(Run<?, ?> run,
FilePath workspace,
TaskListener listener,
boolean disableInProgress) {
StashBuildState state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ private StashNotifier buildStashNotifier(String stashBaseUrl,
private static BuildListener buildListener;
private static AbstractBuild<?, ?> build;
private static Run<?, ?> run;
private static FilePath workspace;

@BeforeClass
public static void setUp() throws Exception {
Expand All @@ -131,7 +130,6 @@ public static void setUp() throws Exception {
when(file.getPath()).thenReturn("/tmp/fake/path");
FilePath filePath = new FilePath(file);
when(project.getSomeWorkspace()).thenReturn(filePath);
workspace = project.getSomeWorkspace();
EnvVars environment = mock(EnvVars.class);
PrintStream logger = System.out;
Secret secret = mock(Secret.class);
Expand Down Expand Up @@ -295,7 +293,7 @@ private void test_perform_simplebuildstep(Result result,
Launcher launcher = test_perform(result, logger, notificationResult, hashes);

//when
sn.perform(build, workspace, launcher, buildListener);
sn.perform(build, launcher, buildListener);

//then
assertThat(build.getResult(), is(result));
Expand Down Expand Up @@ -483,7 +481,7 @@ public void test_perform_simple_build_step_empty_hash() {
doReturn(new ArrayList<String>()).when(sn).lookupCommitSha1s(eq(build), eq(null), eq(buildListener));

//when
sn.perform(build, workspace, mock(Launcher.class), buildListener);
sn.perform(build, mock(Launcher.class), buildListener);

//then
verify(sn, never()).notifyStash(
Expand Down