From c40882ee596a113af06ab576adcce7f2d4340ac9 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 30 Jul 2025 19:59:57 +0000 Subject: [PATCH] rewrite v5 of woodpecker.yml --- .woodpecker.yml | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 55ae7ca..d7afeec 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,49 +1,41 @@ -# .woodpecker.yml dev1 ➜ aptiva‑staging kind: pipeline type: docker name: build-and-deploy workspace: base: /woodpecker - path: src # repo will be /woodpecker/src + path: src clone: depth: 50 -############################################################ -# 1. Build & push the four images to Artifact Registry -############################################################ steps: +# ─── build & push ────────────────────────────────────────── - name: build-and-push - image: docker:24.0-cli # uses host’s Docker socket - privileged: true # required for buildx + image: docker:24.0-cli # only the CLI, we re‑use host docker + privileged: true volumes: - - name: docker-sock # mount the host socket + - name: docker-sock # mount declared at bottom path: /var/run/docker.sock - commands: | - set -euo pipefail + commands: + - | + set -e 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 \ - --file Dockerfile.${svc} \ - --tag ${REG}/${svc}:${TAG} \ - --push . + docker buildx build -f Dockerfile.${svc} \ + -t ${REG}/${svc}:${TAG} --push . done when: event: [push, manual] branch: [master] -############################################################ -# 2. Rolling update on the *staging* VM -############################################################ +# ─── deploy staging ──────────────────────────────────────── - name: deploy-staging image: appleboy/drone-ssh settings: - host: 10.128.0.12 # internal IP of aptiva‑staging + host: 10.128.0.12 port: 22 username: jcoakley key: @@ -52,7 +44,7 @@ steps: from_secret: STAGING_KNOWN_HOSTS script: - cd /opt/aptiva-staging-app - - ./refresh_secrets.sh # pulls latest Secret‑Manager values + - ./refresh_secrets.sh - TAG=$(echo "$CI_COMMIT_SHA" | head -c 8) - IMG_TAG=$TAG docker compose pull - IMG_TAG=$TAG docker compose up -d --remove-orphans @@ -60,9 +52,7 @@ steps: event: [push, manual] branch: [master] -############################################################ -# 3. Volumes (declared once, referenced by name) -############################################################ +# ─── global volume declaration (list **not** indented) ───── volumes: - name: docker-sock host: