In docker builds, dotci will prematurely evaluate shell logic specified in .ci.yml
If you have something like this in your .ci.yml:
command:
- echo $HOSTNAME
Instead of giving you the hostname from inside the docker container as expected, it will evaluate the shell variable outside the docker container and give you the hostname of the docker server. We want shell logic to be evaluated at the right time, which is inside the docker container.
To do this you will need to assemble the "docker run" command line call in this way:
DOCKER_COMMAND=`cat << "EOF"
echo stuff from .ci.yml goes in here
echo $HOSTNAME
EOF`
And then once DOCKER_COMMAND is set, run the container like this:
docker run [options-from-ci-yml] [image-from-ci-yml] bash -c "$DOCKER_COMMAND"
NB: this shadows another issue which will need to be addressed once this is implemented: environment variables set by dotci are not forwarded to the docker container. Any shell variable that dotci sets (and which could potentially be used in the context of a .ci.yml) must be manually forwarded to the docker container at runtime using the -e flag for docker run.
+1
Did you find a workaround to this?