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

Comment file feature doesn't seem to work with pipelines #708

Open
jrudolph opened this issue Sep 12, 2018 · 4 comments
Open

Comment file feature doesn't seem to work with pipelines #708

jrudolph opened this issue Sep 12, 2018 · 4 comments

Comments

@jrudolph
Copy link
Contributor

jrudolph commented Sep 12, 2018

As reported by @ntindall in #512 (comment) and also be someone else to me privately, it seems the comment file feature doesn't work with pipeline builds.

Could it be that pipeline builds are not an instance of hudson.model.Build so figuring out the workspace doesn't work in that case?

if (build instanceof Build<?, ?>) {
final FilePath workspace = ((Build<?, ?>) build).getWorkspace();
final FilePath path = workspace.child(scriptFilePathResolved);
if (path.exists()) {
content = path.readToString();
} else {
listener.getLogger().println(
"Didn't find comment file in workspace at " + path.absolutize().getRemote()
+ ", falling back to file operations on master."
);
}
}

@jrudolph
Copy link
Contributor Author

See the documentation about how to make plugins compatible with pipelines/workflow. See also this stackoverflow answer about how to get workspaces from a WorkflowRun.

@Kentalot
Copy link

Looks like there's already a pull request for this #682

@jrudolph
Copy link
Contributor Author

Cool, even better, thanks for pointing to it @Kentalot.

@redwyre
Copy link

redwyre commented Jul 26, 2019

This would be really nice, currently using a hardcoded path to the jenkins workspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants