3
0

OP#253 add build stage rpm upload

This commit is contained in:
12ww1160
2025-12-12 20:44:39 +01:00
parent 373611db5c
commit bb0a2dae30
2 changed files with 19 additions and 9 deletions

28
Jenkinsfile vendored
View File

@@ -85,8 +85,9 @@ pipeline {
echo "Building Prometheus ${version}"
def arch = "x86_64"
def rpmDir = "rpms/${arch}"
def downloadUrl = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-amd64.tar.gz"
echo "Downloading ${downloadUrl}"
sh """
set -e
@@ -95,10 +96,10 @@ pipeline {
extractDir="prometheus-${version}.linux-amd64"
# prepare build dir
# prepare layout
rm -rf build/prometheus
mkdir -p build/prometheus/usr/bin build/prometheus/etc/prometheus build/prometheus/usr/share/prometheus
mkdir -p rpms
mkdir -p "${rpmDir}"
cp "\${extractDir}/prometheus" build/prometheus/usr/bin/
cp "\${extractDir}/promtool" build/prometheus/usr/bin/
@@ -107,27 +108,37 @@ pipeline {
cp -r "\${extractDir}/console_libraries" build/prometheus/usr/share/prometheus/ || true
"""
// FPM -> RPM goes into rpms/
// Build RPM into rpms/x86_64/
def rpmPath = "${rpmDir}/prometheus-${version}.rpm"
sh """
fpm -s dir \
-t rpm \
-n prometheus \
--version ${version} \
--architecture x86_64 \
--architecture ${arch} \
--description 'Prometheus monitoring server and time series database' \
--url 'https://prometheus.io' \
--license 'Apache-2.0' \
--vendor 'Prometheus Team' \
--maintainer '12ww1160@confdroid.com' \
-C build/prometheus \
--package rpms/prometheus-${version}.rpm \
--package "${rpmPath}" \
-f
"""
sh "rm -rf build/prometheus prometheus.tar.gz prometheus-${version}.linux-amd64"
// Download and import the repo public key (optional but recommended)
sh """
curl -fL -o gitea-repo-public.key https://gitea.confdroid.com/api/packages/confdroid/rpm/repository.key
rpm --import gitea-repo-public.key || true
"""
// Cleanup
sh "rm -rf build/prometheus prometheus.tar.gz prometheus-${version}.linux-amd64 gitea-repo-public.key"
}
}
}
}
stage('upload rpms') {
steps {
@@ -148,7 +159,6 @@ pipeline {
}
}
stage('update repo') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {

Binary file not shown.