Refactor Publish Repository stage in Jenkinsfile to include GPG passphrase handling and improve snapshot management

This commit is contained in:
2026-07-16 11:31:31 +02:00
parent 47adf935b8
commit ba57144570
Vendored
+28 -8
View File
@@ -56,15 +56,35 @@ pipeline {
stage("Publish Repository") {
steps {
sshagent(['srv01_elordenador_org']) {
sh '''
ssh ${APTLY_HOST} << 'EOF'
SNAPSHOT="espos-build-${BUILD_NUMBER}"
aptly snapshot create $SNAPSHOT from repo espos-unstable
aptly repo add ${APTLY_REPO} /tmp/*.deb
aptly publish switch ${APTLY_REPO} $SNAPSHOT
EOF
'''
withCredentials([
string(
credentialsId: 'aptly_gpg_pass',
variable: 'GPG_PASS'
)
]) {
sh '''
ssh ${APTLY_HOST} << EOF
aptly repo add espos-unstable /tmp/*.deb
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
'''
}
}
}
}