fix(ops): reconcile CI backend wrapper and gate locked dependency image before swap
Deploy Backend / deploy (push) Successful in 1m17s
Deploy Backend / deploy (push) Successful in 1m17s
This commit is contained in:
1 parent
c2960c4ed0
commit
3fb1e417c6
5 files changed
+108
-2
No files matched your search
@@ -24,5 +24,25 @@ jobs:
|
||||
echo "$SSH_KEY" > ~/.ssh/id_ed25519
|
||||
chmod 600 ~/.ssh/id_ed25519
|
||||
ssh-keyscan -p 2234 -H 172.17.0.1 >> ~/.ssh/known_hosts
|
||||
- name: Deploy
|
||||
run: ssh -p 2234 devops@172.17.0.1 'bash /opt/services/parsa/backend/deploy.sh'
|
||||
- name: Reconcile reviewed deployment wrapper and deploy
|
||||
env:
|
||||
RELEASE_SHA: ${{ gitea.sha }}
|
||||
run: |
|
||||
case "$RELEASE_SHA" in ''|*[!0-9a-f]*) exit 1;; esac
|
||||
test "${#RELEASE_SHA}" = 40
|
||||
ssh -p 2234 devops@172.17.0.1 "bash -s -- $RELEASE_SHA" <<'REMOTE'
|
||||
set -euo pipefail
|
||||
expected=$1
|
||||
cd /opt/services/parsa/backend/repo
|
||||
test -z "$(git status --porcelain --untracked-files=normal)"
|
||||
export GIT_SSH_COMMAND='ssh -i /home/devops/.ssh/deploy_key -o StrictHostKeyChecking=no'
|
||||
git fetch origin main
|
||||
test "$(git rev-parse origin/main)" = "$expected"
|
||||
git merge --ff-only "$expected"
|
||||
test "$(git rev-parse HEAD)" = "$expected"
|
||||
python3 tests/deploy_fixture.py
|
||||
bash -n ops/deploy-backend.sh
|
||||
# CI owns the host wrapper; never execute the old untracked implementation.
|
||||
sudo install -m 0755 ops/deploy-backend.sh /opt/services/parsa/backend/deploy.sh
|
||||
bash /opt/services/parsa/backend/deploy.sh "$expected"
|
||||
REMOTE
|
||||
Reference in new issue
Block a user