-
Simon McVittie authored
Signed-off-by:
Simon McVittie <smcv@collabora.com>
Simon McVittie authoredSigned-off-by:
Simon McVittie <smcv@collabora.com>
Jenkinsfile 2.92 KiB
#!/usr/bin/env groovy
/*
* SPDX-License-Identifier: LGPL-2.1+
*
* Copyright © 2017-2018 Collabora Ltd
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this package. If not, see
* <http://www.gnu.org/licenses/>.
*/
@Library('steamos-ci') _
pipeline {
options {
timestamps()
skipDefaultCheckout()
}
agent {
label 'docker-slave'
}
environment {
HOME="${env.WORKSPACE}"
TMPDIR="${env.WORKSPACE}"
PYTHONUNBUFFERED="1"
}
stages {
stage ("pressure-vessel") {
steps {
sh '''
git config --global user.name Jenkins
git config --global user.email nobody@example.com
'''
checkoutCollaboraGitlab('steam/pressure-vessel', 'master', 'src')
dir('src') {
sh '''
set -eu
./build-aux/git-version-gen .tarball-version > .tarball-version_
mv .tarball-version_ .tarball-version
'''
}
script {
if (env.CI_DOCKER_REGISTRY_CRED == '') {
dockerRegistryCred = null;
}
else {
dockerRegistryCred = env.CI_DOCKER_REGISTRY_CRED;
}
if (!env.CI_DOCKER_IMAGE) {
env.CI_DOCKER_IMAGE = 'steamrt/sdk:scout'
}
if (!env.CI_DOCKER_OPTIONS) {
env.CI_DOCKER_OPTIONS = ''
}
sh """
sed -e 's!@BASE_IMAGE@!${env.CI_DOCKER_REGISTRY}/${env.CI_DOCKER_IMAGE}!g' < src/ci/Dockerfile.in > src/ci/Dockerfile
"""
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
docker.build("${env.CI_DOCKER_REGISTRY}/pressure-vessel", '-f src/ci/Dockerfile src/ci').inside("--mount type=tmpfs,destination=/var/cache/apt/archives ${env.CI_DOCKER_OPTIONS}") {
sh '''
set -eu
mkdir -p /var/cache/apt/archives/partial
cd src
meson --prefix="${WORKSPACE}/src/_build/relocatable-install" -Dpython=python3.5 _build
ninja -C _build
ninja -C _build install
meson test --verbose -C _build
'''
}
}
}
dir('src/_build') {
archiveArtifacts 'pressure-vessel-*-bin.tar.gz'
archiveArtifacts 'pressure-vessel-*-bin+src.tar.gz'
}
}
}
}
post {
cleanup {
deleteDir()
}
}
}
/* vim:set sw=2 sts=2 et: */