From 9c53af70dca4e8eaa35985009ddc378af72d75fa Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Tue, 30 Dec 2025 09:44:37 -0600 Subject: [PATCH] fix: Production workflow optimization --- .gitea/workflows/production.yaml | 27 ++++++++++++++++--- .../ci/ansible => ansible}/config.yaml.j2 | 0 .../deploy-production-runner.yml | 1 + .../deploy-staging-runner.yml | 1 + {scripts/ci/ansible => ansible}/inventory.yml | 0 .../ansible => ansible}/inventory.yml.example | 0 6 files changed, 25 insertions(+), 4 deletions(-) rename {scripts/ci/ansible => ansible}/config.yaml.j2 (100%) rename {scripts/ci/ansible => ansible}/deploy-production-runner.yml (99%) rename {scripts/ci/ansible => ansible}/deploy-staging-runner.yml (99%) rename {scripts/ci/ansible => ansible}/inventory.yml (100%) rename {scripts/ci/ansible => ansible}/inventory.yml.example (100%) diff --git a/.gitea/workflows/production.yaml b/.gitea/workflows/production.yaml index e128d93..0563e1c 100644 --- a/.gitea/workflows/production.yaml +++ b/.gitea/workflows/production.yaml @@ -1,6 +1,9 @@ # MotoVaultPro Production Deployment Workflow # Manual trigger only - run after verifying staging # Blue-green deployment with auto-rollback +# +# Optimization: Uses sparse checkout (scripts/ only) + shallow clone +# since all scripts run from $DEPLOY_PATH on the production server name: Deploy to Production run-name: Production Deploy - ${{ inputs.image_tag || 'latest' }} @@ -81,8 +84,12 @@ jobs: BACKEND_IMAGE: ${{ needs.validate.outputs.backend_image }} FRONTEND_IMAGE: ${{ needs.validate.outputs.frontend_image }} steps: - - name: Checkout code + - name: Checkout scripts only uses: actions/checkout@v4 + with: + sparse-checkout: scripts/ + sparse-checkout-cone-mode: true + fetch-depth: 1 - name: Login to registry run: | @@ -200,8 +207,12 @@ jobs: needs: [validate, deploy-prod, verify-prod] if: failure() steps: - - name: Checkout code + - name: Checkout scripts only uses: actions/checkout@v4 + with: + sparse-checkout: scripts/ + sparse-checkout-cone-mode: true + fetch-depth: 1 - name: Execute rollback run: | @@ -226,8 +237,12 @@ jobs: needs: [validate, verify-prod] if: success() steps: - - name: Checkout code + - name: Checkout scripts only uses: actions/checkout@v4 + with: + sparse-checkout: scripts/ + sparse-checkout-cone-mode: true + fetch-depth: 1 - name: Send success notification run: | @@ -247,8 +262,12 @@ jobs: needs: [validate, deploy-prod, verify-prod, rollback] if: failure() steps: - - name: Checkout code + - name: Checkout scripts only uses: actions/checkout@v4 + with: + sparse-checkout: scripts/ + sparse-checkout-cone-mode: true + fetch-depth: 1 - name: Send failure notification run: | diff --git a/scripts/ci/ansible/config.yaml.j2 b/ansible/config.yaml.j2 similarity index 100% rename from scripts/ci/ansible/config.yaml.j2 rename to ansible/config.yaml.j2 diff --git a/scripts/ci/ansible/deploy-production-runner.yml b/ansible/deploy-production-runner.yml similarity index 99% rename from scripts/ci/ansible/deploy-production-runner.yml rename to ansible/deploy-production-runner.yml index f9dd5aa..484a695 100644 --- a/scripts/ci/ansible/deploy-production-runner.yml +++ b/ansible/deploy-production-runner.yml @@ -48,6 +48,7 @@ - ca-certificates - gnupg - jq + - nodejs state: present # ============================================ diff --git a/scripts/ci/ansible/deploy-staging-runner.yml b/ansible/deploy-staging-runner.yml similarity index 99% rename from scripts/ci/ansible/deploy-staging-runner.yml rename to ansible/deploy-staging-runner.yml index 08554eb..b6b366d 100644 --- a/scripts/ci/ansible/deploy-staging-runner.yml +++ b/ansible/deploy-staging-runner.yml @@ -48,6 +48,7 @@ - ca-certificates - gnupg - jq + - nodejs state: present # ============================================ diff --git a/scripts/ci/ansible/inventory.yml b/ansible/inventory.yml similarity index 100% rename from scripts/ci/ansible/inventory.yml rename to ansible/inventory.yml diff --git a/scripts/ci/ansible/inventory.yml.example b/ansible/inventory.yml.example similarity index 100% rename from scripts/ci/ansible/inventory.yml.example rename to ansible/inventory.yml.example