Travis CI conditions not consistent with travis-conditions tool

travis-gatekeeper

#1

This concat stage condition evaluates to true using the travis-conditions tool:

$ echo '{"repo": "plus3it/pyppyn", "env": ["OWNER=plus3it", \
"THIS_REPO=pyppyn"]}' \
| travis-conditions eval "repo = concat(env(OWNER),/,env(THIS_REPO))"
true

But the same thing in .travis.yml evaluates to false.

if: repo = concat(env(OWNER),/,env(THIS_REPO))

(See this build, where no deploy stage is shown. We’ve narrowed down this issue to that part of the condition: https://travis-ci.org/plus3it/pyppyn/builds/486966874)

Any thoughts?


#2

Sorry, but how does this build show the problem? It is a PR build, so neither


nor

evaluates to true.


#3

A subsequent master branch build include these jobs, so I think this is not an issue.


#4

Sorry, wrong link above. I fixed it there.

We had to remove repo = concat(env(OWNER),/,env(THIS_REPO)) to get jobs to run. Here’s merge master with no deploy jobs: https://travis-ci.org/plus3it/pyppyn/builds/486966874


#5

Ah, OK.

I don’t think we interpret THIS_REPO, which is defined in

So the env(THIS_REPO) will return what you think it does.


#6

We had to change it to THIS_REPO. The repo and REPO seemed to be interfering with each other: repo = concat(env(OWNER),/,env(REPO)). But, that still doesn’t work…


#7

I don’t understand what you are saying. What did you test, and what happened?


#8

Sorry, doing too much at once.

The travis-conditions tool shows that this does not work correctly because repo and REPO conflict:

$ echo '{"repo": "plus3it/pyppyn", "env": ["OWNER=plus3it", "REPO=pyppyn"]}' | travis-conditions eval "repo = concat(env(OWNER),/,env(REPO))"
false
$ echo '{"repo": "plus3it/pyppyn", "env": ["OWNER=plus3it", "THIS_REPO=pyppyn"]}' | travis-conditions eval "repo = concat(env(OWNER),/,env(THIS_REPO))"
true

So, I thought that changing the env name to THIS_REPO would fix it in .travis.yml but it did not.

In .travis.yml for merge to master, this evaluates as true:

if: branch = env(RELEASE_BRANCH) AND type != pull_request

But this evaluates as false, even though the travis-conditions tool says it should work:

if: branch = env(RELEASE_BRANCH) AND type != pull_request AND repo = concat(env(OWNER),/,env(THIS_REPO))

#9

Thanks for the info.

$ echo '{"repo": "plus3it/pyppyn", "env": ["OWNER=plus3it", "REPO=pyppyn"]}' | travis-conditions eval "repo = concat(env(OWNER),/,env(REPO))"
false
$ echo '{"repo": "plus3it/pyppyn", "env": ["OWNER=plus3it", "THIS_REPO=pyppyn"]}' | travis-conditions eval "repo = concat(env(OWNER),/,env(THIS_REPO))"
true

seems like a bug to me, but

if: branch = env(RELEASE_BRANCH) AND type != pull_request AND repo = concat(env(OWNER),/,env(THIS_REPO))

not evaluating to true inside your actual use case does not , because of the way THIS_REPO is defined (i.e., via interpretation that is only reliably possible at the build execution time (after we have had to decide whether or not this job should be included or not).


#10

OH. That makes sense. Travis CI cannot see into the future??? :crystal_ball: