Skip to content
Snippets Groups Projects
Commit 4a478c40 authored by Simon McVittie's avatar Simon McVittie
Browse files

ci: Add support for additional apt sources


In addition to standard sources.list(5) syntax, this supports a shorthand
"both ..." for adding similar "deb ..." and "deb-src ..." lines.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 5cefcdba
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,10 @@ pipeline {
env.CI_APT_SOURCES_FILE = ''
}
if (!env.CI_EXTRA_APT_SOURCES) {
env.CI_EXTRA_APT_SOURCES = ''
}
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "origin/${env.CI_PRESSURE_VESSEL_GIT_BRANCH}"]],
......@@ -94,14 +98,26 @@ pipeline {
'''
}
sh """
sed -e 's!@BASE_IMAGE@!${env.CI_DOCKER_REGISTRY}/${env.CI_DOCKER_IMAGE}!g' < src/ci/Dockerfile.in > src/ci/Dockerfile
if [ -n "${env.CI_APT_SOURCES_FILE}" ]; then
cp "${env.CI_APT_SOURCES_FILE}" src/ci/sources.list
sh '''
set -eu
sed -e 's!@BASE_IMAGE@!'"${CI_DOCKER_REGISTRY}/${CI_DOCKER_IMAGE}"'!g' < src/ci/Dockerfile.in > src/ci/Dockerfile
if [ -n "${CI_APT_SOURCES_FILE}" ]; then
cp "${CI_APT_SOURCES_FILE}" src/ci/sources.list
else
touch src/ci/sources.list
fi
"""
echo "${CI_EXTRA_APT_SOURCES}" | while read -r first rest; do
if [ "x$first" = xboth ]; then
echo "deb $rest" >> src/ci/sources.list
echo "deb-src $rest" >> src/ci/sources.list
else
echo "$first $rest" >> src/ci/sources.list
fi
done
'''
script {
docker.withRegistry("https://${env.CI_DOCKER_REGISTRY}", dockerRegistryCred) {
......
......@@ -58,6 +58,18 @@ build:scout:
if [ -n "${SCOUT_APT_SOURCES_FILE}" ]; then
cp "${SCOUT_APT_SOURCES_FILE}" /etc/apt/sources.list
if [ -n "${CI_EXTRA_APT_SOURCES-}" ]; then
echo "${CI_EXTRA_APT_SOURCES}" | while read -r first rest; do
if [ "x$first" = xboth ]; then
echo "deb $rest" >> /etc/apt/sources.list
echo "deb-src $rest" >> /etc/apt/sources.list
else
echo "$first $rest" >> /etc/apt/sources.list
fi
done
fi
apt-get -y update
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment