diff options
author | Eric Engestrom <[email protected]> | 2019-01-20 11:21:45 +0000 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-02-06 17:56:30 +0000 |
commit | 329f5cd78092f3ee72d3565417de646c98990036 (patch) | |
tree | 982f6f7b309fd287fc64afbadac054378d429f2e /.gitlab-ci.yml | |
parent | 42a1cd034d4a1ede0981f33c6759145efcca64f1 (diff) |
gitlab-ci: add ubuntu container
Signed-off-by: Eric Engestrom <[email protected]>
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000000..90b4f01cf00 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,49 @@ +# This is the tag of the docker image used for the build jobs. If the +# image doesn't exist yet, the containers-build stage generates it. +# +# In order to generate a new image, one should generally change the tag. +# While removing the image from the registry would also work, that's not +# recommended except for ephemeral images during development: Replacing +# an image after a significant amount of time might pull in newer +# versions of gcc/clang or other packages, which might break the build +# with older commits using the same tag. +# +# After merging a change resulting in generating a new image to the +# main repository, it's recommended to remove the image from the source +# repository's container registry, so that the image from the main +# repository's registry will be used there as well. +# +# The format of the tag is "%Y-%m-%d-${counter}" where ${counter} stays +# at "01" unless you have multiple updates on the same day :) +variables: + UBUNTU_TAG: 2019-01-31-01 + UBUNTU_IMAGE: "$CI_REGISTRY/$CI_PROJECT_PATH/ubuntu:$UBUNTU_TAG" + + +stages: + - containers-build + + +# CONTAINERS + +containers:ubuntu: + stage: containers-build + image: docker:stable + services: + - docker:dind + variables: + DOCKER_HOST: tcp://docker:2375 + DOCKER_DRIVER: overlay2 + script: + # Enable experimental features such as `docker manifest inspect` + - mkdir -p ~/.docker + - "echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json" + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY + # Check if the image (with the specific tag) already exists + - docker manifest inspect $UBUNTU_IMAGE && exit || true + - docker build -t $UBUNTU_IMAGE -f .gitlab-ci/Dockerfile.ubuntu . + - docker push $UBUNTU_IMAGE + only: + changes: + - .gitlab-ci.yml + - .gitlab-ci/Dockerfile.ubuntu |