Build Conditions v1 is Available
We’re excited to announce the official release of Conditions v1, which provides fine-grained control over how and when your builds happen. Conditions is a mini boolean language that you can use to filter builds, stages, and jobs, and it’s especially helpful for complex setups with matrices.
Conditions was available as an early release feature, and with community feedback and collaboration, we’ve rewritten the language parser. We’ve added new features and made existing ones more consistent and predictable. Thank you to everyone for your input and suggestions!
Getting Started
You can opt-in to Conditions v1 by adding the following line to your .travis.yml
:
conditions: v1
We encourage everyone – especially folks already using Conditions v0 – to try out the new version!
Conditions will also be coming soon to Travis CI Enterprise. Let our enterprise team know if you’re interested in getting a heads-up when you can upgrade your installation to bring in Conditions.
On July 17th, Conditions v1 will become the default version, and we will update you when this happens. If you’d rather keep using the previous version, you can specify it with conditions: v0
. We’ll keep v0 around for at least 6 months in case you want to roll-back and we’ll post an update before deprecating anything completely.
New in v1
In this version, we’ve significantly expanded Conditions to support a much wider variety of expressions, especially for comparisons, function calls, and statements enclosed by parens. We’ve also built out more keywords, operators, and symbols so Conditions will feel more like the programming languages you know:
- Additional Configuration & Commit Attributes - Our changes for v1 have added more support for identifying cases based on the contents of your
.travis.yml
. Check the docs for a full list. true
andfalse
are typed and keywords forIS
- the valuestrue
andfalse
now function as boolean types in logical expressions. These types also are now predicates that can be used withIS
, e.g.fork IS true
- New Aliases for Operators - Commonly-used symbols are now available as a way to reference specific operators, such as
&&
forAND
. - Line-Continuation - You can now continue a line onto the following using a backslash, similar to Python, Ruby, or Bash.
- Errors for Variables/Strings Starting with
$
- Bash code is not evaluated as many users expect, so variables and unquotes strings will now raise a parsing error and the build will be rejected. If you definitely need to start a string with a dollar character, you can quote the string. Quoted strings still can still start with a dollar character.
Since the new parser is significantly more powerful, depending on the situation, it might accept cases that previously were rejected. There is a limited possibility that the logic of your build will evaluate differently, which might change how your jobs are filtered.
Of course, please have a look at the docs for all of the details. The docs include a detailed list of attributes, aliases, and especially, examples about how different expressions are parsed.
Let us know what you think!
The code for Conditions is available over at travis-ci/travis-conditions, and we welcome your pull requests and conversation! You can also find technical specs of Conditions v1 in our docs.
If you have questions or other feedback, we’d love to hear it! Give us a shout at support@travis-ci.com. Thank you to everyone for sharing your feedback so far - we’re looking forward to updating everyone soon with more news!