diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-04-19 19:01:37 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-04-19 19:01:37 -0500 |
commit | 7d3022e1a534b073a34d8c95962af62a2f8a5156 (patch) | |
tree | 854cd0f81ed397c3763da5e687b55276c4a9385d /ci | |
parent | ecc86a8025c630f558b1d3e79ed0154ff65ea5ff (diff) | |
download | at-spi2-core-7d3022e1a534b073a34d8c95962af62a2f8a5156.tar.gz |
Remove the old Docker scripts and update the docs
Diffstat (limited to 'ci')
-rw-r--r-- | ci/README.md | 54 | ||||
-rw-r--r-- | ci/opensuse.Dockerfile | 34 | ||||
-rwxr-xr-x | ci/run-docker.sh | 132 |
3 files changed, 5 insertions, 215 deletions
diff --git a/ci/README.md b/ci/README.md index 9adfaac8..7fc8697e 100644 --- a/ci/README.md +++ b/ci/README.md @@ -7,6 +7,10 @@ pipeline, and utilities to maintain the CI infrastructure. ## Scripts used during a run of a CI pipeline: +* `container-builds.yml` - Gets included from the toplevel + `.gitlab-ci.yml`; has the declarations to build each container image + with the [Freedesktop CI Templates][ci-templates] machinery. + * `run-tests.sh` - Runs the test suite and prints other diagnostics. * `gen-coverage.sh` - After the test suite is run, merges the various @@ -24,53 +28,5 @@ pipeline, and utilities to maintain the CI infrastructure. `run-style-check.sh`; finds a git branch point from the current commit. -## Utilities to maintain the CI infrastructure: - -To make pipelines fast, and avoid a lot of repeated downloads, -at-spi2-core uses pre-built container images for CI pipelines, instead -of using a stock image like opensuse/tumbleweed and then installing -all the dependencies on top of it every time. - -The prebuilt images are stored here: -https://gitlab.gnome.org/GNOME/at-spi2-core/container_registry - -Instead of maintaining those images by hand with `docker` or `podman` -commands, here is a little script (stolen from [glib][glib-ci]) to -maintain them, which you can start exploring with `./run-docker.sh help`. - -This script knows how to build and upload images from Dockerfiles -called `foo.Dockerfile`. The image configurations we have: - -* `opensuse.Dockerfile` - starts with an opensuse/tumbleweed image and - installs the package dependencies for building at-spi2-core. - -If you are one of at-spi2-core's maintainers, you'll want to update -the CI images periodically. First, install `podman` and -`podman-docker`. Then, run this: - -```sh -# "opensuse" in these commands indicates to use the opensuse.Dockerfile configuration - -./run-docker.sh build --base=opensuse # builds the image, takes a while - -./run-docker.sh run --base=opensuse # launch the container; poke around; see that it works - -./run-docker.sh push --base=opensuse # push the image to registry.gitlab.gnome.org -``` - -The `build` subcommand creates an image named -`registry.gitlab.gnome.org/gnome/at-spi2-core/opensuse/tumbleweed:latest` -**that is only stored in your localhost**. - -The `run` subcommand launches a container with that image and gives -you a shell prompt. This is equivalent to `podman run`. - -The `push` subcommand takes that built image and uploads it to -`registry.gitlab.gnome.org`. It will then be visible from -https://gitlab.gnome.org/GNOME/at-spi2-core/container_registry - the -CI configuration in [`.gitlab-ci.yml`](../.gitlab-ci.yml) uses this -image for the pipeline. - [ci-docs]: ../devel-docs/gitlab-ci.md -[container-registry-docs]: https://gitlab.gnome.org/help/user/packages/container_registry/index -[glib-ci]: https://gitlab.gnome.org/GNOME/glib/-/tree/main/.gitlab-ci +[ci-templates]: https://gitlab.freedesktop.org/freedesktop/ci-templates/ diff --git a/ci/opensuse.Dockerfile b/ci/opensuse.Dockerfile deleted file mode 100644 index 0bcdfe43..00000000 --- a/ci/opensuse.Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Dockerfile to build container images for Gitlab Continuous Integration -# -# This starts with an openSUSE Tumbleweed image, and installs the dependencies -# for building and testing at-spi2-core. -# -# See README.md for documentation. - -FROM opensuse/tumbleweed:latest - -RUN zypper refresh \ - && zypper install -y \ - clang \ - clang-tools \ - findutils \ - gcc \ - dbus-1 \ - dbus-1-devel \ - gettext \ - git \ - glib2-devel \ - gobject-introspection-devel \ - gsettings-desktop-schemas \ - itstool \ - libasan6 \ - libxml2-devel \ - libxkbcommon-devel \ - libXi-devel \ - libXtst-devel \ - lcov \ - meson \ - ninja \ - python38 \ - python38-gobject \ - && zypper clean --all diff --git a/ci/run-docker.sh b/ci/run-docker.sh deleted file mode 100755 index d6be4670..00000000 --- a/ci/run-docker.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash - -read_arg() { - # $1 = arg name - # $2 = arg value - # $3 = arg parameter - local rematch='^[^=]*=(.*)$' - if [[ $2 =~ $rematch ]]; then - read -r "$1" <<< "${BASH_REMATCH[1]}" - else - read -r "$1" <<< "$3" - # There is no way to shift our callers args, so - # return 1 to indicate they should do it instead. - return 1 - fi -} - -SUDO_CMD="sudo" -if docker -v |& grep -q podman; then - # Using podman - SUDO_CMD="" - # Docker is actually implemented by podman, and its OCI output - # is incompatible with some of the dockerd instances on GitLab - # CI runners. - export BUILDAH_FORMAT=docker -fi - -set -e - -base="" -base_version="" -build=0 -run=0 -push=0 -list=0 -print_help=0 -no_login=0 - -while (($# > 0)); do - case "${1%%=*}" in - build) build=1;; - run) run=1;; - push) push=1;; - list) list=1;; - help) print_help=1;; - --base|-b) read_arg base "$@" || shift;; - --base-version) read_arg base_version "$@" || shift;; - --no-login) no_login=1;; - *) echo -e "\\e[1;31mERROR\\e[0m: Unknown option '$1'"; exit 1;; - esac - shift -done - -if [ $print_help == 1 ]; then - echo "$0 - Build and run Docker images" - echo "" - echo "Usage: $0 <command> [options] [basename]" - echo "" - echo "Available commands" - echo "" - echo " build --base=<BASENAME> - Build Docker image <BASENAME>.Dockerfile" - echo " run --base=<BASENAME> - Run Docker image <BASENAME>" - echo " push --base=<BASENAME> - Push Docker image <BASENAME> to the registry" - echo " list - List available images" - echo " help - This help message" - echo "" - exit 0 -fi - -cd "$(dirname "$0")" - -if [ $list == 1 ]; then - echo "Available Docker images:" - for f in *.Dockerfile; do - filename=$( basename -- "$f" ) - basename="${filename%.*}" - - echo -e " \\e[1;39m$basename\\e[0m" - done - exit 0 -fi - -# All commands after this require --base to be set -if [ -z "${base}" ]; then - echo "Usage: $0 <command>" - echo "Or use \"$0 help\" for a list of commands" - exit 1 -fi - -if [ ! -f "$base.Dockerfile" ]; then - echo -e "\\e[1;31mERROR\\e[0m: Dockerfile for '$base' not found" - exit 1 -fi - -if [ -z "${base_version}" ]; then - base_version="latest" -else - base_version="v$base_version" -fi - -TAG="registry.gitlab.gnome.org/gnome/at-spi2-core/${base}:${base_version}" - -if [ $build == 1 ]; then - echo -e "\\e[1;32mBUILDING\\e[0m: ${base} as ${TAG}" - $SUDO_CMD docker build \ - --tag "${TAG}" \ - --file "${base}.Dockerfile" . - exit $? -fi - -if [ $push == 1 ]; then - echo -e "\\e[1;32mPUSHING\\e[0m: ${base} as ${TAG}" - - if [ $no_login == 0 ]; then - $SUDO_CMD docker login registry.gitlab.gnome.org - fi - - $SUDO_CMD docker push $TAG - exit $? -fi - -if [ $run == 1 ]; then - echo -e "\\e[1;32mRUNNING\\e[0m: ${base} as ${TAG}" - $SUDO_CMD docker run \ - --rm \ - --volume "$(pwd)/..:/home/user/app" \ - --workdir "/home/user/app" \ - --tty \ - --interactive "${TAG}" \ - bash - exit $? -fi |