forked from espos/base-files
Refactor Publish Repository stage in Jenkinsfile to include GPG passphrase handling and improve snapshot management
This commit is contained in:
Vendored
+25
-5
@@ -56,12 +56,31 @@ pipeline {
|
|||||||
stage("Publish Repository") {
|
stage("Publish Repository") {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['srv01_elordenador_org']) {
|
sshagent(['srv01_elordenador_org']) {
|
||||||
|
|
||||||
|
withCredentials([
|
||||||
|
string(
|
||||||
|
credentialsId: 'aptly_gpg_pass',
|
||||||
|
variable: 'GPG_PASS'
|
||||||
|
)
|
||||||
|
]) {
|
||||||
|
|
||||||
sh '''
|
sh '''
|
||||||
ssh ${APTLY_HOST} << 'EOF'
|
ssh ${APTLY_HOST} << EOF
|
||||||
SNAPSHOT="espos-build-${BUILD_NUMBER}"
|
|
||||||
aptly snapshot create $SNAPSHOT from repo espos-unstable
|
aptly repo add espos-unstable /tmp/*.deb
|
||||||
aptly repo add ${APTLY_REPO} /tmp/*.deb
|
|
||||||
aptly publish switch ${APTLY_REPO} $SNAPSHOT
|
if aptly publish list | grep -q espos-unstable
|
||||||
|
then
|
||||||
|
aptly publish switch \
|
||||||
|
-passphrase="$GPG_PASS" \
|
||||||
|
espos-unstable
|
||||||
|
else
|
||||||
|
aptly publish repo \
|
||||||
|
-distribution=espos-unstable \
|
||||||
|
-component=main \
|
||||||
|
-passphrase="$GPG_PASS" \
|
||||||
|
espos-unstable
|
||||||
|
fi
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
'''
|
'''
|
||||||
@@ -69,6 +88,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
echo "Paquete publicado correctamente"
|
echo "Paquete publicado correctamente"
|
||||||
|
|||||||
Reference in New Issue
Block a user