diff --git a/Jenkinsfile b/Jenkinsfile index f02f3d9..d30f306 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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']) { diff --git a/prometheus-3.8.0-1.x86_64.rpm b/prometheus-3.8.0-1.x86_64.rpm new file mode 100644 index 0000000..98badd1 Binary files /dev/null and b/prometheus-3.8.0-1.x86_64.rpm differ