blob: 8c25907cdfdf4e30145301648f3bbb5fd507dc96 [file] [log] [blame]
pipeline {
agent {
docker {
registryUrl 'https://ci.trafficserver.apache.org/'
image 'ci.trafficserver.apache.org/ats/rockylinux:8'
args '--init --cap-add=SYS_PTRACE --network=host -v "${HOME}"/ccache:/tmp/ccache:rw'
label 'branch'
}
}
environment {
CCACHE_DIR = "/tmp/ccache"
}
stages {
stage('Initialization') {
steps {
script {
if (! env.GITHUB_BRANCH) {
def bparts = env.JOB_NAME.split('/')
if (2 != bparts.length) {
error("Invalid branch name from ${JOB_NAME}")
}
env.GITHUB_BRANCH = bparts[0]
}
currentBuild.displayName = "#${BUILD_NUMBER} ${GITHUB_BRANCH}"
if (env.SHA1) {
currentBuild.description = env.SHA1
}
sh 'printenv'
}
}
}
stage('Clone') {
steps {
dir('ci') {
git url: 'https://github.com/apache/trafficserver-ci',
branch: 'main'
}
dir('src') {
script {
String branch = env.SHA1
if (! branch) {
branch = '*/' + env.GITHUB_BRANCH
}
timeout(time: 1, unit: 'MINUTES') {
retry(3) {
checkout([$class: 'GitSCM',
branches: [[name: branch]],
userRemoteConfigs: [[url: env.GITHUB_URL]],
extensions: [[$class: 'CloneOption', timeout: 10]]
])
}
}
}
}
}
}
stage('Build') {
steps {
dir('src') {
echo "Building"
sh '''
set -x
set -e
export PATH=/opt/bin:${PATH}
source ../ci/jenkins/bin/environment.sh
../ci/jenkins/bin/quiche.sh ${SSL_FLAVOR}
'''
}
}
}
stage('Tests') {
steps {
echo 'Starting Tests'
dir('src') {
sh '''
set -x
set -e
source ../ci/jenkins/bin/environment.sh
../ci/jenkins/bin/regression.sh
'''
}
echo 'Finished Tests'
}
}
stage('AuTest') {
steps {
echo 'Starting AuTest'
dir('src/build/tests') {
sh '''#!/bin/bash
#set +e
set -x
# We want to pick up the OpenSSL-QUIC version of curl in /opt/bin.
# The HTTP/3 AuTests depend upon this, so update the PATH accordingly.
export PATH=/opt/bin:${PATH}
export PATH=/opt/go/bin:${PATH}
export_dir="${WORKSPACE}/output/${GITHUB_BRANCH}"
mkdir -p ${export_dir}
pipenv install
./autest.sh --sandbox /tmp/sandbox || true
if [ -n "$(ls -A /tmp/sandbox/)" ]; then
touch ${export_dir}/Autest_failures
cp -rf /tmp/sandbox/ "${export_dir}"
ls "${export_dir}"
sudo chmod -R 777 ${WORKSPACE}
exit 1
else
touch ${export_dir}/No_autest_failures
sudo chmod -R 777 ${WORKSPACE}
exit 0
fi
'''
}
}
}
}
post {
always {
// We exclude socket files because archiveArtifacts doesn't deal well with
// their file type.
archiveArtifacts artifacts: 'output/**/*', fingerprint: false, allowEmptyArchive: true, excludes: '**/*.sock, **/cache.db'
}
cleanup {
cleanWs()
}
}
}