pipline build v23 - TAG logging
This commit is contained in:
parent
5147926a7f
commit
c1117bf6be
@ -9,13 +9,12 @@ steps:
|
|||||||
|
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
|
|
||||||
# ── Install known-hosts from Secret Manager ────────────────
|
# ── Secrets for SSH ────────────────────────────────────────
|
||||||
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
|
||||||
|
|
||||||
# ── Install private key ───────────────────────────────────
|
|
||||||
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
|
||||||
@ -23,15 +22,21 @@ steps:
|
|||||||
|
|
||||||
echo "🔑 SSH prerequisites installed"
|
echo "🔑 SSH prerequisites installed"
|
||||||
|
|
||||||
# ── Resolve tag from commit SHA ───────────────────────────
|
# ── Log what the CI knows ──────────────────────────────────
|
||||||
TAG=$(echo "${CI_COMMIT_SHA:-$CI_COMMIT:-$DRONE_COMMIT_SHA}" | head -c 8)
|
echo "🔍 CI_COMMIT_SHA: ${CI_COMMIT_SHA:-unset}"
|
||||||
if [ -z "$TAG" ]; then
|
echo "🔍 CI_COMMIT: ${CI_COMMIT:-unset}"
|
||||||
echo "❌ No valid commit SHA found. Aborting."
|
echo "🔍 DRONE_COMMIT_SHA: ${DRONE_COMMIT_SHA:-unset}"
|
||||||
|
|
||||||
|
# ── Resolve tag safely ─────────────────────────────────────
|
||||||
|
RAW_SHA="${CI_COMMIT_SHA:-${CI_COMMIT:-${DRONE_COMMIT_SHA:-}}}"
|
||||||
|
if [ -z "$RAW_SHA" ]; then
|
||||||
|
echo "❌ CI commit SHA not found. Aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
TAG=$(echo "$RAW_SHA" | head -c 8)
|
||||||
echo "🚀 Deploying tag ${TAG} to staging"
|
echo "🚀 Deploying tag ${TAG} to staging"
|
||||||
|
|
||||||
# ── SSH into staging and refresh stack ─────────────────────
|
# ── SSH into staging and refresh ───────────────────────────
|
||||||
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 \
|
||||||
@ -44,9 +49,9 @@ steps:
|
|||||||
echo '✅ Staging stack refreshed with tag ${IMG_TAG}'"
|
echo '✅ Staging stack refreshed with tag ${IMG_TAG}'"
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- CI_COMMIT_SHA
|
CI_COMMIT_SHA: ${CI_COMMIT_SHA}
|
||||||
- CI_COMMIT
|
CI_COMMIT: ${CI_COMMIT}
|
||||||
- DRONE_COMMIT_SHA
|
DRONE_COMMIT_SHA: ${DRONE_COMMIT_SHA}
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
|
Loading…
Reference in New Issue
Block a user