dev1/.woodpecker.yml
Josh b284b18df8
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
pipline build v50. Injecting JWT_SECRET
2025-07-31 17:26:56 +00:00

54 lines
1.9 KiB
YAML

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