Commit 4fc454ba authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Fix deploy_prod: PROD_SSH_PRIVATE_KEY is Variable-type, not File-type

Confirmed from the job log - chmod failed with "unrecognized option
'-----BEGIN OPENSSH PRIVATE KEY-----" because $PROD_SSH_PRIVATE_KEY expands
to the raw key text, not a file path (which File-type CI/CD variables give
you). Writing it to ~/.ssh/prod_deploy_key ourselves works regardless of
which type the variable actually is, so this doesn't depend on getting that
GitLab dropdown exactly right.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent 6e2863e9
Pipeline #1021 canceled with stages
in 17 minutes and 21 seconds
......@@ -52,16 +52,20 @@ deploy_prod:
STAX_DEPLOY_DIR: "/root/stax_backend_api"
before_script:
- apt-get update -qq && apt-get install -y -qq --no-install-recommends openssh-client
- chmod 600 "$PROD_SSH_PRIVATE_KEY"
- mkdir -p ~/.ssh
# PROD_SSH_PRIVATE_KEY is a "Variable"-type CI/CD var (raw key text), not "File"-type
# (which would give us a path) - write it out ourselves so this doesn't depend on that
# GitLab dropdown being set exactly right.
- echo "$PROD_SSH_PRIVATE_KEY" > ~/.ssh/prod_deploy_key
- chmod 600 ~/.ssh/prod_deploy_key
- ssh-keyscan -p "${PROD_SSH_PORT:-22}" "$PROD_SERVER_IP" >> ~/.ssh/known_hosts 2>/dev/null || true
script:
- echo "Deploying $CI_COMMIT_SHORT_SHA to production..."
- >
scp -o StrictHostKeyChecking=accept-new -i "$PROD_SSH_PRIVATE_KEY" -P "${PROD_SSH_PORT:-22}"
scp -o StrictHostKeyChecking=accept-new -i ~/.ssh/prod_deploy_key -P "${PROD_SSH_PORT:-22}"
deploy/scripts/deploy.sh root@"$PROD_SERVER_IP":/root/stax_deploy_bootstrap.sh
- >
ssh -o StrictHostKeyChecking=accept-new -i "$PROD_SSH_PRIVATE_KEY" -p "${PROD_SSH_PORT:-22}"
ssh -o StrictHostKeyChecking=accept-new -i ~/.ssh/prod_deploy_key -p "${PROD_SSH_PORT:-22}"
root@"$PROD_SERVER_IP"
"STAX_DEPLOY_DIR='${STAX_DEPLOY_DIR}'
STAX_PROD_JWT_SECRET='${STAX_PROD_JWT_SECRET}'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment