OP#253 add build stage prometheus rpm
This commit is contained in:
44
Jenkinsfile
vendored
44
Jenkinsfile
vendored
@@ -9,6 +9,7 @@ pipeline {
|
||||
post {
|
||||
always {
|
||||
deleteDir() /* clean up our workspace */
|
||||
sh 'rm -rf build/ repo/ *.tar.gz *.rpm prometheus.repo'
|
||||
}
|
||||
success {
|
||||
updateGitlabCommitStatus state: 'success'
|
||||
@@ -73,6 +74,49 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Prometheus RPM') {
|
||||
steps {
|
||||
script {
|
||||
def version = sh(
|
||||
script: 'curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep \'"tag_name":\' | sed -E \'s/.*\\"([^\\"]+)\\".*/\\\\1/\' | sed \'s/v//\'',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
echo "Building Prometheus ${version}"
|
||||
|
||||
def downloadUrl = "https://github.com/prometheus/prometheus/releases/download/v${version}/prometheus-${version}.linux-amd64.tar.gz"
|
||||
sh "curl -L -o prometheus.tar.gz ${downloadUrl}"
|
||||
sh 'tar xzf prometheus.tar.gz'
|
||||
def extractDir = "prometheus-${version}.linux-amd64"
|
||||
|
||||
// Prepare build directory structure
|
||||
sh """
|
||||
mkdir -p build/prometheus/usr/bin build/prometheus/etc/prometheus build/prometheus/usr/share/prometheus
|
||||
cp ${extractDir}/prometheus build/prometheus/usr/bin/
|
||||
cp ${extractDir}/promtool build/prometheus/usr/bin/
|
||||
cp ${extractDir}/prometheus.yml build/prometheus/etc/prometheus/
|
||||
cp -r ${extractDir}/consoles build/prometheus/usr/share/prometheus/
|
||||
cp -r ${extractDir}/console_libraries build/prometheus/usr/share/prometheus/
|
||||
"""
|
||||
|
||||
sh """
|
||||
fpm -s dir \\
|
||||
-t rpm \\
|
||||
-n prometheus \\
|
||||
--version \${version} \\
|
||||
--architecture x86_64 \\
|
||||
--description 'Prometheus monitoring server and time series database' \\
|
||||
--url 'https://prometheus.io' \\
|
||||
--license 'Apache-2.0' \\
|
||||
--vendor 'Prometheus Team' \\
|
||||
--maintainer 'your-email@example.com' \\
|
||||
-C build/prometheus \\
|
||||
-f
|
||||
"""
|
||||
sh 'rm -rf build/prometheus prometheus.tar.gz ${extractDir}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('update repo') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
|
||||
Reference in New Issue
Block a user