pipline build v16 - more syntax
This commit is contained in:
parent
78e43fef81
commit
4b97435bc2
@ -1,38 +1,36 @@
|
|||||||
steps:
|
steps:
|
||||||
ssh-test: # name unchanged
|
ssh-test:
|
||||||
image: google/cloud-sdk:latest
|
image: google/cloud-sdk:latest
|
||||||
commands:
|
commands: |
|
||||||
- |
|
#!/usr/bin/env bash
|
||||||
#!/usr/bin/env bash
|
set -euo pipefail
|
||||||
|
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
|
||||||
|
# ── Fetch & install secrets from Secret Manager ─────────────
|
||||||
|
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 material ready"
|
||||||
|
|
||||||
|
# ── Tag comes from the commit that triggered Woodpecker ─────
|
||||||
|
TAG=$(echo "$CI_COMMIT_SHA" | head -c 8)
|
||||||
|
echo "🚀 Deploying tag ${TAG} to staging"
|
||||||
|
|
||||||
|
# ── SSH into the staging VM and re‑create the stack ─────────
|
||||||
|
ssh -o StrictHostKeyChecking=yes \
|
||||||
|
-i ~/.ssh/id_ed25519 \
|
||||||
|
jcoakley@10.128.0.12 <<'EOF'
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
cd /opt/aptiva-staging-app
|
||||||
mkdir -p ~/.ssh
|
echo "Pulling containers with IMG_TAG=${TAG}"
|
||||||
|
IMG_TAG=${TAG} docker compose pull
|
||||||
# ── Fetch & install secrets from Secret Manager ─────────────
|
echo "Recreating services"
|
||||||
gcloud secrets versions access latest \
|
IMG_TAG=${TAG} docker compose up -d --force-recreate --remove-orphans
|
||||||
--secret=STAGING_KNOWN_HOSTS --project=aptivaai-dev | base64 -d > ~/.ssh/known_hosts
|
echo "✅ Staging stack refreshed"
|
||||||
chmod 644 ~/.ssh/known_hosts
|
EOF
|
||||||
|
|
||||||
gcloud secrets versions access latest \
|
|
||||||
--secret=STAGING_SSH_KEY --project=aptivaai-dev | base64 -d > ~/.ssh/id_ed25519
|
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
|
||||||
|
|
||||||
echo "🔑 SSH material ready"
|
|
||||||
|
|
||||||
# ── Tag comes from the commit that triggered Woodpecker ─────
|
|
||||||
TAG=$(echo "$CI_COMMIT_SHA" | head -c 8)
|
|
||||||
echo "🚀 Deploying tag ${TAG} to staging"
|
|
||||||
|
|
||||||
# ── SSH into the staging VM and re‑create the stack ─────────
|
|
||||||
ssh -o StrictHostKeyChecking=yes \
|
|
||||||
-i ~/.ssh/id_ed25519 \
|
|
||||||
jcoakley@10.128.0.12 <<'EOF'
|
|
||||||
set -euo pipefail
|
|
||||||
cd /opt/aptiva-staging-app
|
|
||||||
echo "Pulling containers with IMG_TAG=${TAG}"
|
|
||||||
IMG_TAG=${TAG} docker compose pull
|
|
||||||
echo "Recreating services"
|
|
||||||
IMG_TAG=${TAG} docker compose up -d --force-recreate --remove-orphans
|
|
||||||
echo "✅ Staging stack refreshed"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user