OP#253 add build stage rpm upload
This commit is contained in:
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@@ -90,25 +90,24 @@ pipeline {
|
|||||||
|
|
||||||
sh """
|
sh """
|
||||||
set -e
|
set -e
|
||||||
# download and extract
|
|
||||||
curl -fL -o prometheus.tar.gz "${downloadUrl}"
|
curl -fL -o prometheus.tar.gz "${downloadUrl}"
|
||||||
tar xzf prometheus.tar.gz
|
tar xzf prometheus.tar.gz
|
||||||
|
|
||||||
extractDir="prometheus-${version}.linux-amd64"
|
extractDir="prometheus-${version}.linux-amd64"
|
||||||
|
|
||||||
# prepare filesystem layout for fpm
|
# prepare build dir
|
||||||
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
|
||||||
|
|
||||||
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/
|
||||||
# prometheus.yml may not exist in all releases (it usually does). ignore failure.
|
|
||||||
cp "\${extractDir}/prometheus.yml" build/prometheus/etc/prometheus/ || true
|
cp "\${extractDir}/prometheus.yml" build/prometheus/etc/prometheus/ || true
|
||||||
cp -r "\${extractDir}/consoles" build/prometheus/usr/share/prometheus/ || true
|
cp -r "\${extractDir}/consoles" build/prometheus/usr/share/prometheus/ || true
|
||||||
cp -r "\${extractDir}/console_libraries" 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 """
|
sh """
|
||||||
fpm -s dir \
|
fpm -s dir \
|
||||||
-t rpm \
|
-t rpm \
|
||||||
@@ -121,17 +120,15 @@ pipeline {
|
|||||||
--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 \
|
||||||
-f
|
-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') {
|
stage('upload rpms') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([usernamePassword(
|
withCredentials([usernamePassword(
|
||||||
@@ -140,15 +137,17 @@ pipeline {
|
|||||||
passwordVariable: 'GITEA_TOKEN')]) {
|
passwordVariable: 'GITEA_TOKEN')]) {
|
||||||
script {
|
script {
|
||||||
sh '''
|
sh '''
|
||||||
|
for rpm in rpms/*.rpm; do
|
||||||
curl --user ${GITEA_USER}:${GITEA_TOKEN} \
|
curl --user ${GITEA_USER}:${GITEA_TOKEN} \
|
||||||
--upload-file keys/repository.key \
|
--upload-file keys/repository.key \
|
||||||
https://gitea.confdroid.com/api/packages/confdroid/rpm/upload
|
https://gitea.confdroid.com/api/packages/confdroid/rpm/upload
|
||||||
|
done
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
stage('update repo') {
|
stage('update repo') {
|
||||||
steps {
|
steps {
|
||||||
|
|||||||
Reference in New Issue
Block a user