pipeine build v40. Last know working version
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Josh 2025-07-31 16:59:19 +00:00
parent e0b6b75630
commit f7847f8c38

View File

@ -3,36 +3,8 @@ kind: pipeline
type: docker
name: build-and-deploy
workspace:
base: /woodpecker
path: src
clone:
depth: 50
volumes:
- name: docker-sock
host:
path: /var/run/docker.sock
steps:
- name: build-and-push
image: docker:24.0-cli
privileged: true
volumes:
- name: docker-sock
path: /var/run/docker.sock
commands:
- set -eu
- REG=us-central1-docker.pkg.dev/aptivaai-dev/aptiva-repo
- TAG=$(echo "$CI_COMMIT_SHA" | head -c 8)
- docker buildx create --use --name woodpecker || true
- for svc in server1 server2 server3 nginx; do docker buildx build -f Dockerfile.${svc} -t ${REG}/${svc}:${TAG} --push .; done
when:
event: [push, manual]
branch: [master]
- name: ssh-deploy
ssh-deploy:
image: google/cloud-sdk:latest
entrypoint:
- bash
@ -49,21 +21,28 @@ steps:
chmod 600 ~/.ssh/id_ed25519;
echo "🔑 SSH prerequisites installed";
IMG_TAG=$(gcloud secrets versions access latest --secret=IMG_TAG --project=aptivaai-dev | tr -d '\n');
echo "📦 IMG_TAG=${IMG_TAG}";
echo "📦 CI_COMMIT_SHA: ${CI_COMMIT_SHA:-unset}";
TAG="${CI_COMMIT_SHA:-}";
if [ -z "$TAG" ]; then echo "❌ CI_COMMIT_SHA is blank. Aborting."; exit 1; fi;
TAG=$(echo "$TAG" | head -c 8);
echo "🚀 Deploying tag ${TAG} to staging";
ssh -o StrictHostKeyChecking=yes -i ~/.ssh/id_ed25519 jcoakley@10.128.0.12 \
"set -euo pipefail; \
export IMG_TAG=${IMG_TAG}; \
"export IMG_TAG=${TAG}; \
cd /home/jcoakley/aptiva-staging-app; \
echo 'Pulling containers for tag ${IMG_TAG}'; \
echo 'IMG_TAG = ${IMG_TAG}'; \
echo '→ Pulling containers'; \
docker compose pull; \
echo 'Re-creating services'; \
echo 'Recreating services'; \
docker compose up -d --force-recreate --remove-orphans; \
echo '✅ Staging stack refreshed with tag ${IMG_TAG}'"
secrets:
- STAGING_SSH_KEY
- STAGING_KNOWN_HOSTS
environment:
CI_COMMIT_SHA: ${CI_COMMIT_SHA}
when:
event:
- push