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
+29
-9
@@ -56,18 +56,38 @@ 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
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
|
||||
Reference in New Issue
Block a user