OP#253 add build stage rpm upload
This commit is contained in:
28
Jenkinsfile
vendored
28
Jenkinsfile
vendored
@@ -85,8 +85,9 @@ pipeline {
|
|||||||
|
|
||||||
echo "Building Prometheus ${version}"
|
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"
|
def downloadUrl = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-amd64.tar.gz"
|
||||||
echo "Downloading ${downloadUrl}"
|
|
||||||
|
|
||||||
sh """
|
sh """
|
||||||
set -e
|
set -e
|
||||||
@@ -95,10 +96,10 @@ pipeline {
|
|||||||
|
|
||||||
extractDir="prometheus-${version}.linux-amd64"
|
extractDir="prometheus-${version}.linux-amd64"
|
||||||
|
|
||||||
# prepare build dir
|
# prepare layout
|
||||||
rm -rf build/prometheus
|
rm -rf build/prometheus
|
||||||
mkdir -p build/prometheus/usr/bin build/prometheus/etc/prometheus build/prometheus/usr/share/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}/prometheus" build/prometheus/usr/bin/
|
||||||
cp "\${extractDir}/promtool" 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
|
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 """
|
sh """
|
||||||
fpm -s dir \
|
fpm -s dir \
|
||||||
-t rpm \
|
-t rpm \
|
||||||
-n prometheus \
|
-n prometheus \
|
||||||
--version ${version} \
|
--version ${version} \
|
||||||
--architecture x86_64 \
|
--architecture ${arch} \
|
||||||
--description 'Prometheus monitoring server and time series database' \
|
--description 'Prometheus monitoring server and time series database' \
|
||||||
--url 'https://prometheus.io' \
|
--url 'https://prometheus.io' \
|
||||||
--license 'Apache-2.0' \
|
--license 'Apache-2.0' \
|
||||||
--vendor 'Prometheus Team' \
|
--vendor 'Prometheus Team' \
|
||||||
--maintainer '12ww1160@confdroid.com' \
|
--maintainer '12ww1160@confdroid.com' \
|
||||||
-C build/prometheus \
|
-C build/prometheus \
|
||||||
--package rpms/prometheus-${version}.rpm \
|
--package "${rpmPath}" \
|
||||||
-f
|
-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') {
|
stage('upload rpms') {
|
||||||
steps {
|
steps {
|
||||||
@@ -148,7 +159,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
stage('update repo') {
|
stage('update repo') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
|
|||||||
BIN
prometheus-3.8.0-1.x86_64.rpm
Normal file
BIN
prometheus-3.8.0-1.x86_64.rpm
Normal file
Binary file not shown.
Reference in New Issue
Block a user