OP#253 add build stage rpm upload
This commit is contained in:
25
Jenkinsfile
vendored
25
Jenkinsfile
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user