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

Remove unsupported jf build step from freestyle projects #102

Closed
wants to merge 6 commits into from
Closed
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
6 changes: 5 additions & 1 deletion src/main/java/io/jenkins/plugins/jfrog/JfStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.jenkinsci.Symbol;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
import org.jenkinsci.plugins.workflow.job.WorkflowJobProperty;
import org.jfrog.build.api.util.Log;
import org.kohsuke.stapler.DataBoundConstructor;

Expand Down Expand Up @@ -291,7 +292,10 @@ public String getDisplayName() {

@Override
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
return true;
// JfStep Extends SimpleBuildStep, which applies also to FreeStyleProjects, as well as workflow jobs.
// To avoid errors due to unsupported inputs in non-Pipelines job types.
// Return applicable only for WorkflowJobProperty.
return WorkflowJobProperty.class.isAssignableFrom(jobType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be this?

return WorkflowJob.class.isAssignableFrom(jobType) || WorkflowJob.class.isAssignableFrom(jobType);

I haven't tested the solution.
Please also verify with Multibranch Pipelines.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange, but when i debug i'm getting an error thrown, also on the main branch when it comes to multi-branch.
On the other hand, when i installed the plugin on my local Jenkins, it doesn't crash.
Maybe it's related to the Jenkins version.
It needs to be tested.

}
}
}
Loading