diff options
38 files changed, 897 insertions, 0 deletions
@@ -0,0 +1,51 @@ +This repository contains files for a Jenkins build pipeline, using Docker to +build in known systems. + +The first tranche of jobs takes base system images (Debian, Fedora, and Ubuntu) +from the canonical upstream Docker Hub, and adds basic toolchain packages, +as well as a user to build under. These images are stored to a local Docker +registry (like the Hub, but self-hosted) for later use, tagged by date. + +The second tranche of jobs takes these produced system images, and adds build +dependencies for various packages. For instance, the Wayland base image will +have all the dependencies to build libevdev, libinput, wayland, +wayland-protocols, and weston. These images are also stored to the Docker +registry for later use, with a stable tag. Updating the first-tranche images +will also trigger a rebuild of these images. + +The third tranche of jobs uses these final produced images as a host in which +to build the packages, e.g. Wayland. These are triggered by upstream activity, +e.g. repository commits or code review requests. These jobs use a stable tag +of the images produced by the second-tranche jobs; 'stability' is determined +by running a test build of these jobs, and promoting if the builds succeed +against the new base images. + + +REQUIREMENTS +============ + +Jenkins 2.0: +Pipeline and Docker plugins, Matrix job plugin + +jenkins-job-builder and jenkins-job-builder-pipeline forks with fixes: +https://github.com/fooishbar/jenkins-job-builder +https://github.com/fooishbar/jenkins-job-builder-pipeline + + +JOB FLOW +======== + +The core entrypoint is docker-images/base-images/all, which runs in a multi-axis +configuration. Each axis simply spawns a pipeline job named +docker-images/base-images/$platform-$arch, which performs the actual work of +generating a base image for that architecture through a Pipeline job defined +in base-images/build-image.jpl. The definitions for all these jobs are in +base-images/base-images.jjb. + +For each base image build, it will spawn rebuilds (with the same tag/stamp) of +any dependent images. Currently, this is the docker-images/wayland-images/* +group, with a core pipeline defined in wayland-images/build-image.jpl. + +Dependent image builds then spawn builds (e.g. wayland/build/*) within the +container it just built, as a sanity check; if these are successful, then the +dependent build will be promoted. diff --git a/base-images/base-image-axes.yaml b/base-images/base-image-axes.yaml new file mode 100644 index 0000000..8f1effb --- /dev/null +++ b/base-images/base-image-axes.yaml @@ -0,0 +1,13 @@ +name: base-image-axes +platform: + - centos-7 + - fedora-24 + - debian-jessie + - ubuntu-14.04 + - ubuntu-16.04 +arch: + - x86-64 +exclude-from-all: + - exclusion: + platform: fedora-24 + arch: x86-64 diff --git a/base-images/base-images-all.jpl b/base-images/base-images-all.jpl new file mode 100644 index 0000000..5cc3914 --- /dev/null +++ b/base-images/base-images-all.jpl @@ -0,0 +1,39 @@ +def expanded = [:] +def excluded = [] + +my_str = readFile(file: "base-images/base-image-axes.yaml") + +yaml = new org.yaml.snakeyaml.Yaml() +axis_config = yaml.load(my_str) +yaml = null + +/* Sadly we can't use the map.each {} iterator in pipeline scripts yet ... */ +exclusions = axis_config["exclude-from-all"] +for (int i = 0; exclusions && i < exclusions.size(); i++) { + exclusion = exclusions[i]["exclusion"] + platform = exclusion["platform"] + arch = exclusion["arch"] + excluded << "${platform}-${arch}" + println "excluding ${platform}-${arch}" +} + +platform_list = axis_config["platform"] +arch_list = axis_config["arch"] + +for (int i = 0; i < platform_list.size(); i++) { + def platform = platform_list[i] + + for (int j = 0; j < arch_list.size(); j++) { + def arch = arch_list[j] + def name = "${platform}-${arch}" + if (excluded.contains(name)) { + continue; + } + + expanded[name] = { + build(job: "docker-images/base-images/${name}", propagate: true, wait: true) + } + } +} + +parallel expanded diff --git a/base-images/base-images.jjb b/base-images/base-images.jjb new file mode 100644 index 0000000..265e644 --- /dev/null +++ b/base-images/base-images.jjb @@ -0,0 +1,54 @@ +- job-template: + name: docker-images/base-images/all + defaults: global + project-type: pipeline + properties: + - inject: + properties-content: | + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "base-images/base-images-all.jpl" + }} + sandbox: false + +- job-template: + name: docker-images/base-images/{platform}-{arch} + defaults: global + project-type: pipeline + properties: + - inject: + properties-content: | + PLATFORM={platform} + ARCH={arch} + DOCKER_REGISTRY_URI_SCHEME={docker-registry-uri-scheme} + DOCKER_REGISTRY={docker-registry} + DOCKER_REGISTRY_CREDENTIALS={docker-registry-credentials} + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + # If we run a pipeline definition directly from SCM, it's always + # sandboxed, which means it can do ~nothing. Work around this by + # loading the script manually. + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "base-images/build-image.jpl" + }} + sandbox: false + +- project: + name: docker-images/base-images + defaults: base-image-axes + jobs: + - docker-images/base-images/{platform}-{arch} + - docker-images/base-images/all + +- defaults: + !include: base-images/base-image-axes.yaml + +- defaults: + !include: defaults.yaml diff --git a/base-images/build-image.jpl b/base-images/build-image.jpl new file mode 100644 index 0000000..a715b66 --- /dev/null +++ b/base-images/build-image.jpl @@ -0,0 +1,30 @@ +def stamp = sh(script: "date '+%Y%m%d%H%M'", returnStdout: true).trim() +def img_name = "${env.PLATFORM}-base-${env.ARCH}" +def dir_name = "${img_name}-${stamp}" +def registry = "${env.DOCKER_REGISTRY_URI_SCHEME}://${env.DOCKER_REGISTRY}" + +stage("Generating Dockerfile") { + sh(script: "./base-images/gen-dockerfile.sh ${env.PLATFORM} ${env.ARCH} ${dir_name}") +} + +def img_base + +stage("Building base image") { + docker.withRegistry(registry, env.DOCKER_REGISTRY_CREDENTIALS) { + /* + * We use --no-cache, as Docker sees steps like 'apt-get update' as being + * idempotent, rather than temporally-bound. + */ + img_base = docker.build("${img_name}:${stamp}", "--no-cache ${dir_name}") + } +} + +stage("Pushing base image") { + docker.withRegistry(registry, env.DOCKER_REGISTRY_CREDENTIALS) { + img_base.push() + } +} + +stage("Building Wayland image") { + def img_wl = build(job: "docker-images/wayland-images/${env.PLATFORM}-${env.ARCH}", parameters: [string(name: "STAMP", value: stamp)], propagate: true, wait: true) +} diff --git a/base-images/centos-7/Dockerfile.template b/base-images/centos-7/Dockerfile.template new file mode 100644 index 0000000..63182d1 --- /dev/null +++ b/base-images/centos-7/Dockerfile.template @@ -0,0 +1,26 @@ +FROM @@BASE@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Pull the latest updates, if any +RUN yum clean expire-cache +RUN yum -y update + +# Get a basic toolchain together +RUN yum install -y gcc glibc-devel autoconf automake libtool intltool git make + +# Add a user for CI +RUN mkdir /scratch +RUN adduser -p '!!' -m --home /scratch/jenkins --shell /bin/bash --comment 'Jenkins build user' jenkins-build +VOLUME "/scratch/jenkins" + +# git-phab +RUN yum install python + +# install pip, argcomplete, GitPython, python-phabricator + +WORKDIR /tmp +RUN git clone git://anongit.freedesktop.org/git/git-phab +RUN cp git-phab/git-phab /usr/bin/ + +# Clean up after ourselves +RUN yum clean packages diff --git a/base-images/debian-jessie/Dockerfile.template b/base-images/debian-jessie/Dockerfile.template new file mode 100644 index 0000000..acb913a --- /dev/null +++ b/base-images/debian-jessie/Dockerfile.template @@ -0,0 +1,29 @@ +FROM @@BASE@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Don't bother us +ENV DEBIAN_FRONTEND noninteractive +COPY apt-dpkg-config-updates.conf /etc/apt/apt.conf.d/90-dpkg-config-updates.conf +COPY apt-force-yes.conf /etc/apt/apt.conf.d/90-force-yes.conf +COPY apt-no-recommends.conf /etc/apt/apt.conf.d/90-no-recommends.conf +COPY apt-retry-lots.conf /etc/apt/apt.conf.d/90-retry-lots.conf + +# Pull the latest updates, if any +COPY apt-sources.list /etc/apt/sources.list +RUN apt-get update +RUN apt-get dist-upgrade + +# Get a basic toolchain together +RUN apt-get install build-essential autoconf automake libtool intltool git-core + +# Add a user for CI +RUN adduser --disabled-password --home /scratch/jenkins --shell /bin/bash --gecos 'Jenkins build user' jenkins-build +VOLUME "/scratch/jenkins" + +# git-phab +RUN apt-get install python3 python3-argcomplete python3-appdirs python3-pip python3-git/jessie-backports +RUN pip3 install phabricator + +WORKDIR /tmp +RUN git clone git://anongit.freedesktop.org/git/git-phab +RUN cp git-phab/git-phab /usr/bin/ diff --git a/base-images/debian-jessie/apt-dpkg-config-updates.conf b/base-images/debian-jessie/apt-dpkg-config-updates.conf new file mode 100644 index 0000000..a8a34ba --- /dev/null +++ b/base-images/debian-jessie/apt-dpkg-config-updates.conf @@ -0,0 +1,2 @@ +Dpkg::Options::="--force-confdef"; +Dpkg::Options::="--force-confnew"; diff --git a/base-images/debian-jessie/apt-force-yes.conf b/base-images/debian-jessie/apt-force-yes.conf new file mode 100644 index 0000000..1ab128d --- /dev/null +++ b/base-images/debian-jessie/apt-force-yes.conf @@ -0,0 +1,2 @@ +APT::Get::Assume-Yes "true"; +APT::Get::force-yes "true"; diff --git a/base-images/debian-jessie/apt-no-recommends.conf b/base-images/debian-jessie/apt-no-recommends.conf new file mode 100644 index 0000000..d12154b --- /dev/null +++ b/base-images/debian-jessie/apt-no-recommends.conf @@ -0,0 +1,2 @@ +APT::Get::Install-Recommends "false"; +APT::Get::Install-Suggests "false"; diff --git a/base-images/debian-jessie/apt-retry-lots.conf b/base-images/debian-jessie/apt-retry-lots.conf new file mode 100644 index 0000000..86f8298 --- /dev/null +++ b/base-images/debian-jessie/apt-retry-lots.conf @@ -0,0 +1 @@ +Acquire::Retries "20"; diff --git a/base-images/debian-jessie/apt-sources.list b/base-images/debian-jessie/apt-sources.list new file mode 100644 index 0000000..3364a39 --- /dev/null +++ b/base-images/debian-jessie/apt-sources.list @@ -0,0 +1,11 @@ +deb http://httpredir.debian.org/debian jessie main +deb-src http://httpredir.debian.org/debian jessie main + +deb http://httpredir.debian.org/debian jessie-updates main +deb-src http://httpredir.debian.org/debian jessie-updates main + +deb http://httpredir.debian.org/debian jessie-backports main +deb-src http://httpredir.debian.org/debian jessie-backports main + +deb http://security.debian.org/ jessie/updates main +deb-src http://security.debian.org/ jessie/updates main diff --git a/base-images/fedora-24/Dockerfile.template b/base-images/fedora-24/Dockerfile.template new file mode 100644 index 0000000..2ad22cd --- /dev/null +++ b/base-images/fedora-24/Dockerfile.template @@ -0,0 +1,24 @@ +FROM @@BASE@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Pull the latest updates, if any +RUN dnf --refresh -y update + +# Get a basic toolchain together +RUN dnf install -y gcc glibc-devel autoconf automake libtool intltool git make + +# Add a user for CI +RUN mkdir /scratch +RUN adduser -p '!!' -m --home /scratch/jenkins --shell /bin/bash --comment 'Jenkins build user' jenkins-build +VOLUME "/scratch/jenkins" + +# git-phab +RUN dnf install python3 python3-argcomplete python3-appdirs python3-pip +RUN pip install GitPython +RUN pip install phabricator +WORKDIR /tmp +RUN git clone git://anongit.freedesktop.org/git/git-phab +RUN cp git-phab/git-phab /usr/bin/ + +# Clean up after ourselves +RUN dnf clean packages diff --git a/base-images/gen-dockerfile.sh b/base-images/gen-dockerfile.sh new file mode 100755 index 0000000..8ab4b3c --- /dev/null +++ b/base-images/gen-dockerfile.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +set -e + +BASEDIR=$(dirname $0) + +PLATFORM=$1 +shift +ARCH=$1 +shift +DEST=$1 +shift + +case "${PLATFORM}:${ARCH}" in + centos-7:armv7) + exit 1 + ;; + centos-7:x86-64) + BASE="centos:7" + ;; + debian-jessie:armv7) + BASE="armhf/debian:jessie" + ;; + debian-jessie:x86-64) + BASE="debian:jessie" + ;; + fedora-24:armv7) + exit 1 + ;; + fedora-24:x86-64) + BASE="fedora:24" + ;; + ubuntu-14.04:armv7) + exit 1 + ;; + ubuntu-14.04:x86-64) + BASE="ubuntu:14.04" + ;; + ubuntu-16.04:armv7) + BASE="armhf/ubuntu:16.04" + ;; + ubuntu-16.04:x86-64) + BASE="ubuntu:16.04" + ;; + *) + exit 1 + ;; +esac + +mkdir ${DEST} +cp ${BASEDIR}/${PLATFORM}/* ${DEST} +sed -e "s#@@BASE@@#${BASE}#;" < ${DEST}/Dockerfile.template > ${DEST}/Dockerfile + +echo "Generated ${DEST}/Dockerfile from ${BASE}" diff --git a/base-images/ubuntu-14.04/Dockerfile.template b/base-images/ubuntu-14.04/Dockerfile.template new file mode 100644 index 0000000..94b1806 --- /dev/null +++ b/base-images/ubuntu-14.04/Dockerfile.template @@ -0,0 +1,31 @@ +FROM @@BASE@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Don't bother us +ENV DEBIAN_FRONTEND noninteractive +COPY apt-dpkg-config-updates.conf /etc/apt/apt.conf.d/90-dpkg-config-updates.conf +COPY apt-force-yes.conf /etc/apt/apt.conf.d/90-force-yes.conf +COPY apt-no-recommends.conf /etc/apt/apt.conf.d/90-no-recommends.conf +COPY apt-retry-lots.conf /etc/apt/apt.conf.d/90-retry-lots.conf + +# Pull the latest updates, if any +COPY apt-sources.list /etc/apt/sources.list +RUN apt-get update +RUN apt-get dist-upgrade + +# Get a basic toolchain together +RUN apt-get install build-essential autoconf automake libtool intltool git-core + +# Add a user for CI +RUN adduser --disabled-password --home /scratch/jenkins --shell /bin/bash --gecos 'Jenkins build user' jenkins-build +VOLUME "/scratch/jenkins" + +# git-phab +RUN apt-get install python3 python3-appdirs python3-pip +RUN pip3 install argcomplete +RUN pip3 install GitPython +RUN pip3 install phabricator + +WORKDIR /tmp +RUN git clone git://anongit.freedesktop.org/git/git-phab +RUN cp git-phab/git-phab /usr/bin/ diff --git a/base-images/ubuntu-14.04/apt-dpkg-config-updates.conf b/base-images/ubuntu-14.04/apt-dpkg-config-updates.conf new file mode 100644 index 0000000..a8a34ba --- /dev/null +++ b/base-images/ubuntu-14.04/apt-dpkg-config-updates.conf @@ -0,0 +1,2 @@ +Dpkg::Options::="--force-confdef"; +Dpkg::Options::="--force-confnew"; diff --git a/base-images/ubuntu-14.04/apt-force-yes.conf b/base-images/ubuntu-14.04/apt-force-yes.conf new file mode 100644 index 0000000..1ab128d --- /dev/null +++ b/base-images/ubuntu-14.04/apt-force-yes.conf @@ -0,0 +1,2 @@ +APT::Get::Assume-Yes "true"; +APT::Get::force-yes "true"; diff --git a/base-images/ubuntu-14.04/apt-no-recommends.conf b/base-images/ubuntu-14.04/apt-no-recommends.conf new file mode 100644 index 0000000..d12154b --- /dev/null +++ b/base-images/ubuntu-14.04/apt-no-recommends.conf @@ -0,0 +1,2 @@ +APT::Get::Install-Recommends "false"; +APT::Get::Install-Suggests "false"; diff --git a/base-images/ubuntu-14.04/apt-retry-lots.conf b/base-images/ubuntu-14.04/apt-retry-lots.conf new file mode 100644 index 0000000..86f8298 --- /dev/null +++ b/base-images/ubuntu-14.04/apt-retry-lots.conf @@ -0,0 +1 @@ +Acquire::Retries "20"; diff --git a/base-images/ubuntu-14.04/apt-sources.list b/base-images/ubuntu-14.04/apt-sources.list new file mode 100644 index 0000000..77caae4 --- /dev/null +++ b/base-images/ubuntu-14.04/apt-sources.list @@ -0,0 +1,8 @@ +deb http://archive.ubuntu.com/ubuntu trusty main universe +deb-src http://archive.ubuntu.com/ubuntu trusty main universe + +deb http://archive.ubuntu.com/ubuntu trusty-updates main universe +deb-src http://archive.ubuntu.com/ubuntu trusty-updates main universe + +deb http://archive.ubuntu.com/ubuntu trusty-security main universe +deb-src http://archive.ubuntu.com/ubuntu trusty-security main universe diff --git a/base-images/ubuntu-16.04/Dockerfile.template b/base-images/ubuntu-16.04/Dockerfile.template new file mode 100644 index 0000000..de686b3 --- /dev/null +++ b/base-images/ubuntu-16.04/Dockerfile.template @@ -0,0 +1,30 @@ +FROM @@BASE@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Don't bother us +ENV DEBIAN_FRONTEND noninteractive +COPY apt-dpkg-config-updates.conf /etc/apt/apt.conf.d/90-dpkg-config-updates.conf +COPY apt-force-yes.conf /etc/apt/apt.conf.d/90-force-yes.conf +COPY apt-no-recommends.conf /etc/apt/apt.conf.d/90-no-recommends.conf +COPY apt-retry-lots.conf /etc/apt/apt.conf.d/90-retry-lots.conf + +# Pull the latest updates, if any +COPY apt-sources.list /etc/apt/sources.list +RUN apt-get update +RUN apt-get dist-upgrade + +# Get a basic toolchain together +RUN apt-get install build-essential autoconf automake libtool intltool git-core + +# Add a user for CI +RUN adduser --disabled-password --home /scratch/jenkins --shell /bin/bash --gecos 'Jenkins build user' jenkins-build +VOLUME "/scratch/jenkins" + +# git-phab +RUN apt-get install python3 python3-argcomplete python3-appdirs python3-pip +RUN pip3 install GitPython # we need a newer version than Xenial provides +RUN pip3 install phabricator + +WORKDIR /tmp +RUN git clone git://anongit.freedesktop.org/git/git-phab +RUN cp git-phab/git-phab /usr/bin/ diff --git a/base-images/ubuntu-16.04/apt-dpkg-config-updates.conf b/base-images/ubuntu-16.04/apt-dpkg-config-updates.conf new file mode 100644 index 0000000..a8a34ba --- /dev/null +++ b/base-images/ubuntu-16.04/apt-dpkg-config-updates.conf @@ -0,0 +1,2 @@ +Dpkg::Options::="--force-confdef"; +Dpkg::Options::="--force-confnew"; diff --git a/base-images/ubuntu-16.04/apt-force-yes.conf b/base-images/ubuntu-16.04/apt-force-yes.conf new file mode 100644 index 0000000..1ab128d --- /dev/null +++ b/base-images/ubuntu-16.04/apt-force-yes.conf @@ -0,0 +1,2 @@ +APT::Get::Assume-Yes "true"; +APT::Get::force-yes "true"; diff --git a/base-images/ubuntu-16.04/apt-no-recommends.conf b/base-images/ubuntu-16.04/apt-no-recommends.conf new file mode 100644 index 0000000..d12154b --- /dev/null +++ b/base-images/ubuntu-16.04/apt-no-recommends.conf @@ -0,0 +1,2 @@ +APT::Get::Install-Recommends "false"; +APT::Get::Install-Suggests "false"; diff --git a/base-images/ubuntu-16.04/apt-retry-lots.conf b/base-images/ubuntu-16.04/apt-retry-lots.conf new file mode 100644 index 0000000..86f8298 --- /dev/null +++ b/base-images/ubuntu-16.04/apt-retry-lots.conf @@ -0,0 +1 @@ +Acquire::Retries "20"; diff --git a/base-images/ubuntu-16.04/apt-sources.list b/base-images/ubuntu-16.04/apt-sources.list new file mode 100644 index 0000000..d6f76e0 --- /dev/null +++ b/base-images/ubuntu-16.04/apt-sources.list @@ -0,0 +1,8 @@ +deb http://archive.ubuntu.com/ubuntu xenial main universe +deb-src http://archive.ubuntu.com/ubuntu xenial main universe + +deb http://archive.ubuntu.com/ubuntu xenial-updates main universe +deb-src http://archive.ubuntu.com/ubuntu xenial-updates main universe + +deb http://archive.ubuntu.com/ubuntu xenial-security main universe +deb-src http://archive.ubuntu.com/ubuntu xenial-security main universe diff --git a/defaults.yaml b/defaults.yaml new file mode 100644 index 0000000..964588e --- /dev/null +++ b/defaults.yaml @@ -0,0 +1,13 @@ +name: global +description: 'Do not edit this job through the web!' + +# Location of this Git repository +job-definition-git: git://anongit.freedesktop.org/git/jenkins-ci/jenkins-docker +job-definition-git-branch: master + +# Scheme/protocol component of Docker registry URI +docker-registry-uri-scheme: https +# Host component of Docker registry URI +docker-registry: docker-registry.freedesktop.org +# Name of Jenkins credentials for above Docker registry +docker-registry-credentials: docker-registry-fdo diff --git a/wayland-build/build-wayland.jpl b/wayland-build/build-wayland.jpl new file mode 100644 index 0000000..9004c87 --- /dev/null +++ b/wayland-build/build-wayland.jpl @@ -0,0 +1,41 @@ +def img_name = "${env.PLATFORM}-wayland-${env.ARCH}:${STAMP}" +def img_wl + +docker.withRegistry("${env.DOCKER_REGISTRY_URI_SCHEME}://${env.DOCKER_REGISTRY}", env.DOCKER_REGISTRY_CREDENTIALS) { + img_wl = docker.image("${env.DOCKER_REGISTRY}/${img_name}") + + /* The Wayland test suite relies on ptrace working, but doesn't use it ... */ + img_wl.inside("--cap-add SYS_PTRACE -v /scratch/jenkins:/scratch/jenkins") { + stage("wayland: git clone") { + git(url: "git://anongit.freedesktop.org/git/wayland/wayland", poll: false) + sh(script: "git clean -dxf") + } + + /* + * Normally we could use the dir() {} block to change the working directory, + * but unfortunately we can't with Docker, cf.: + * https://issues.jenkins-ci.org/browse/JENKINS-33510 + */ + sh(script: "mkdir build") + stage("wayland: configure") { + sh(script: "autoreconf -vfi") + sh(script: "cd build && ../configure --prefix=/scratch/jenkins/install-wayland") + } + + stage("wayland: build") { + sh(script: "make -C build") + } + + stage("wayland: make check") { + ret = sh(script: "make -C build check", returnStatus: true) + if (ret != 0) { + print readFile("build/test-suite.log") + error(message: "Test suite failed") + } + } + + stage("wayland: install") { + sh(script: "make -C build install") + } + } +} diff --git a/wayland-build/wayland-build.jjb b/wayland-build/wayland-build.jjb new file mode 100644 index 0000000..2ff693a --- /dev/null +++ b/wayland-build/wayland-build.jjb @@ -0,0 +1,64 @@ +- job-template: + name: wayland/build/all + defaults: global + project-type: pipeline + parameters: + - string: + name: STAMP + default: latest + description: 'Tag for Wayland build container image' + properties: + - inject: + properties-content: | + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "wayland-build/build-wayland.jpl" + }} + sandbox: false + +- job-template: + name: wayland/build/{platform}-{arch} + defaults: global + project-type: pipeline + parameters: + - string: + name: STAMP + default: latest + description: 'Tag for base container image' + properties: + - inject: + properties-content: | + PLATFORM={platform} + ARCH={arch} + DOCKER_REGISTRY_URI_SCHEME={docker-registry-uri-scheme} + DOCKER_REGISTRY={docker-registry} + DOCKER_REGISTRY_CREDENTIALS={docker-registry-credentials} + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + # If we run a pipeline definition directly from SCM, it's always + # sandboxed, which means it can do ~nothing. Work around this by + # loading the script manually. + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "wayland-build/build-wayland.jpl" + }} + sandbox: false + +- project: + name: wayland/build + defaults: base-image-axes + jobs: + - wayland/build/{platform}-{arch} + - wayland/build/all + +- defaults: + !include base-images/base-image-axes.yaml + +- defaults: + !include: defaults.yaml diff --git a/wayland-images/build-image.jpl b/wayland-images/build-image.jpl new file mode 100644 index 0000000..c762937 --- /dev/null +++ b/wayland-images/build-image.jpl @@ -0,0 +1,34 @@ +def img_name = "${env.PLATFORM}-wayland-${env.ARCH}" +def dir_name = "${img_name}-${STAMP}" + +stage("Generating Dockerfile") { + sh(script: "./wayland-images/gen-dockerfile.sh ${env.DOCKER_REGISTRY} ${env.PLATFORM} ${env.ARCH} ${STAMP} ${dir_name}") +} + +def img_wl + +stage("Building Wayland image") { + docker.withRegistry("${env.DOCKER_REGISTRY_URI_SCHEME}://${env.DOCKER_REGISTRY}", env.DOCKER_REGISTRY_CREDENTIALS) { + /* + * We use --no-cache, as Docker sees steps like 'apt-get update' as being + * idempotent, rather than temporally-bound. + */ + img_wl = docker.build("${img_name}:${STAMP}", "--no-cache ${dir_name}") + } +} + +stage("Pushing Wayland image") { + docker.withRegistry("${env.DOCKER_REGISTRY_URI_SCHEME}://${env.DOCKER_REGISTRY}", env.DOCKER_REGISTRY_CREDENTIALS) { + img_wl.push() + } +} + +stage("Testing Wayland build in new image") { + build(job: "wayland/build/${env.PLATFORM}-${env.ARCH}", parameters: [string(name: "STAMP", value: STAMP)], propagate: true, wait: true) +} + +stage("Promoting to latest") { + docker.withRegistry("${env.DOCKER_REGISTRY_URI_SCHEME}://${env.DOCKER_REGISTRY}", env.DOCKER_REGISTRY_CREDENTIALS) { + img_wl.push("latest") + } +} diff --git a/wayland-images/centos-7/Dockerfile.template b/wayland-images/centos-7/Dockerfile.template new file mode 100644 index 0000000..6085280 --- /dev/null +++ b/wayland-images/centos-7/Dockerfile.template @@ -0,0 +1,38 @@ +FROM @@REGISTRY@@/centos-7-base-@@ARCH@@:@@STAMP@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Common dependencies +RUN yum -y install \ + doxygen xmlto libxslt graphviz + +# libevdev dependencies +RUN yum -y install \ + check valgrind binutils + +# libinput dependencies +RUN yum -y install \ + mtdev-devel systemd-devel \ + libunwind-devel \ + glib-devel gtk3-devel + +# Wayland dependencies +RUN yum -y install \ + libffi-devel expat-devel libxml2-devel + +# wayland-protocols has no extra dependencies + +# Weston dependencies +RUN yum -y install \ + libxkbcommon-devel \ + pixman-devel mesa-libEGL-devel mesa-libGLES-devel \ + libdrm-devel systemd-devel mesa-libgbm-devel \ + libxcb-devel libXcursor-devel cairo-devel \ + freerdp-devel \ + libpng-devel libjpeg-turbo-devel libwebp-devel \ + colord-devel lcms2-devel \ + libva-devel \ + pango-devel \ + pam-devel dbus-devel libunwind-devel + +# Clean up after ourselves +RUN yum clean packages diff --git a/wayland-images/debian-jessie/Dockerfile.template b/wayland-images/debian-jessie/Dockerfile.template new file mode 100644 index 0000000..81b2402 --- /dev/null +++ b/wayland-images/debian-jessie/Dockerfile.template @@ -0,0 +1,38 @@ +FROM @@REGISTRY@@/debian-jessie-base-@@ARCH@@:@@STAMP@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Common dependencies +RUN apt-get install \ + doxygen xmlto xsltproc graphviz + +# libevdev dependencies +RUN apt-get install \ + check valgrind binutils + +# libinput dependencies +RUN apt-get install \ + libmtdev-dev libudev-dev \ + libunwind-dev \ + libglib2.0-dev libgtk-3-dev + +# Wayland dependencies +RUN apt-get install \ + libffi-dev libexpat-dev libxml2-dev + +# wayland-protocols has no extra dependencies + +# Weston dependencies +RUN apt-get install \ + libxkbcommon-dev \ + libpixman-1-dev libegl1-mesa-dev libgles2-mesa-dev \ + libdrm-dev libudev-dev libgbm-dev \ + libxcb1-dev libxcb-xfixes0-dev libxcb-composite0-dev libxcursor-dev libcairo-dev libxcb-xkb-dev \ + libfreerdp-dev \ + libpng-dev libjpeg-dev libwebp-dev \ + libcolord-dev liblcms2-dev \ + libva-dev \ + libcairo2-dev libpango1.0-dev \ + libpam0g-dev libdbus-1-dev libsystemd-dev libunwind-dev + +# Clean up after ourselves +RUN apt-get clean diff --git a/wayland-images/fedora-24/Dockerfile.template b/wayland-images/fedora-24/Dockerfile.template new file mode 100644 index 0000000..e75151d --- /dev/null +++ b/wayland-images/fedora-24/Dockerfile.template @@ -0,0 +1,38 @@ +FROM @@REGISTRY@@/fedora-24-base-@@ARCH@@:@@STAMP@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Common dependencies +RUN dnf -y install \ + doxygen xmlto libxslt graphviz + +# libevdev dependencies +RUN dnf -y install \ + check valgrind binutils + +# libinput dependencies +RUN dnf -y install \ + mtdev-devel systemd-devel \ + libunwind-devel \ + glib-devel gtk3-devel + +# Wayland dependencies +RUN dnf -y install \ + libffi-devel expat-devel libxml2-devel + +# wayland-protocols has no extra dependencies + +# Weston dependencies +RUN dnf -y install \ + libxkbcommon-devel \ + pixman-devel mesa-libEGL-devel mesa-libGLES-devel \ + libdrm-devel systemd-devel mesa-libgbm-devel \ + libxcb-devel libXcursor-devel cairo-devel \ + freerdp-devel \ + libpng-devel libjpeg-turbo-devel libwebp-devel \ + colord-devel lcms2-devel \ + libva-devel \ + pango-devel \ + pam-devel dbus-devel libunwind-devel + +# Clean up after ourselves +RUN dnf clean packages diff --git a/wayland-images/gen-dockerfile.sh b/wayland-images/gen-dockerfile.sh new file mode 100755 index 0000000..dc177b1 --- /dev/null +++ b/wayland-images/gen-dockerfile.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +BASEDIR=$(dirname $0) + +REGISTRY=$1 +shift +PLATFORM=$1 +shift +ARCH=$1 +shift +STAMP=$1 +shift +DEST=$1 +shift + +mkdir -p ${DEST} +sed -e "s#@@REGISTRY@@#${REGISTRY}#; s#@@ARCH@@#${ARCH}#; s#@@STAMP@@#${STAMP}#;" < \ + ${BASEDIR}/${PLATFORM}/Dockerfile.template > \ + ${DEST}/Dockerfile + +echo "Generated ${DEST}/Dockerfile from ${ARCH}/${STAMP}" diff --git a/wayland-images/ubuntu-14.04/Dockerfile.template b/wayland-images/ubuntu-14.04/Dockerfile.template new file mode 100644 index 0000000..5cad488 --- /dev/null +++ b/wayland-images/ubuntu-14.04/Dockerfile.template @@ -0,0 +1,39 @@ +FROM @@REGISTRY@@/ubuntu-14.04-base-@@ARCH@@:@@STAMP@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Common dependencies +RUN apt-get install \ + doxygen xmlto xsltproc graphviz + +# libevdev dependencies +RUN apt-get install \ + check valgrind binutils + +# libinput dependencies +RUN apt-get install \ + libmtdev-dev libudev-dev \ + libunwind8-dev \ + libglib2.0-dev libgtk-3-dev + +# Wayland dependencies +RUN apt-get install \ + libffi-dev libexpat-dev libxml2-dev + +# wayland-protocols has no extra dependencies + +# Weston dependencies +RUN apt-get install \ + libxkbcommon-dev \ + libpixman-1-dev libegl1-mesa-dev libgles2-mesa-dev \ + libdrm-dev libudev-dev libgbm-dev \ + libxcb1-dev libxcb-xfixes0-dev libxcb-composite0-dev libxcursor-dev libcairo-dev libxcb-xkb-dev \ + libfreerdp-dev \ + libpng-dev libjpeg-dev libwebp-dev \ + libcolord-dev liblcms2-dev \ + libva-dev \ + libcairo2-dev libpango1.0-dev \ + libpam0g-dev libdbus-1-dev libunwind8-dev \ + libsystemd-daemon-dev libsystemd-login-dev + +# Clean up after ourselves +RUN apt-get clean diff --git a/wayland-images/ubuntu-16.04/Dockerfile.template b/wayland-images/ubuntu-16.04/Dockerfile.template new file mode 100644 index 0000000..c1c5b0a --- /dev/null +++ b/wayland-images/ubuntu-16.04/Dockerfile.template @@ -0,0 +1,39 @@ +FROM @@REGISTRY@@/ubuntu-16.04-base-@@ARCH@@:@@STAMP@@ +MAINTAINER Daniel Stone <daniels@collabora.com> + +# Common dependencies +RUN apt-get install \ + doxygen xmlto xsltproc graphviz + +# libevdev dependencies +RUN apt-get install \ + check valgrind binutils + +# libinput dependencies +RUN apt-get install \ + libmtdev-dev libudev-dev \ + libunwind-dev \ + libglib2.0-dev libgtk-3-dev + +# Wayland dependencies +RUN apt-get install \ + libffi-dev libexpat-dev libxml2-dev + +# wayland-protocols has no extra dependencies + +# Weston dependencies +RUN apt-get install \ + libxkbcommon-dev \ + libpixman-1-dev libegl1-mesa-dev libgles2-mesa-dev \ + libdrm-dev libudev-dev libgbm-dev \ + libxcb1-dev libxcb-xfixes0-dev libxcb-composite0-dev libxcursor-dev libcairo-dev libxcb-xkb-dev \ + libfreerdp-dev \ + libpng-dev libjpeg-dev libwebp-dev \ + libcolord-dev liblcms2-dev \ + libva-dev \ + libcairo2-dev libpango1.0-dev \ + libpam0g-dev libdbus-1-dev libunwind-dev \ + libsystemd-dev + +# Clean up after ourselves +RUN apt-get clean diff --git a/wayland-images/wayland-images-all.jpl b/wayland-images/wayland-images-all.jpl new file mode 100644 index 0000000..5d6663c --- /dev/null +++ b/wayland-images/wayland-images-all.jpl @@ -0,0 +1,39 @@ +def expanded = [:] +def excluded = [] + +my_str = readFile(file: "base-images/base-image-axes.yaml") + +yaml = new org.yaml.snakeyaml.Yaml() +axis_config = yaml.load(my_str) +yaml = null + +/* Sadly we can't use the map.each {} iterator in pipeline scripts yet ... */ +exclusions = axis_config["exclude-from-all"] +for (int i = 0; exclusions && i < exclusions.size(); i++) { + exclusion = exclusions[i]["exclusion"] + platform = exclusion["platform"] + arch = exclusion["arch"] + excluded << "${platform}-${arch}" + println "excluding ${platform}-${arch}" +} + +platform_list = axis_config["platform"] +arch_list = axis_config["arch"] + +for (int i = 0; i < platform_list.size(); i++) { + def platform = platform_list[i] + + for (int j = 0; j < arch_list.size(); j++) { + def arch = arch_list[j] + def name = "${platform}-${arch}" + if (excluded.contains(name)) { + continue; + } + + expanded[name] = { + build(job: "docker-images/wayland-images/${name}", parameters: [string(name: 'STAMP', value: STAMP)], propagate: true, wait: true) + } + } +} + +parallel expanded diff --git a/wayland-images/wayland-images.jjb b/wayland-images/wayland-images.jjb new file mode 100644 index 0000000..308b7b7 --- /dev/null +++ b/wayland-images/wayland-images.jjb @@ -0,0 +1,62 @@ +- job-template: + name: docker-images/wayland-images/all + defaults: global + project-type: pipeline + parameters: + - string: + name: STAMP + description: 'Tag for base container image' + properties: + - inject: + properties-content: | + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "wayland-images/wayland-images-all.jpl" + }} + sandbox: false + +- job-template: + name: docker-images/wayland-images/{platform}-{arch} + defaults: global + project-type: pipeline + parameters: + - string: + name: STAMP + description: "Tag for base container image" + properties: + - inject: + properties-content: | + PLATFORM={platform} + ARCH={arch} + DOCKER_REGISTRY_URI_SCHEME={docker-registry-uri-scheme} + DOCKER_REGISTRY={docker-registry} + DOCKER_REGISTRY_CREDENTIALS={docker-registry-credentials} + JOB_DEFINITION_GIT={job-definition-git} + JOB_DEFINITION_GIT_BRANCH={job-definition-git-branch} + pipeline: + # If we run a pipeline definition directly from SCM, it's always + # sandboxed, which means it can do ~nothing. Work around this by + # loading the script manually. + script: | + node('docker') {{ + git(url: env.JOB_DEFINITION_GIT, branch: env.JOB_DEFINITION_GIT_BRANCH, poll: false) + load "wayland-images/build-image.jpl" + }} + sandbox: false + +- project: + name: docker-images/wayland-images + defaults: base-image-axes + jobs: + - docker-images/wayland-images/{platform}-{arch} + - docker-images/wayland-images/all + +- defaults: + !include: base-images/base-image-axes.yaml + +- defaults: + !include: defaults.yaml |