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