From 373611db5c306412fb48a4feca8d96d91163c200 Mon Sep 17 00:00:00 2001 From: 12ww1160 Date: Fri, 12 Dec 2025 19:15:33 +0100 Subject: [PATCH] OP#253 add build stage rpm upload --- Jenkinsfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 16e2bfe..f02f3d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -90,25 +90,24 @@ pipeline { sh """ set -e - # download and extract curl -fL -o prometheus.tar.gz "${downloadUrl}" tar xzf prometheus.tar.gz extractDir="prometheus-${version}.linux-amd64" - # prepare filesystem layout for fpm + # prepare build dir rm -rf build/prometheus mkdir -p build/prometheus/usr/bin build/prometheus/etc/prometheus build/prometheus/usr/share/prometheus + mkdir -p rpms cp "\${extractDir}/prometheus" build/prometheus/usr/bin/ cp "\${extractDir}/promtool" build/prometheus/usr/bin/ - # prometheus.yml may not exist in all releases (it usually does). ignore failure. cp "\${extractDir}/prometheus.yml" build/prometheus/etc/prometheus/ || true cp -r "\${extractDir}/consoles" build/prometheus/usr/share/prometheus/ || true cp -r "\${extractDir}/console_libraries" build/prometheus/usr/share/prometheus/ || true """ - // run fpm (note: ${version} is interpolated by Groovy into the shell) + // FPM -> RPM goes into rpms/ sh """ fpm -s dir \ -t rpm \ @@ -121,17 +120,15 @@ pipeline { --vendor 'Prometheus Team' \ --maintainer '12ww1160@confdroid.com' \ -C build/prometheus \ + --package rpms/prometheus-${version}.rpm \ -f """ - // list directory - sh "ls -alh" - // cleanup - sh "rm -rf build/prometheus prometheus.tar.gz prometheus-${version}.linux-amd64" - } - } - } -/* + sh "rm -rf build/prometheus prometheus.tar.gz prometheus-${version}.linux-amd64" + } + } + } + stage('upload rpms') { steps { withCredentials([usernamePassword( @@ -140,15 +137,17 @@ pipeline { passwordVariable: 'GITEA_TOKEN')]) { script { sh ''' + for rpm in rpms/*.rpm; do curl --user ${GITEA_USER}:${GITEA_TOKEN} \ --upload-file keys/repository.key \ https://gitea.confdroid.com/api/packages/confdroid/rpm/upload + done ''' } } } } -*/ + stage('update repo') { steps {