Skip to content

JENKINS-30077 - Expand build parameters#31

Open
Brantone wants to merge 1 commit into
jenkinsci:masterfrom
Brantone:master
Open

JENKINS-30077 - Expand build parameters#31
Brantone wants to merge 1 commit into
jenkinsci:masterfrom
Brantone:master

Conversation

@Brantone
Copy link
Copy Markdown

Initial attempt at https://issues.jenkins-ci.org/browse/JENKINS-30077
Had several options where to do vars.expand, open to discussion if this is not optimal location.

try {
EnvVars vars = build.getEnvironment(listener);

for (int i = 0; i < patterns.size(); i++) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

patterns can be null here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Doh! Good point.

patterns.set(i, new Pattern(vars.expand(patterns.get(i).getPattern()), patterns.get(i).getType()));
}
externalDelete = vars.expand(externalDelete);
} catch (Exception e) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What failures do we expect here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That was to satisfy an error that was thrown when using EnvVars vars = build.getEnvironment(listener); that complained there wasn't an exception catch.

EnvVars vars = build.getEnvironment(listener);

for (int i = 0; i < patterns.size(); i++) {
patterns.set(i, new Pattern(vars.expand(patterns.get(i).getPattern()), patterns.get(i).getType()));
Copy link
Copy Markdown
Member

@olivergondza olivergondza Sep 15, 2016

Choose a reason for hiding this comment

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

NIT: Using VariableResolver will save some object instantiations here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thx, will take a look.

@Brantone
Copy link
Copy Markdown
Author

Yup, that's what I figured, I just wanted to verify this was the correct location for such changes ... as it can be done at this point, or in one of the perform() functions.

@olivergondza
Copy link
Copy Markdown
Member

Given the exceptions we have to handle, this would better be done in the perform kind of methods.

@lemonkey
Copy link
Copy Markdown

lemonkey commented May 2, 2017

Surprising build parameters aren't supported.

@pjanouse
Copy link
Copy Markdown
Contributor

pjanouse commented Oct 8, 2018

Guys, is there still an interest to finish this?

@Brantone
Copy link
Copy Markdown
Author

Brantone commented Oct 8, 2018

@pjanouse Unfortunately not long after my last update I got yanked off the applicable project ... can't believe its over 2 yrs already. Feel free to take this PR, make appropriate changes and re-submit.

@glensteroni
Copy link
Copy Markdown

I have just run into this problem. I have many files generated at each build and want to keep only the most recent. Therefore I need to use a parameter. Can this fix be finished and published?

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.

5 participants