pipeline build v28 - steps readded

This commit is contained in:
Josh 2025-07-31 15:59:21 +00:00
parent 34106cca95
commit 3e724c0967

View File

@ -1,47 +1,47 @@
- name: ssh-test steps:
image: google/cloud-sdk:latest - name: ssh-test
entrypoint: image: google/cloud-sdk:latest
- bash entrypoint:
- -c - bash
- | - -c
set -euo pipefail - |
set -euo pipefail
mkdir -p ~/.ssh mkdir -p ~/.ssh
# ── Inject known-hosts and SSH key ─────────────────────────────── # ── Inject known-hosts and SSH key ───────────────────────────────
gcloud secrets versions access latest \ gcloud secrets versions access latest \
--secret=STAGING_KNOWN_HOSTS --project=aptivaai-dev \ --secret=STAGING_KNOWN_HOSTS --project=aptivaai-dev \
| base64 -d > ~/.ssh/known_hosts | base64 -d > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts
gcloud secrets versions access latest \ gcloud secrets versions access latest \
--secret=STAGING_SSH_KEY --project=aptivaai-dev \ --secret=STAGING_SSH_KEY --project=aptivaai-dev \
| base64 -d > ~/.ssh/id_ed25519 | base64 -d > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
echo "🔑 SSH prerequisites installed" echo "🔑 SSH prerequisites installed"
# ── Fetch canonical IMG_TAG ────────────────────────────────────── # ── Fetch canonical IMG_TAG ──────────────────────────────────────
IMG_TAG=$(gcloud secrets versions access latest \ IMG_TAG=$(gcloud secrets versions access latest \
--secret=IMG_TAG --project=aptivaai-dev) --secret=IMG_TAG --project=aptivaai-dev)
echo "📦 IMG_TAG=${IMG_TAG}" echo "📦 IMG_TAG=${IMG_TAG}"
# ── SSH into staging and deploy ────────────────────────────────── # ── SSH into staging and deploy ──────────────────────────────────
ssh -o StrictHostKeyChecking=yes \ ssh -o StrictHostKeyChecking=yes \
-i ~/.ssh/id_ed25519 \ -i ~/.ssh/id_ed25519 \
jcoakley@10.128.0.12 \ jcoakley@10.128.0.12 \
"export IMG_TAG=${IMG_TAG}; \ "export IMG_TAG=${IMG_TAG}; \
cd /home/jcoakley/aptiva-staging-app; \ cd /home/jcoakley/aptiva-staging-app; \
echo 'IMG_TAG = ${IMG_TAG}'; \ echo 'IMG_TAG = ${IMG_TAG}'; \
docker compose pull; \ sudo --preserve-env=IMG_TAG docker compose pull; \
docker compose up -d --force-recreate --remove-orphans; \ sudo --preserve-env=IMG_TAG docker compose up -d --force-recreate --remove-orphans; \
echo '✅ Staging stack refreshed with tag ${IMG_TAG}'" echo '✅ Staging stack refreshed with tag ${IMG_TAG}'"
secrets: secrets:
- STAGING_SSH_KEY - STAGING_SSH_KEY
- STAGING_KNOWN_HOSTS - STAGING_KNOWN_HOSTS
when:
when: event:
event: - push
- push