Commit f56d8e22 authored by Michel Dänzer's avatar Michel Dänzer Committed by Michel Dänzer

gitlab-ci: Docker image can be generated as part of pipeline

This removes the dependency on an externally generated docker image, and
should make it easier to update the docker image or make other changes
related to it.

This is based on Debian testing, because I'm most familiar with Debian.
But it should be easy to base it on another distro.

v2:
* Use kaniko instead of docker-in-docker for image generation, so it can
  also work in unprivileged runners.
* Drop piglit.conf & tetexec.cfg overrides, just make sure the files in
  the image work.
parent ed44f9cd
image: nwnk/xserver-travis-rawhide:v5
# IMAGE_TAG is the tag of the docker image used for the build jobs. If the
# image doesn't exist yet, the docker-image 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.
variables:
IMAGE_TAG: "debian-testing-20181217"
IMAGE_LOCAL: "$CI_REGISTRY_IMAGE:$IMAGE_TAG"
IMAGE_MAIN: "registry.freedesktop.org/xorg/$CI_PROJECT_NAME:$IMAGE_TAG"
job:
stages:
- docker-image
- build-and-test
debian-testing:
stage: docker-image
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- mkdir kaniko-context
- |
echo "FROM $IMAGE_LOCAL" > kaniko-context/Dockerfile
# If the image exists in the local registry, skip to the build-and-test job
set +e
set -x
/kaniko/executor --context kaniko-context --no-push && exit 0
set +x
set -e
- |
echo "FROM $IMAGE_MAIN" > kaniko-context/Dockerfile
# Try to re-use the image from the main repository's registry, and if
# that fails, generate a local image from scratch
set +e
set -x
/kaniko/executor --context kaniko-context --destination $IMAGE_LOCAL && exit 0
set +x
set -e
- /kaniko/executor --context $CI_PROJECT_DIR/.gitlab-ci --destination $IMAGE_LOCAL
build-and-test:
stage: build-and-test
image: $IMAGE_LOCAL
artifacts:
when: on_failure
paths:
......@@ -9,12 +59,6 @@ job:
PIGLIT_DIR: /root/piglit
XTEST_DIR: /root/xts
script:
- |
cat > $PIGLIT_DIR/piglit.conf << _EOF_
[xts]
path=$XTEST_DIR
_EOF_
- cp test/tetexec.cfg $XTEST_DIR/xts5
- meson -Dprefix=/usr build/
- |
ninja -C build/ install
......
FROM debian:testing-slim
WORKDIR /tmp
RUN export DEBIAN_FRONTEND=noninteractive; \
echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/locale/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft && \
echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf && \
echo '#!/bin/sh' > /usr/sbin/policy-rc.d && \
echo 'exit 101' >> /usr/sbin/policy-rc.d && \
chmod +x /usr/sbin/policy-rc.d && \
echo 'deb-src https://deb.debian.org/debian testing main' >/etc/apt/sources.list.d/deb-src.list && \
apt-get update && \
apt-get install -y meson git ca-certificates cmake automake autoconf libtool libwaffle-dev \
libxkbcommon-dev python-mako python-numpy python-six python3-mako python3-numpy python3-six \
x11-utils x11-xserver-utils xauth xvfb && \
apt-get build-dep -y xorg-server && \
\
cd /root && \
git clone https://gitlab.freedesktop.org/mesa/piglit.git && cd piglit && \
cmake -G Ninja -DPIGLIT_BUILD_GL_TESTS=OFF -DPIGLIT_BUILD_GLES1_TESTS=OFF \
-DPIGLIT_BUILD_GLES2_TESTS=OFF -DPIGLIT_BUILD_GLES3_TESTS=OFF \
-DPIGLIT_BUILD_DMA_BUF_TESTS=OFF -DPIGLIT_BUILD_GLX_TESTS=OFF && \
ninja && \
cd .. && \
git clone https://gitlab.freedesktop.org/xorg/test/xts && \
cd xts && ./autogen.sh && xvfb-run make -j$(nproc) && \
cd .. && rm -rf piglit/.git xts/.git && \
echo '[xts]' > piglit/piglit.conf && echo 'path=/root/xts' >> piglit/piglit.conf && \
find -name \*.a -o -name \*.o | xargs rm && \
\
apt-get purge -y git cmake automake autoconf libtool libwaffle-dev libxkbcommon-dev \
python3-mako python3-numpy python3-six x11-utils x11-xserver-utils xauth xvfb && \
apt-get autoremove -y --purge && apt-get clean && \
rm -f /var/lib/apt/lists/deb.debian.org_debian_dists_testing_*
......@@ -24,15 +24,6 @@ fi
cd $PIGLIT_DIR
# Write the piglit.conf we'll use for our testing. Don't use the
# default piglit.conf name because that may overwrite a local
# piglit.conf.
PIGLITCONF=piglit-xserver-test.conf
cat <<EOF > $PIGLITCONF
[xts]
path=$XTEST_DIR
EOF
# Skip some tests that are failing at the time of importing the script.
# "REPORT: min_bounds, rbearing was 0, expecting 2"
PIGLIT_ARGS="$PIGLIT_ARGS -x xlistfontswithinfo@3"
......@@ -41,4 +32,4 @@ PIGLIT_ARGS="$PIGLIT_ARGS -x xloadqueryfont@1"
PIGLIT_ARGS="$PIGLIT_ARGS -x xqueryfont@1"
PIGLIT_ARGS="$PIGLIT_ARGS -x xqueryfont@2"
exec ./piglit-run.py xts-render -f $PIGLITCONF $PIGLIT_ARGS $PIGLIT_RESULTS_DIR
exec ./piglit-run.py xts-render $PIGLIT_ARGS $PIGLIT_RESULTS_DIR
This diff is collapsed.
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