You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In travis-conditions gem module, the bash code for an environment variable is not evaluated. From the above example, travis-condition takes the entire line as a direct string value i.e; test_variable='$(if [ 1 == 1 ]; then echo true; else echo false; fi)'
These conditions resolve to true in travis-conditions,
if: env(test_variable) IS true
The behavior of env() IS true condition is that, it checks that the environment variables exists and not a false value. It satisfies for everything else.
This helps better optimize build invocations in mono repos. I am confident this change to travis-conditions will not break any existing builds for other companies because this feature does not exist yet. Please help friends.
The text was updated successfully, but these errors were encountered:
For anyone looking for a similar solution, for a mono repo I have used
create a githook locally so that the developer commits on PRs append a particular pipeline name into commit message
i.e git commit -m "test" from developer is appended with test [pipeline_names]
in travis-ci, this is then used as a regex condition for each pipeline
- name: so_so_pipeline
env: CACHE_NAME=so_so_pipeline
if: type = push OR commit_message =~ /(no_filter|master|Master)/ OR commit_message =~ so_so_pipeline
services:
- docker
script:
- docker-runner.sh options pipelines/so_so_pipeline
It could definitely be easier if Travis provides a way to write bash code to orchestrate builds before the submission. it gives complete power to the developer to how to use them smartly.
For example of an environment variable with bash code in it,
In travis-conditions gem module, the bash code for an environment variable is not evaluated. From the above example, travis-condition takes the entire line as a direct string value i.e;
test_variable='$(if [ 1 == 1 ]; then echo true; else echo false; fi)'
Proof
This commit containing travis conditions replicate this behavior
https://github.com/manoharuss/travis-boolean-conditions/runs/339047922.
These conditions resolve to true in travis-conditions,
The behavior of env() IS true condition is that, it checks that the environment variables exists and not a
false
value. It satisfies for everything else.Because travis-conditions does not evaluate the bash line and takes the env line as is.
Request
If bash code in environment variables is resolved before running travis-conditions on it, I intend to use it this way with git diff.
This helps better optimize build invocations in mono repos. I am confident this change to travis-conditions will not break any existing builds for other companies because this feature does not exist yet. Please help friends.
The text was updated successfully, but these errors were encountered: