-
Notifications
You must be signed in to change notification settings - Fork 166
[JENKINS-63719] add returnText option to writeYaml #88
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
[JENKINS-63719] add returnText option to writeYaml #88
Conversation
@rsandell Build issues are resolved, please take a look when you can. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably add a checkbox to the snippetizer form as well.
src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/conf/WriteYamlStep.java
Outdated
Show resolved
Hide resolved
@@ -139,6 +146,24 @@ private boolean isValidObjectType(Object obj) { | |||
|
|||
@Override | |||
public StepExecution start(StepContext context) throws Exception { | |||
if (this.returnText) { | |||
if (this.file != null) { | |||
throw new IllegalArgumentException("cannot provide both returnText and file to writeYaml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? Cound't you simply just check if returnText
is set at the end of the current execution and if so return the text otherwise null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean. If we ask SnakeYaml to output to a file then we don't have a string to return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could output to a ByteArrayOutputStream, but that is overkill for now :)
If I understood correctly, this was in reference to the config.jelly file. If so, done. |
ping @rsandell |
Sorry, I've been on winter vacation and a pile of other things waiting for me when I got back :) |
@rsandell Any idea when the next release is planned? |
Adds a
returnText
boolean parameter towriteYaml
so it returns the yaml as a string rather than writing it to a file.