Public
Authored by Gajus Kuizinas

Using Docker --cache-form

Edited
.gitlab-ci.yml 1.15 KB
  • You might want to change docker pull $CONTAINER_IMAGE:latest to docker pull $CONTAINER_IMAGE:latest ||true in case that image does not exist. Also you should be able to replace registry.anuary.com wich $CI_REGISTRY.

  • I came across this while looking for .gitlab-ci.yml examples.

    Just FYI.

    You are doing docker push $CONTAINER_IMAGE:latest before the test stage. You might want to do that in the release stage, to avoid pushing a broken latest image.

    However, this is tricky, since the dind service is not shared between the different scripts and stages. On https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#using-the-gitlab-container-registry they are building and pushing a test image in the build stage, which is then pulled in the different test stages and finally pulled, renamed and pushed in the deploy stage.

    It would be great if services could be shared between different stages and scripts to be able to avoid this pushing and pulling back and forth, but AFAIK that's not possible so far.

    Edited by Peter Billen
  • @cmorty Apparently composite commands need to be put in parens, i.e. (docker pull $CONTAINER_IMAGE:latest || true)

  • @trkoch: It works well for me. The braces start a sub-shell, which shouldn't be necessary, as every line is run in a separate shell (if I remember things right).

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment