Skip to content
Snippets Groups Projects
Commit 683f5203 authored by Louis Maillard's avatar Louis Maillard
Browse files

packaging: rename platform to meet standard

Theses changes include using underscore instead of dash, to include the
full version name for ubuntu (24 => 24.04) and a refactor of Jenkins to
reduce duplications.

Change-Id: I45eada9d5078e7e973527141c743fe1736e87a1b
parent 3a8ec3d8
Branches
No related tags found
No related merge requests found
......@@ -84,12 +84,19 @@ pipeline {
}
}
stage('Build distributions') {
parallel {
stage('Ubuntu 22.04') {
matrix {
axes {
axis {
name 'TARGET'
values 'ubuntu_22.04', 'ubuntu_24.04', 'debian_12'/*, 'fedora_39', 'fedora_40', 'almalinux_9'*/
}
}
stages {
stage('Build') {
steps {
dir('extras/packaging') {
sh """
target="ubuntu-22"
target="${TARGET}"
mkdir -p "\$target"
docker build -t "dhtnet-builder:\$target" -f "gnu-linux/\$target.Dockerfile" --build-arg PKG_NAME="$FOLDER_NAME" .
docker run --rm \
......@@ -99,37 +106,40 @@ pipeline {
}
}
}
stage('Ubuntu 24.04') {
steps {
dir('extras/packaging') {
sh """
target="ubuntu-24"
mkdir -p "\$target"
docker build -t "dhtnet-builder:\$target" -f "gnu-linux/\$target.Dockerfile" --build-arg PKG_NAME="$FOLDER_NAME" .
docker run --rm \
-v "\$(pwd)/\$target/":/build/artifacts \
-e PKG_NAME="$FOLDER_NAME" "dhtnet-builder:\$target"
"""
}
}
}
stage('Debian 12') {
stage('Publish to dhtnet.sfl.io') {
steps {
dir('extras/packaging') {
sshagent(credentials: [JENKINS_SSH_KEY, DL_SSH_KEY]) {
sh """
target="debian-12"
mkdir -p "\$target"
docker build -t "dhtnet-builder:\$target" -f "gnu-linux/\$target.Dockerfile" --build-arg PKG_NAME="$FOLDER_NAME" .
docker run --rm \
-v "\$(pwd)/\$target/":/build/artifacts \
-e PKG_NAME="$FOLDER_NAME" "dhtnet-builder:\$target"
mkdir -p publish
cp -R --parents ubuntu_*/dhtnet_*.deb publish/
cp -R --parents debian_*/dhtnet_*.deb publish/
# cp -R --parents fedora_*/dhtnet-*.rpm publish/
# cp -R --parents almalinux_*/dhtnet-*.rpm publish/
rm -Rf publish/**/*debug*
rm -Rf publish/**/*.src.*
if [ -f "\${SSH_IDENTITY_FILE}" ]; then
export RSYNC_RSH="ssh -i \${SSH_IDENTITY_FILE}"
fi
echo "##########################"
echo "## deploying repository ##"
echo "##########################"
echo "Using RSYNC_RSH='\${RSYNC_RSH}'"
rsync --archive --recursive --verbose \
--delete publish/ \
"${REMOTE_HOST}:/srv/repository/dhtnet/$PUBLISH_CHANNEL"
"""
}
}
}
}
}
}
post {
success {
dir('extras/packaging') {
......
#!/bin/bash
set -e
# move pwd to the directory of this script (extras/packaging)
cd "$(dirname "$0")" || exit 1
PKG_NAME=dhtnet
PKG_VERSION="$(head -1 extras/packaging/build.version | grep -o '^[0-9\.]\+$' -)"
PKG_VERSION="$(head -1 build.version | grep -o '^[0-9\.]\+$' -)"
FOLDER_NAME="${PKG_NAME}-${PKG_VERSION}"
# move pwd to the directory of this script (extras/packaging)
cd "$(dirname "$0")" || exit 1
rm -Rf "${FOLDER_NAME}"
rm -f -- *${PKG_NAME}-${PKG_VERSION}.tar.gz
......@@ -20,9 +21,9 @@ rm -Rf "../../dependencies/restinio"
(cd ../.. && git submodule update --init --recursive)
build_ubuntu=false
build_ubuntu20=false
build_ubuntu22=false
build_ubuntu24=false
build_ubuntu20_04=false
build_ubuntu22_04=false
build_ubuntu24_04=false
build_debian=false
build_debian10=false
build_debian11=false
......@@ -32,17 +33,17 @@ parse_args() {
while [ "$1" != "" ]; do
case $1 in
-u | --ubuntu ) build_ubuntu=true
build_ubuntu20=true
build_ubuntu22=true
build_ubuntu24=true
build_ubuntu20_04=true
build_ubuntu22_04=true
build_ubuntu24_04=true
;;
-u20 | --ubuntu20 ) build_ubuntu20=true
-u20 | -u20.04 | --ubuntu20.04 ) build_ubuntu20_04=true
build_ubuntu=true
;;
-u22 | --ubuntu22 ) build_ubuntu22=true
-u22 | -u22.04 | --ubuntu22.04 ) build_ubuntu22_04=true
build_ubuntu=true
;;
-u24 | --ubuntu24 ) build_ubuntu24=true
-u24 | -u24.04 | --ubuntu24.04 ) build_ubuntu24_04=true
build_ubuntu=true
;;
-d | --debian ) build_debian=true
......@@ -61,8 +62,8 @@ parse_args() {
;;
-a | --all ) build_ubuntu=true
# not working: build_ubuntu20=true
build_ubuntu22=true
build_ubuntu24=true
build_ubuntu22_04=true
build_ubuntu24_04=true
build_debian=true
# not working: build_debian10=true
# not working: build_debian11=true
......@@ -127,29 +128,29 @@ build_target() {
}
# build Ubuntu package (deb-*)
if [ "$build_ubuntu24" == true ]; then
build_target "ubuntu-24"
if [ "$build_ubuntu24_04" == true ]; then
build_target "ubuntu_24.04"
fi
if [ "$build_ubuntu22" == true ]; then
build_target "ubuntu-22"
if [ "$build_ubuntu22_04" == true ]; then
build_target "ubuntu_22.04"
fi
if [ "$build_ubuntu20" == true ]; then
build_target "ubuntu-20"
if [ "$build_ubuntu20_04" == true ]; then
build_target "ubuntu_20.04"
fi
# build Debian package (deb-*)
if [ "$build_debian12" == true ]; then
build_target "debian-12"
build_target "debian_12"
fi
if [ "$build_debian11" == true ]; then
build_target "debian-11"
build_target "debian_11"
fi
if [ "$build_debian10" == true ]; then
build_target "debian-10"
build_target "debian_10"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment