Add Jenkins pipeline for building and publishing Debian packages
This commit is contained in:
Vendored
+79
@@ -0,0 +1,79 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
PACKAGE_NAME = "base-files"
|
||||||
|
APTLY_REPO = "espos-unstable"
|
||||||
|
|
||||||
|
APTLY_HOST = "ubuntu@elordenador.org"
|
||||||
|
|
||||||
|
DEB_FILE = "*.deb"
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Install Build Dependencies') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y build-essential devscripts debhelper lintian
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Build Debian Package") {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
dpkg-buildpackage -us -uc
|
||||||
|
ls -lah ..
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage("Lintian Check") {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
lintian ../*.deb || true
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("Upload to aptly") {
|
||||||
|
steps {
|
||||||
|
sshagent(['srv01_elordenador_org']) {
|
||||||
|
|
||||||
|
sh '''
|
||||||
|
scp ../${DEB_FILE} \
|
||||||
|
${APTLY_HOST}:/tmp/
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage("Publish Repository") {
|
||||||
|
steps {
|
||||||
|
sshagent(['srv01_elordenador_org']) {
|
||||||
|
sh '''
|
||||||
|
ssh ${APTLY_HOST} << EOF
|
||||||
|
|
||||||
|
aptly repo add ${APTLY_REPO} /tmp/*.deb
|
||||||
|
aptly publish switch ${APTLY_REPO}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
success {
|
||||||
|
echo "Paquete publicado correctamente"
|
||||||
|
}
|
||||||
|
failure {
|
||||||
|
echo "Error construyendo paquete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user