It’s quite almost exactly the same like passing Docker
environment variables to Travis using the Travis CLI. So for example the
script hook I wrote passes the
environment variables to Docker, then once authenticated pushes the image out:
script: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && make push-image
There’s no reason to add anything to your
before_script hook though. I get the question, but the solution should be obvious, the flow you’re describing, sounds a lot like if you used another CI provider at one point, specifically CircleCI.
It’s not better or worse, CircleCI has their own process, but unlike CircleCI, our build starts out as a single bash script compiled from the information given in
.travis.yml, and again this isn’t a better or worse way of doing things, it’s just how Travis is designed.