Travis CI matrix include variable precedence over env matrix
0 reputation · 13 Aug 2022, 03:05 UTC
When a Travis CI build matrix defines the same environment variable in both the env matrix and a matrix.include entry, the documentation does not specify which value takes precedence. The current implementation appears to favor the env matrix value, but this behavior is not guaranteed and may vary between Travis CI public and Enterprise deployments. Additionally, the order of keys in .travis.yml is not preserved in a way that can be relied upon for resolution order.
The lack of a documented precedence rule makes it difficult to write predictable matrix configurations that intentionally override variables for specific jobs. Teams that depend on consistent variable resolution across builds need clarity on whether matrix.include entries are meant to extend the matrix with new combinations or to override existing env matrix values for targeted jobs.
- Does Travis CI guarantee that
envmatrix values always win overmatrix.includevalues for the same variable name? - Can the resolution order be controlled by the sequence of keys in
.travis.yml, or is it an implementation detail subject to change? - Is there a supported pattern for overriding an
envmatrix variable for a single included job without duplicating the entire matrix?