Files
vpn-dns-gateway/delivery/bootstrap/preflight.Jenkinsfile
T
vsun1 5b703edc79
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Fix noninteractive Ansible deployment and record delivery gates
2026-11-15 18:07:48 -05:00

43 lines
1.8 KiB
Plaintext

// Administrator preparation only: no checkout, image publication or deployment.
pipeline {
agent { label 'delivery-trusted' }
options { disableConcurrentBuilds(); timeout(time: 5, unit: 'MINUTES') }
stages {
stage('Tool and target prerequisites') {
steps {
withCredentials([
sshUserPrivateKey(credentialsId: 'delivery-deploy-ssh', keyFileVariable: 'DEPLOY_KEY'),
file(credentialsId: 'delivery-known-hosts', variable: 'DEPLOY_KNOWN_HOSTS')
]) {
sh '''set -eu
set +x
mkdir -p build/preflight
{
date -u
id
python3 --version
ansible --version
ansible-galaxy collection list
docker --version
docker compose version
trivy --version
pip-audit --version
ssh -i "$DEPLOY_KEY" -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$DEPLOY_KNOWN_HOSTS" deploy@147.182.178.136 'id; sudo -n true; python3 --version; sudo -n docker --version; sudo -n docker compose version; free -m; nproc; df -h /'
# Exercise Ansible's own SSH/become path as well as plain SSH. Its default
# PTY request is incompatible with the intentionally restricted deploy key.
export ANSIBLE_HOST_KEY_CHECKING=True
export ANSIBLE_PRIVATE_KEY_FILE="$DEPLOY_KEY"
export ANSIBLE_SSH_ARGS="-o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$DEPLOY_KNOWN_HOSTS"
ansible all -i '147.182.178.136,' -u deploy --become \
-e '{"ansible_ssh_use_tty":false,"ansible_python_interpreter":"/usr/bin/python3"}' \
-m ansible.builtin.command -a 'id -u'
} > build/preflight/tools-and-target.txt
cat build/preflight/tools-and-target.txt
'''
}
}
}
}
post { always { archiveArtifacts(artifacts: 'build/preflight/**', allowEmptyArchive: true) } }
}