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

Review new "when" conditions and update build scripts #27

Open
phillipjohnston opened this issue Aug 10, 2018 · 0 comments
Open

Review new "when" conditions and update build scripts #27

phillipjohnston opened this issue Aug 10, 2018 · 0 comments

Comments

@phillipjohnston
Copy link
Member

New when conditions

We’ve added a number of new when conditions, providing you more control over whether your stages get executed.

  • equals - Compares two values - strings, variables, numbers, booleans - and returns true if they’re equal. I’m honestly not sure how we missed adding this earlier! You can do "not equals" comparisons using the not { equals … } combination too.
  • changeRequest - In its simplest form, this will return true if this Pipeline is building a change request, such as a GitHub pull request. You can also do more detailed checks against the change request, allowing you to ask "is this a change request against the master branch?" and much more.
  • buildingTag - A simple condition that just checks if the Pipeline is running against a tag in SCM, rather than a branch or a specific commit reference.
  • tag - A more detailed equivalent of buildingTag, allowing you to check against the tag name itself.
    In addition, we’ve added a new option to when: beforeAgent. This allows you to specify that the when conditions should be evaluated before entering theagent for the stage, rather than the normal behavior of evaluating when conditions after entering the agent. When beforeAgent true is specified, you will not have access to the agent’s workspace, but you can avoid unnecessary SCM checkouts and waiting for a valid `agent to be available. This can speed up your Pipeline’s execution in some cases.

https://jenkins.io/blog/2018/04/09/whats-in-declarative/

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

1 participant