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

Improved usage of MissingContextVariableException #288

Merged
merged 1 commit into from
Jan 19, 2024
Merged
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
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@
<scope>import</scope>
<type>pom</type>
</dependency>
<!-- TODO until in BOM: -->
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>655.v6e098b_87b_84f</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<classifier>tests</classifier>
<version>655.v6e098b_87b_84f</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand All @@ -70,7 +82,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>655.v6e098b_87b_84f</version> <!-- TODO: Removes once the plugin is updated in the BOM -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void doStart() throws Exception {
for (MultiBinding<?> binding : step.bindings) {
if (binding.getDescriptor().requiresWorkspace() &&
(workspace == null || launcher == null)) {
throw new MissingContextVariableException(FilePath.class);
throw new MissingContextVariableException(FilePath.class, step.getDescriptor());
}
MultiBinding.MultiEnvironment environment = binding.bind(run, workspace, launcher, listener);
unbinders.add(environment.getUnbinder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void widerRequiredContext() throws Throwable {
WorkflowRun b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0));
r.assertLogNotContains("We should fail before getting here", b);
r.assertLogContains("Required context class hudson.FilePath is missing", b);
r.assertLogContains("Perhaps you forgot to surround the step with a step that provides this, such as: node", b);
r.assertLogContains("Perhaps you forgot to surround the withCredentials step with a step that provides this, such as: node", b);
});
}

Expand Down