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?
Sorry, but how does this build show the problem? It is a PR build, so neither
- python3 -m pip install virtualenv
- virtualenv $HOME/venv -p python3
- source $HOME/venv/bin/activate
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew/Library/Homebrew
- /usr/local/Homebrew/Library/Taps
- $HOME/.cache/pip
- stage: deploy
if: branch = env(RELEASE_BRANCH) AND type != pull_request AND repo = concat(env(OWNER),/,env(THIS_REPO))
python: 3.6
env:
- JOB="Deploy to Test PyPI"
install: skip
script:
- sed -i -E "s/^(__version__ = \")(.*)\"/\1\2.$TRAVIS_BUILD_NUMBER\"/" $TRAVIS_BUILD_DIR/$THIS_REPO/__init__.py
deploy:
- provider: pypi
server: https://test.pypi.org/legacy/
distributions: sdist bdist_wheel
nor
distributions: sdist bdist_wheel
user: plus3it
password:
secure: Ms9MADWwUuFpiHv2ee2cyEu04k7NLGgiywcGWVEFMOZdfE8BW6xD9oBMyISY7mkqO1Z5o7qyLbPuFNqhJVXnIX5IuqDiMvd0SViR9AmvErhanM68Iarwz5zT6gQt5V3QEeIdgTIyVCcR5jikUyhhE/HUsXeyD2RKk+pVk8wWbfaPXquho03ztNh1PnE7s2W2mex5oTxYA8IFMY8xBtGMdXkPusrZmaBN3GU8RUoATsI1tvyPN6ydMjXDCzCCWNlMdMn8i6FmsJo7m6G8y+E3CNBIj3qUbe2ZwNO89unuvuwRJ3Deah45dvT6MkqQgJ74l6IAzv6PtQGBrcC1xTsNohUfgTViJTday4zc26e1I0Cm9r4C1Ba6eMTioYFoKxL/F8cGLalh1o1+G9wZfbuWnVSMkFpdD8LHIR1Ssd3dINc9+ELZUTRehLzjqBEecienunNTckBhARoAMzfwWGSJG35qGF6UjnJMm1s1O+oOLarKTde2ydD9KRVosw05Kq5IlHAoVVxXJwv33K0+JTDKjgTfIIGz0H8gdsxoufSTDwRIk+PEwftlkU8e5hnwnmPFkRI8w4lHwTVt5SVxpPpwBjbUpPXA5w7YYSV6MPQFTlOJlEGDlCrCHCthwWft6pKA7iNBoLuavYrW7FvTKXlrFxidFJWQ0EpGx1abZpNUCfo=
skip_cleanup: true
skip_upload_docs: true
on:
branch: $RELEASE_BRANCH
condition: '"$PRIOR_VERSION" = "$RELEASE_VERSION"'
- stage: deploy
if: branch = env(RELEASE_BRANCH) AND type != pull_request AND repo = concat(env(OWNER),/,env(THIS_REPO))
python: 3.6
env:
- JOB="Deploy to GitHub Releases"
- RELEASE_BODY="* [$THIS_REPO v$RELEASE_VERSION CHANGELOG](https://github.com/$OWNER/$THIS_REPO/compare/$PRIOR_VERSION...$RELEASE_VERSION)"
install: skip
script:
- echo RELEASE_BODY=$RELEASE_BODY
deploy:
- provider: releases
api_key:
evaluates to true
.
A subsequent master
branch build include these jobs, so I think this is not an issue.
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
- python3 -m pip install virtualenv
- virtualenv $HOME/venv -p python3
- source $HOME/venv/bin/activate
cache:
directories:
- $HOME/Library/Caches/Homebrew
- /usr/local/Homebrew/Library/Homebrew
- /usr/local/Homebrew/Library/Taps
- $HOME/.cache/pip
- stage: deploy
if: branch = env(RELEASE_BRANCH) AND type != pull_request AND repo = concat(env(OWNER),/,env(THIS_REPO))
python: 3.6
env:
- JOB="Deploy to Test PyPI"
install: skip
script:
- sed -i -E "s/^(__version__ = \")(.*)\"/\1\2.$TRAVIS_BUILD_NUMBER\"/" $TRAVIS_BUILD_DIR/$THIS_REPO/__init__.py
deploy:
- provider: pypi
server: https://test.pypi.org/legacy/
distributions: sdist bdist_wheel
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.
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…
I don’t understand what you are saying. What did you test, and what happened?
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))
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).
OH. That makes sense. Travis CI cannot see into the future???