Commit a0802a08 authored by Benjamin Tissoires's avatar Benjamin Tissoires
Browse files

attach the correct bootstrap image for a given git snapshot



Previously, we were always using `buildah:latest`, which introduced the
side effect that over time, projects will not be using the bootstrap
we have been conducting CI.

Thanks to the templating, it´ s now easy enough to define the tags in
defaults.yml and reuse it everywhere.
Signed-off-by: Benjamin Tissoires's avatarBenjamin Tissoires <benjamin.tissoires@gmail.com>
parent 9d5a6b7d
......@@ -85,16 +85,24 @@ stages:
- fedora_check
- ubuntu_container_build
- ubuntu_check
- container_push
#
# We want those to fail as early as possible, so we are reusing the current
# wayland/ci-templates/buildah:latest image
# We want those to fail as early as possible, so we are using a plain fedora
# image, and there is no need to run `dnf update` as we only need to run
# one python script.
#
sanity check:
.pip_install:
stage: sanity check
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: fedora:31
before_script:
- curl https://bootstrap.pypa.io/get-pip.py -o /root/get-pip.py
- python3 /root/get-pip.py
- dnf install -y git-core
sanity check:
extends: .pip_install
script:
- pip3 install --user jinja2 PyYAML
- python3 ./src/generate_templates.py
......@@ -108,8 +116,7 @@ sanity check:
check commits:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
stage: sanity check
extends: .pip_install
script:
- pip3 install GitPython
- pip3 install pytest
......@@ -133,38 +140,4 @@ bootstrap:
bootstrap@arm64v8:
extends: .bootstrap@arm64v8
#
# Everything went fine if this is run, we can promote the latest bootstrap
# tag as latest
#
bootstrap-push@push:
stage: container_push
image: $CI_REGISTRY_IMAGE/buildah:$BOOTSTRAP_TAG
script:
# log in to the registry
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# push the container image to the registry
- skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:$BOOTSTRAP_TAG
docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:latest
variables:
GIT_STRATEGY: none
only:
refs:
- master
bootstrap-push@arm64v8:
extends: bootstrap-push@push
image: $CI_REGISTRY_IMAGE/arm64v8/buildah:$BOOTSTRAP_TAG
before_script:
- export ARCH="arm64v8/"
tags:
- aarch64
only:
refs:
- master
\ No newline at end of file
extends: .bootstrap@arm64v8
\ No newline at end of file
......@@ -132,3 +132,6 @@ globals:
- '/bin/bash test/script.sh'
- './test/script.sh'
- 'sh test/script.sh'
## @bootstrap_tag: the current image tag associated with this bootstrap image
bootstrap_tag: '2019-12-02'
......@@ -48,7 +48,12 @@ if __name__ == '__main__':
if key not in config:
config[key] = value
# store the geenrated values in the base config dictionnary
# add missing keys from the globals
for key, value in globs.items():
if key not in config:
config[key] = value
# store the generated values in the base config dictionnary
config_data.update(data)
# load our distribution template
......@@ -91,6 +96,9 @@ if __name__ == '__main__':
distribs = [d for d in sorted(config_data.keys()) if d not in ('defaults', 'globals')]
dest = f'.gitlab-ci.yml'
config = {'distribs': distribs}
config.update(globs)
print(f'generating {dest}')
with open(dest, 'w') as out_stream:
template_general_ci.stream({'distribs': distribs}).dump(out_stream)
template_general_ci.stream(config).dump(out_stream)
......@@ -19,7 +19,7 @@ include:
{% endfor %}
variables:
BOOTSTRAP_TAG: '2019-12-02'
BOOTSTRAP_TAG: '{{ bootstrap_tag }}'
stages:
......@@ -29,16 +29,24 @@ stages:
- {{ distribution }}_container_build
- {{ distribution }}_check
{% endfor %}
- container_push
#
# We want those to fail as early as possible, so we are reusing the current
# wayland/ci-templates/buildah:latest image
# We want those to fail as early as possible, so we are using a plain fedora
# image, and there is no need to run `dnf update` as we only need to run
# one python script.
#
sanity check:
.pip_install:
stage: sanity check
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: fedora:31
before_script:
- curl https://bootstrap.pypa.io/get-pip.py -o /root/get-pip.py
- python3 /root/get-pip.py
- dnf install -y git-core
sanity check:
extends: .pip_install
script:
- pip3 install --user jinja2 PyYAML
- python3 ./src/generate_templates.py
......@@ -52,8 +60,7 @@ sanity check:
check commits:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
stage: sanity check
extends: .pip_install
script:
- pip3 install GitPython
- pip3 install pytest
......@@ -78,37 +85,3 @@ bootstrap:
bootstrap@arm64v8:
extends: .bootstrap@arm64v8
#
# Everything went fine if this is run, we can promote the latest bootstrap
# tag as latest
#
bootstrap-push@push:
stage: container_push
image: $CI_REGISTRY_IMAGE/buildah:$BOOTSTRAP_TAG
script:
# log in to the registry
- podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# push the container image to the registry
- skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:$BOOTSTRAP_TAG
docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:latest
variables:
GIT_STRATEGY: none
only:
refs:
- master
bootstrap-push@arm64v8:
extends: bootstrap-push@push
image: $CI_REGISTRY_IMAGE/arm64v8/buildah:$BOOTSTRAP_TAG
before_script:
- export ARCH="arm64v8/"
tags:
- aarch64
only:
refs:
- master
......@@ -45,7 +45,7 @@
.{{distribution}}@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:{{ bootstrap_tag }}
stage: build
before_script:
# log in to the registry
......@@ -133,7 +133,7 @@
.{{distribution}}@container-build@arm64v8:
extends: .{{distribution}}@container-build
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:{{ bootstrap_tag }}
tags:
- aarch64
{% endif %}
......@@ -185,7 +185,7 @@
.{{distribution}}@container-ifnot-exists@arm64v8:
extends: .{{distribution}}@container-ifnot-exists
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:{{ bootstrap_tag }}
tags:
- aarch64
{% endif %}
......@@ -42,7 +42,7 @@
.alpine@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......@@ -119,7 +119,7 @@
.alpine@container-build@arm64v8:
extends: .alpine@container-build
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -169,6 +169,6 @@
.alpine@container-ifnot-exists@arm64v8:
extends: .alpine@container-ifnot-exists
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -42,7 +42,7 @@
.arch@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......
......@@ -43,7 +43,7 @@
.centos@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......
......@@ -43,7 +43,7 @@
.debian@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......@@ -129,7 +129,7 @@
.debian@container-build@arm64v8:
extends: .debian@container-build
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -179,6 +179,6 @@
.debian@container-ifnot-exists@arm64v8:
extends: .debian@container-ifnot-exists
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -43,7 +43,7 @@
.fedora@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......@@ -118,7 +118,7 @@
.fedora@container-build@arm64v8:
extends: .fedora@container-build
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -168,6 +168,6 @@
.fedora@container-ifnot-exists@arm64v8:
extends: .fedora@container-ifnot-exists
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -43,7 +43,7 @@
.ubuntu@container-build:
image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/buildah:2019-12-02
stage: build
before_script:
# log in to the registry
......@@ -128,7 +128,7 @@
.ubuntu@container-build@arm64v8:
extends: .ubuntu@container-build
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
......@@ -178,6 +178,6 @@
.ubuntu@container-ifnot-exists@arm64v8:
extends: .ubuntu@container-ifnot-exists
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:latest
image: $CI_REGISTRY/wayland/ci-templates/arm64v8/buildah:2019-12-02
tags:
- aarch64
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