pipeline { agent { label 'assignment8-trusted' } options { disableConcurrentBuilds(); timeout(time: 20, unit: 'MINUTES'); timestamps() } stages { stage('Restore reviewed staging configuration') { steps { deleteDir() git url: 'https://myfileagent.tech/myfileagent/myfileagent-pipeline.git', branch: 'main' sh '''set -eu git checkout --detach ee128d18bddd1763b916b40f05829f2e769f0654 test "$(git rev-parse HEAD)" = ee128d18bddd1763b916b40f05829f2e769f0654 mkdir -p reports cat > reports/staging.yml <<'EOF' target_env: staging release_image: myfileagent.tech/myfileagent/pricing@sha256:2ab86894ada4c12bd066ae1d29be40a296b1a037f379c494dead5cad4d8b88f9 expected_version: v2 expected_commit: ee128d18bddd1763b916b40f05829f2e769f0654 configuration_commit: ee128d18bddd1763b916b40f05829f2e769f0654 expected_total: 36 public_url: https://staging.myfileagent.tech proxy_network: myfileagent-gitea_gitea-private EOF date -u +%FT%TZ > reports/recovery-start.txt ''' withCredentials([sshUserPrivateKey(credentialsId: 'assignment8-deploy-ssh', keyFileVariable: 'DEPLOY_KEY')]) { sh '''#!/bin/sh set +x set -eu export ANSIBLE_SSH_ARGS="-o StrictHostKeyChecking=yes -o UserKnownHostsFile=$WORKSPACE/secure-delivery/ansible/known_hosts" ansible-playbook -i secure-delivery/ansible/inventory.ini secure-delivery/ansible/deploy.yml --private-key "$DEPLOY_KEY" -e @reports/staging.yml > reports/recovery-ansible.txt 2>&1 date -u +%FT%TZ > reports/recovery-verified.txt curl -fsS https://staging.myfileagent.tech/health > reports/health.json curl -fsS https://staging.myfileagent.tech/ > reports/identity.json curl -fsS 'https://staging.myfileagent.tech/price?quantity=3' > reports/price.json ''' } } } } post { always { archiveArtifacts artifacts: 'reports/*', allowEmptyArchive: true } } }