-
Notifications
You must be signed in to change notification settings - Fork 248
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
[FIXED JENKINS-42498] Stop evaluating when conditions at runtime #132
Conversation
@@ -46,6 +46,8 @@ import static org.jenkinsci.plugins.pipeline.modeldefinition.Utils.createStepsBl | |||
* @author Andrew Bayer | |||
*/ | |||
public class ClosureModelTranslator implements MethodMissingWrapper, Serializable { | |||
private static final List<Class> UNTRANSLATED_CLASSES = [StageConditionals.class] |
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.
Making this a List
to check against since we're doing this again for Environment
over in #110, and I imagine there'll be more in the future as I gradually kill off the translators.
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
185b2b2
to
e427236
Compare
Tried to load the effective diff but it is showing commits from #125, which it should not have been; any idea? |
Maybe just get upstream reviewed & merged, then |
13369aa
to
ac01472
Compare
@jglick effective diff fixed now, but yeah, I want to get #125 merged. I would appreciate your thoughts in the meantime, though. |
I am not sure I really understand what it is I am looking at, but it seems that for something like environment {
TAG = "$JOB_NAME.$BUILD_NUMBER"
} previously you would have been passing around a In an actual programming language this would be a huge red flag—you are throwing away proper handling of lexical scope, and generally setting the clock back to 1961. But in Declarative I guess it is fine because by the restrictive syntactic rules imposed by the verifier you would not be able to use anything bound into a closure anyway. |
ac01472
to
4752fb7
Compare
Pull the when conditions in by translating them from the AST model, which does require some evaluation of strings here and there, but avoids having any Closures in the Describables.
4752fb7
to
9fc7c0b
Compare
@jglick Yeah, it's not my first choice, but in this particular case, either we're storing a |
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.
Do not really understand the details, but sounds right in a general way.
* | ||
* @param s The original string | ||
* @return Either the original string, if it already starts/ends with double quotes, or the original string | ||
* prepended/appended with double quotes. |
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.
Uh, does this not need to do some kind of escaping?
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.
Hrm. Honestly not sure. Lemme think on it.
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.
So actually, I don't think it does. We're just taking the string from the original Jenkinsfile source, in effect.
Closure
s in theDescribable
s. Note that this is on top of [FIXED JENKINS-41185] Add support for and/not/or of when conditions #125 - relevant commits start at 76a4350. If this PR looks more appropriate than [FIXED JENKINS-42498] Dehydrate GStrings in the runtime model #131, I'll close [FIXED JENKINS-42498] Dehydrate GStrings in the runtime model #131.