Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
@Library('camunda-community') _

def OSList = [
'windows',
'ubuntu18', 'ubuntu20', 'ubuntu22',
'rhel7', 'rhel8', 'rhel9',
// 'alpine3.9-armhf', 'alpine3.9-x86_64', 'alpine3.9-x86',
'debian9-64', 'debian10-64', 'debian11-64',
'test-asan', 'test-tsan', 'test-ubsan',
]

def AdminList = [
'AndreaRigoni',
'GabrieleManduchi',
'joshStillerman',
'mwinkel-dev',
'santorofer',
'tfredian',
'WhoBrokeTheBuild',
'zack-vii',
]

def schedule = "";
if (BRANCH_NAME == "alpha") {
schedule = "0 18 * * *";
}
if (BRANCH_NAME == "stable") {
schedule = "0 19 * * *";
}

pipeline {
agent any
options {
skipDefaultCheckout()
timeout(time: 1, unit: 'HOURS')
}
triggers {
cron(schedule)
issueCommentTrigger('(?i).*retest\\s+this\\s+please.*')
}

stages {
stage('Setup') {
steps {
sh 'printenv'

script {

// is PR
if (env.CHANGE_ID) {
// This is safe because untrusted PRs will use Jenkinsfile from the target branch
if (env.GITHUB_COMMENT_AUTHOR) {
if (!AdminList.contains(env.GITHUB_COMMENT_AUTHOR)) {
currentBuild.result = 'ABORTED'
error 'This user does not have permission to trigger builds.'
}
else {
echo("Build was started by ${GITHUB_COMMENT_AUTHOR}, who wrote: \"${GITHUB_COMMENT}\", which matches the trigger pattern.")
}
}
else if (!AdminList.contains(env.CHANGE_AUTHOR)) {
currentBuild.result = 'ABORTED'
error 'This user does not have permission to trigger builds.'
}
}
}

cleanWs disableDeferredWipeout: true, deleteDirs: true
}
}
stage('Distributions') {
steps {
dynamicMatrix([
failFast: false,
axes: [
OS: OSList
],
actions: {
ws("${WORKSPACE}/${OS}") {

stage("${OS} Clone") {
checkout scm;
}

stage("${OS} Bootstrap") {
sh "GIT_BRANCH=${BRANCH_NAME} ./deploy/build.sh --os=bootstrap"

if (env.OS.endsWith("armhf")) {
sh "docker run --rm --privileged multiarch/qemu-user-static:register --reset"
}
}

stage("${OS} Test") {
sh "./deploy/build.sh --os=${OS} --test --eventport=\$((4100+\${EXECUTOR_NUMBER}))"

// TODO: Why does this hang on windows?
if (env.OS != "windows") {
archiveArtifacts artifacts: 'tests/**/*.log,tests/**/test-suite.tap,tests/**/core'
}
}
}
}
])
}
}
}
}

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Build Status](https://jenkins.mdsplus.org/buildStatus/icon?job=MDSplus%2Falpha)

## We want to know who you are
The MDSplus developers want to know who you are. If you or your site is using MDSplus please fill the following survey. We promise not to share your contact information. Do not assume that other's from your institution have also filled this out, we will combine the results.

Expand Down
4 changes: 3 additions & 1 deletion deploy/git_revision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
SRC=$(realpath "$(dirname "$0")/..")
GIT="git --git-dir=${SRC}/.git --work-tree=${SRC}"
GIT_TAG="$(${GIT} describe --tag)"
GIT_BRANCH="$(${GIT} rev-parse --abbrev-ref HEAD)"
if [ -z "${GIT_BRANCH}" ]; then
GIT_BRANCH="$(${GIT} rev-parse --abbrev-ref HEAD)"
fi
GIT_REMOTE="$(${GIT} config branch.${GIT_BRANCH}.remote)"
GIT_REMOTE_URL="$(${GIT} config remote.${GIT_REMOTE}.url)"
GIT_COMMIT="$(${GIT} rev-parse HEAD)"
Expand Down
3 changes: 2 additions & 1 deletion deploy/platform/bootstrap/bootstrap_build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
#
# runs $srcdir/bootstrap in a controlled manner
cid=/tmp/bootstrap-docker-cid
cid=$(mktemp -d)/bootstrap-docker-cid
cleanup() {
if [ -f $cid ]
then
docker rm -f $(cat $cid)
rm -f $cid
rmdir $(dirname $cid)
fi
}
trap cleanup EXIT INT
Expand Down
45 changes: 24 additions & 21 deletions deploy/platform/platform_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ rundocker() {
VALGRIND_TOOLS="$(spacedelim $VALGRIND_TOOLS)"
idx=0
if [ -z "$INTERACTIVE" ]; then
stdio="-a stdout -a stderr"
# stdio="-a stdout -a stderr"
stdio="--detach"
program="${DOCKER_SRCDIR}/deploy/platform/platform_docker_build.sh"
else
stdio="-i"
Expand Down Expand Up @@ -77,26 +78,32 @@ rundocker() {
port_forwarding="-p ${FORWARD_PORT}:${FORWARD_PORT}"
echo $port_forwarding
fi
if docker network >/dev/null 2>&1; then
#docker supports --network
if [ -z ${DOCKER_NETWORK} ]; then
docker network rm ${OS} || :
docker network create ${OS}
NETWORK=--network=${OS}
else
NETWORK=--network=${DOCKER_NETWORK}

function kill_docker() {
if [ -r ${WORKSPACE}/${OS}_docker-cid ]; then
docker kill $(cat ${WORKSPACE}/${OS}_docker-cid) || true
docker rm $(cat ${WORKSPACE}/${OS}_docker-cid) || true
rm -f ${WORKSPACE}/${OS}_docker-cid
fi
else
DOCKER_NETWORK=bridge
NETWORK=
fi
}

function abort() {
kill_docker
status=1
}

trap abort SIGINT

status=127
loop_count=0
while [ $status = 127 -a $loop_count -lt 5 ]; do
let loop_count=$loop_count+1

kill_docker

docker run --cap-add=SYS_PTRACE -t $stdio \
--rm \
--cidfile=${WORKSPACE}/${OS}_docker-cid \
${NETWORK} \
-u $(id -u):$(id -g) --privileged -h $DISTNAME -e "srcdir=${DOCKER_SRCDIR}" \
-e "ARCH=${arch}" \
-e "ARCHES=${ARCH}" \
Expand Down Expand Up @@ -131,15 +138,11 @@ rundocker() {
$(volume "${KEYS}" /sign_keys) \
${image} $program
status=$?
if [ -r ${WORKSPACE}/${OS}_docker-cid ]; then
sleep 3
docker rm $(cat ${WORKSPACE}/${OS}_docker-cid)
rm -f ${WORKSPACE}/${OS}_docker-cid

if [ -z "$INTERACTIVE" ]; then
docker logs -f $(cat ${WORKSPACE}/${OS}_docker-cid)
fi
done
if [ -z ${DOCKER_NETWORK} ]; then
docker network rm ${OS}
fi
if [ ! "$status" = "0" ]; then
RED
cat <<EOF >&2
Expand Down