Skip to content

[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

Merged
merged 2 commits into from
Jan 29, 2021
Merged

[JENKINS-63719] add returnText option to writeYaml #88

merged 2 commits into from
Jan 29, 2021

Conversation

rittneje
Copy link
Contributor

Adds a returnText boolean parameter to writeYaml so it returns the yaml as a string rather than writing it to a file.

@rittneje
Copy link
Contributor Author

@rsandell Build issues are resolved, please take a look when you can.

Copy link
Member

@rsandell rsandell left a 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.

@@ -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");
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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 :)

@rittneje
Copy link
Contributor Author

You should probably add a checkbox to the snippetizer form as well.

If I understood correctly, this was in reference to the config.jelly file. If so, done.

@rittneje rittneje requested a review from rsandell October 24, 2020 04:02
@rittneje
Copy link
Contributor Author

ping @rsandell

4 similar comments
@rittneje
Copy link
Contributor Author

rittneje commented Dec 4, 2020

ping @rsandell

@rittneje
Copy link
Contributor Author

ping @rsandell

@rittneje
Copy link
Contributor Author

ping @rsandell

@rittneje
Copy link
Contributor Author

ping @rsandell

@rsandell
Copy link
Member

Sorry, I've been on winter vacation and a pile of other things waiting for me when I got back :)
Taking a look now.

@rsandell rsandell merged commit 6b07ab7 into jenkinsci:master Jan 29, 2021
@rittneje
Copy link
Contributor Author

@rsandell Any idea when the next release is planned?

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

Successfully merging this pull request may close these issues.

2 participants