Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9a257a1
[GOVCMSCT2-121] Added fact fact related fields and configuration and …
joshua-salsadigital Jul 25, 2025
006540b
Added config missign files.
joshua-salsadigital Jul 25, 2025
c9996b7
Fixed config related issue.
joshua-salsadigital Jul 25, 2025
bb9b364
[GOVCMSCT2-121] Fixed behat test.
joshua-salsadigital Jul 25, 2025
cf7d57f
[GOVCMSCT2-121] Updated machine name to civictheme_fast_fact_card.
joshua-salsadigital Jul 30, 2025
af9ecdc
[GOVCMSCT2-121] Added post update hook for civictheme_fast_fact_card.
joshua-salsadigital Jul 30, 2025
61dc9cc
[GOVCMSCT2-121] Fixed lint issue.
joshua-salsadigital Jul 30, 2025
ac0c3a1
[GOVCMSCT2-121] Fixed lint issue.
joshua-salsadigital Jul 30, 2025
29e985d
Merge branch 'develop' into feature/GOVCMSCT2-121
joshua-salsadigital Aug 14, 2025
76a1c3b
CivicTheme implementation to display a Fast Fact card. and bumped the…
joshua-salsadigital Aug 14, 2025
5c7b4f5
Updated behat test.
joshua-salsadigital Aug 14, 2025
6e76c02
Fixed Failing test.
joshua-salsadigital Aug 15, 2025
c8d8a55
Merge branch 'develop' into feature/GOVCMSCT2-121
joshua-salsadigital Aug 25, 2025
8b56da4
Merge branch 'develop' into feature/GOVCMSCT2-121
joshua-salsadigital Sep 3, 2025
5d08d07
Add Quant Cloud migration configuration
stooit Sep 14, 2025
15bd089
Add Quant Cloud migration configuration
stooit Sep 25, 2025
07daef1
Merge branch 'develop' into feature/GOVCMSCT2-121
joshua-salsadigital Oct 3, 2025
f966a90
Fixed quant merge conflict - diff-e65288356485a0927532b70464ad2d038d…
joshua-salsadigital Oct 3, 2025
406439c
Merge branch 'develop' into feature/GOVCMSCT2-121
richardgaunt Oct 8, 2025
a022720
Merge branch 'develop' into feature/GOVCMSCT2-121
joshua-salsadigital Oct 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .docker/cli.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ RUN cd /app/web/themes/contrib/civictheme \
# Compile sub-theme assets.
RUN npm --prefix web/themes/custom/civictheme_demo install --no-audit --no-progress --unsafe-perm \
&& cd /app/web/themes/custom/civictheme_demo && npm run build
COPY .docker/entrypoints/cli/* /quant-entrypoint.d/
52 changes: 52 additions & 0 deletions .docker/entrypoints/cli/00-fix-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
set -e

# Fix EFS volume permissions based on lagoon.persistent labels
#
# Two approaches based on container configuration:
# 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping)
# 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility

echo "Fixing file permissions for EFS volumes..."

# Check if containers have been configured with UID/GID remapping
if [ -n "$VOLUME_USER" ]; then
echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000"
echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)"
PERMISSION_MODE="secure"
else
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
Comment on lines 18 to 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Gate world-writable fallback.

Avoid enabling 777/666 unless explicitly approved for the environment.

-    PERMISSION_MODE="compatible"
+    PERMISSION_MODE="compatible"
+    if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+      echo "   Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+      exit 0
+    fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
exit 0
fi
fi
🤖 Prompt for AI Agents
.docker/entrypoints/cli/00-fix-permissions.sh around lines 18-21: the script
currently falls back to world-writable permissions unconditionally; change it to
require an explicit opt-in (e.g., ALLOW_WORLD_WRITABLE=true) before setting
PERMISSION_MODE="compatible", otherwise set a safer default (e.g., "restricted"
or specific 0755/0644) and emit a clear warning or fail fast; implement a simple
conditional that checks the opt-in environment variable, documents the behavior
in the log messages, and avoid applying 0777/0666 unless the opt-in flag is
present.


# Persistent volume paths from docker-compose lagoon.persistent labels
for path in "/app/web/sites/default/files/"; do
if [ -d "$path" ]; then
echo "Fixing permissions for: $path"

if [ "$PERMISSION_MODE" = "secure" ]; then
# Set secure directory permissions (755 = rwxr-xr-x)
find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true

# Set secure file permissions (644 = rw-r--r--)
find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true

echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)"
else
# Compatible approach: World-writable fallback

# Make directories world-writable (since we can't chown to unknown web server user)
find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true

# Make files world-readable/writable (since we can't chown to unknown web server user)
find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true

echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)"
fi
else
echo "Path not found (may not be mounted yet): $path"
fi
done

echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)"
7 changes: 7 additions & 0 deletions .docker/entrypoints/cli/01-show-drevops-variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

# Post-rollout task: Show DrevOps variables.
# Generated from .lagoon.yml

env -0 | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid GNU-only flags; add portable fallback.

env -0 and sort -z aren’t available in BusyBox/Alpine by default; with set -e this may silently noop or fail.

-env -0  | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true
+if env -0 >/dev/null 2>&1; then
+  env -0 | tr '\0' '\n' | sort | grep '^DREVOPS_' || true
+else
+  printenv | sort | grep '^DREVOPS_' || true
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env -0 | sort -z | tr '\0' '\n' | grep ^DREVOPS_ || true
if env -0 >/dev/null 2>&1; then
env -0 | tr '\0' '\n' | sort | grep '^DREVOPS_' || true
else
printenv | sort | grep '^DREVOPS_' || true
fi
🤖 Prompt for AI Agents
In .docker/entrypoints/cli/01-show-drevops-variables.sh around line 7, the
pipeline uses GNU-only flags env -0 and sort -z which are missing on
BusyBox/Alpine; replace it with a portable implementation that first attempts
the null-delimited approach if available and otherwise falls back to a
POSIX-safe pipeline. Concretely, detect/support env -0 and sort -z (e.g., test
sort --version or attempt a harmless invocation) and use them when present;
otherwise use env | sort | grep '^DREVOPS_' || true so the script works on
minimal shells and still honors set -e by ensuring the final command never
fails.

11 changes: 11 additions & 0 deletions .docker/entrypoints/cli/02-notify-about-pre-deployment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
set -e

# Post-rollout task: Notify about pre-deployment.
# Generated from .lagoon.yml

if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER;export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/};export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH;else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH;export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA;export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH;fi
DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \
DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
DREVOPS_NOTIFY_EVENT=pre_deployment ./scripts/drevops/notify.sh || true

30 changes: 30 additions & 0 deletions .docker/entrypoints/cli/03-provision-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
set -e

# Post-rollout task: Provision site
# Generated from .lagoon.yml
# COMMENTED OUT: This script contains rsync commands that won't work in Quant Cloud

# if [ "$LAGOON_ENVIRONMENT_TYPE" = "production" ] || [ "$LAGOON_GIT_BRANCH" = "${DREVOPS_LAGOON_PRODUCTION_BRANCH:-main}" ]; then
# echo "==> Running in PRODUCTION environment."
# # Never unblock admin user in production.
# export DRUPAL_UNBLOCK_ADMIN=0
# # Never sanitize DB in production.
# export DREVOPS_PROVISION_SANITIZE_DB_SKIP=1
# fi
#
# # Deployments from UI are not able to bypass the value of
# # DREVOPS_PROVISION_OVERRIDE_DB set by the deploy-lagoon.sh
# # during previous deployments (it sets value to '0' to mitigate Lagoon bug
# # where environment variables cannot be deleted and have to be set to a value).
# # @see https://github.com/uselagoon/lagoon/issues/1922
# # Explicitly set DB overwrite flag to the value from .env file for
# # deployments from the profile.
# if [ "${DREVOPS_PROVISION_USE_PROFILE}" = "1" ]; then
# export DREVOPS_PROVISION_OVERRIDE_DB="$(cat .env | grep ^DREVOPS_PROVISION_OVERRIDE_DB | cut -c31-)"
# fi
# ./scripts/drevops/provision.sh

# NOTE: This provision script has been disabled because:
# - rsync commands try to connect to Lagoon SSH which is not available in Quant Cloud
# - Use DREVOPS_PROVISION_SKIP=1 environment variable to skip provision steps
12 changes: 12 additions & 0 deletions .docker/entrypoints/cli/04-send-deployment-notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
set -e

# Post-rollout task: Send deployment notifications
# Generated from .lagoon.yml

if [ -n "$LAGOON_PR_NUMBER" ]; then export DREVOPS_NOTIFY_REF=$LAGOON_PR_NUMBER; export DREVOPS_NOTIFY_SHA=${LAGOON_PR_HEAD_SHA#origin/}; export DREVOPS_NOTIFY_BRANCH=$LAGOON_PR_HEAD_BRANCH; else export DREVOPS_NOTIFY_REF=$LAGOON_GIT_BRANCH; export DREVOPS_NOTIFY_SHA=$LAGOON_GIT_SHA; export DREVOPS_NOTIFY_BRANCH=$LAGOON_GIT_BRANCH; fi
DREVOPS_NOTIFY_EVENT=post_deployment \
DREVOPS_NOTIFY_PROJECT=$LAGOON_PROJECT \
DREVOPS_NOTIFY_ENVIRONMENT_URL=$LAGOON_ROUTE \
./scripts/drevops/notify.sh

52 changes: 52 additions & 0 deletions .docker/entrypoints/nginx/00-fix-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
set -e

# Fix EFS volume permissions based on lagoon.persistent labels
#
# Two approaches based on container configuration:
# 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping)
# 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility

echo "Fixing file permissions for EFS volumes..."

# Check if containers have been configured with UID/GID remapping
if [ -n "$VOLUME_USER" ]; then
echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000"
echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)"
PERMISSION_MODE="secure"
else
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
Comment on lines 18 to 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Gate world-writable fallback.

Same security concern as PHP entrypoint; require explicit ALLOW_WORLD_WRITABLE=1.

-    PERMISSION_MODE="compatible"
+    PERMISSION_MODE="compatible"
+    if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+      echo "   Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+      exit 0
+    fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
exit 0
fi
fi
🤖 Prompt for AI Agents
In .docker/entrypoints/nginx/00-fix-permissions.sh around lines 18 to 21, the
script currently falls back to setting world-writable permissions when
VOLUME_USER is not set; replace this unconditional fallback with an explicit
gate that requires ALLOW_WORLD_WRITABLE=1 to proceed. If ALLOW_WORLD_WRITABLE is
not set or not equal to "1", emit a clear error message and exit (or set a safer
default permission mode), and only set PERMISSION_MODE="compatible" when
ALLOW_WORLD_WRITABLE=1 is present; keep the existing informational echoes but
include the requirement to opt-in via ALLOW_WORLD_WRITABLE.


# Persistent volume paths from docker-compose lagoon.persistent labels
for path in "/app/web/sites/default/files/"; do
if [ -d "$path" ]; then
echo "Fixing permissions for: $path"

if [ "$PERMISSION_MODE" = "secure" ]; then
# Set secure directory permissions (755 = rwxr-xr-x)
find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true

# Set secure file permissions (644 = rw-r--r--)
find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true

echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)"
else
# Compatible approach: World-writable fallback

# Make directories world-writable (since we can't chown to unknown web server user)
find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true

# Make files world-readable/writable (since we can't chown to unknown web server user)
find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true

echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)"
fi
else
echo "Path not found (may not be mounted yet): $path"
fi
done

echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)"
52 changes: 52 additions & 0 deletions .docker/entrypoints/php/00-fix-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh
set -e

# Fix EFS volume permissions based on lagoon.persistent labels
#
# Two approaches based on container configuration:
# 1. VOLUME_USER set: Use secure permissions with UID/GID 1000 (requires container remapping)
# 2. VOLUME_USER unset: Fall back to world-writable (777/666) for compatibility

echo "Fixing file permissions for EFS volumes..."

# Check if containers have been configured with UID/GID remapping
if [ -n "$VOLUME_USER" ]; then
echo "🔒 VOLUME_USER detected: Using secure permissions with UID/GID 1000"
echo " (Assumes containers remap www-data to UID/GID 1000 for EFS compatibility)"
PERMISSION_MODE="secure"
else
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
Comment on lines 18 to 21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

World-writable fallback needs an explicit opt-in.

777/666 on web writable dirs is risky in prod. Gate with an env flag.

-    PERMISSION_MODE="compatible"
+    PERMISSION_MODE="compatible"
+    if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
+      echo "   Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
+      exit 0
+    fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
fi
echo "⚠️ VOLUME_USER not set: Using world-writable permissions for compatibility"
echo " (Consider setting VOLUME_USER and remapping container users to UID/GID 1000)"
PERMISSION_MODE="compatible"
if [ "${ALLOW_WORLD_WRITABLE:-0}" != "1" ]; then
echo " Skipping world-writable fallback (set ALLOW_WORLD_WRITABLE=1 to enable)."
exit 0
fi
fi
🤖 Prompt for AI Agents
In .docker/entrypoints/php/00-fix-permissions.sh around lines 18 to 21, the
script currently falls back to world-writable permissions (777/666) when
VOLUME_USER is unset; change this so the world-writable fallback is only applied
when an explicit opt-in environment variable is set (e.g.,
VOLUME_ALLOW_WORLD_WRITABLE=true). Update the logic to: if VOLUME_USER unset
then check the opt-in flag — if opt-in is true set PERMISSION_MODE="compatible"
and print a clear warning that this is unsafe for production, otherwise set a
safer default (restrictive perms) and print an instruction message about setting
VOLUME_USER or enabling the opt-in flag; ensure the opt-in flag is documented in
the warning and exit logs remain informative.


# Persistent volume paths from docker-compose lagoon.persistent labels
for path in "/app/web/sites/default/files/"; do
if [ -d "$path" ]; then
echo "Fixing permissions for: $path"

if [ "$PERMISSION_MODE" = "secure" ]; then
# Set secure directory permissions (755 = rwxr-xr-x)
find "$path" -type d -exec chmod 755 {} + 2>/dev/null || true

# Set secure file permissions (644 = rw-r--r--)
find "$path" -type f -exec chmod 644 {} + 2>/dev/null || true

echo "✓ Secure permissions applied: $path (dirs: 755, files: 644)"
else
# Compatible approach: World-writable fallback

# Make directories world-writable (since we can't chown to unknown web server user)
find "$path" -type d -exec chmod 777 {} + 2>/dev/null || true

# Make files world-readable/writable (since we can't chown to unknown web server user)
find "$path" -type f -exec chmod 666 {} + 2>/dev/null || true

echo "✓ Compatible permissions applied: $path (dirs: 777, files: 666)"
fi
else
echo "Path not found (may not be mounted yet): $path"
fi
done

echo "Permission fixing completed for 1 volumes ($PERMISSION_MODE mode)"
1 change: 1 addition & 0 deletions .docker/php.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ FROM uselagoon/php-8.3-fpm:25.1.0
RUN apk add --no-cache tzdata

COPY --from=cli /app /app
COPY .docker/entrypoints/php/* /quant-entrypoint.d/
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ node_modules

# Do not ignore other required files.
!.docker/scripts
!.docker/entrypoints
!.docker/config
!.env
!.eslintrc.json
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Build and Push civictheme-monorepo-drupal to Quant Cloud
'on':
push:
branches:
- main
- master
- develop
- quant-cloud-migration
- feature/*
tags:
- '*'
pull_request:
branches: '*'

concurrency:
group: build-and-push-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-push:
runs-on: sh-runner-1-arm64
steps:

- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Initialize Quant Cloud
uses: quantcdn/[email protected]
id: init
with:
quant_organization: ${{ secrets.QUANT_ORGANIZATION }}
quant_api_key: ${{ secrets.QUANT_API_KEY }}
quant_application: civictheme-monorepo-drupal
master_branch_override: main

Comment on lines 32 to 40
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Skip Quant init on pull_request to avoid secret access failures.

This step uses secrets; forks won’t have them.

-    - name: Initialize Quant Cloud
+    - name: Initialize Quant Cloud
+      if: ${{ github.event_name != 'pull_request' }}
       uses: quantcdn/[email protected]
🤖 Prompt for AI Agents
.github/workflows/build-deploy.yml around lines 30-38: the Quant Cloud init step
runs for pull_request events and fails on forked PRs due to missing secrets; add
a job step-level conditional so the step only runs when the workflow is not
triggered by a pull_request (e.g., add if: github.event_name != 'pull_request'),
keeping the existing inputs intact so secrets are only referenced on trusted
events.

- name: Override outputs for quant-cloud-migration branch
id: override-outputs
run: |-
# Override outputs for quant-cloud-migration branch to treat it as production
if [[ "${{ github.ref }}" == "refs/heads/quant-cloud-migration" ]]; then
echo "image_suffix=-latest" >> $GITHUB_OUTPUT
echo "image_suffix_clean=latest" >> $GITHUB_OUTPUT
echo "is_production=true" >> $GITHUB_OUTPUT
echo "environment_name=production" >> $GITHUB_OUTPUT
echo "environment_exists=true" >> $GITHUB_OUTPUT
echo "Overriding outputs for quant-cloud-migration branch: using -latest suffix and production environment"
else
# Use the original action outputs
echo "image_suffix=${{ steps.init.outputs.image_suffix }}" >> $GITHUB_OUTPUT
# Remove leading hyphen from image_suffix for image_suffix parameter
suffix="${{ steps.init.outputs.image_suffix }}"
clean_suffix="${suffix#-}"
echo "image_suffix_clean=$clean_suffix" >> $GITHUB_OUTPUT
echo "is_production=${{ steps.init.outputs.is_production }}" >> $GITHUB_OUTPUT
echo "environment_name=${{ steps.init.outputs.environment_name }}" >> $GITHUB_OUTPUT
echo "environment_exists=${{ steps.init.outputs.environment_exists }}" >> $GITHUB_OUTPUT
fi

- name: Build and push cli image
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/cli.dockerfile
platforms: linux/arm64
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:cli${{ steps.override-outputs.outputs.image_suffix }}
cache-from: |-
type=gha
type=registry,ref=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}:cli-cache
cache-to: type=gha,mode=max
build-args: CLI_IMAGE=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:cli${{ steps.override-outputs.outputs.image_suffix }}

Comment on lines 64 to 79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid pushing images on pull_request events.

Prevents failing builds from forks and unnecessary registry pollution.

-    - name: Build and push cli image
+    - name: Build and push cli image
+      if: ${{ github.event_name != 'pull_request' }}
@@
-    - name: Build and push nginx image
+    - name: Build and push nginx image
+      if: ${{ github.event_name != 'pull_request' }}
@@
-    - name: Build and push php image
+    - name: Build and push php image
+      if: ${{ github.event_name != 'pull_request' }}

Also applies to: 78-93, 94-109

🤖 Prompt for AI Agents
.github/workflows/build-deploy.yml lines 62-77 (and similarly 78-93, 94-109):
the workflow currently pushes built container images during pull_request events
which can fail for forked PRs and pollute registries; update the job so it does
not push on pull_request events by gating the push-related inputs (push, tags,
cache-from, cache-to, and any registry credentials) behind a conditional that
checks the event is not a pull_request (e.g., if: github.event_name !=
'pull_request') or split build and push into separate jobs where the push job
only runs for non-pull_request events, and ensure tags/build-args referencing
secrets are only used in the push job to avoid exposing secrets in PRs from
forks.

- name: Build and push nginx image
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/nginx-drupal.dockerfile
platforms: linux/arm64
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:nginx${{ steps.override-outputs.outputs.image_suffix }}
cache-from: |-
type=gha
type=registry,ref=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}:nginx-cache
cache-to: type=gha,mode=max
build-args: CLI_IMAGE=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:cli${{ steps.override-outputs.outputs.image_suffix }}

- name: Build and push php image
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/php.dockerfile
platforms: linux/arm64
push: true
tags: ${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:php${{ steps.override-outputs.outputs.image_suffix }}
cache-from: |-
type=gha
type=registry,ref=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application }}:php-cache
cache-to: type=gha,mode=max
build-args: CLI_IMAGE=${{ steps.init.outputs.stripped_endpoint }}/${{ secrets.QUANT_ORGANIZATION }}/${{ steps.init.outputs.quant_application
}}:cli${{ steps.override-outputs.outputs.image_suffix }}

- name: Create environment if it doesn't exist
if: ${{ !startsWith(github.ref, 'refs/tags/') && steps.override-outputs.outputs.environment_exists == 'false' }}
uses: quantcdn/[email protected]
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
app_name: ${{ steps.init.outputs.quant_application }}
environment_name: ${{ steps.override-outputs.outputs.environment_name }}
from_environment: production
image_suffix: ${{ steps.override-outputs.outputs.image_suffix_clean }}

- name: Sync database from production to new environment
if: ${{ !startsWith(github.ref, 'refs/tags/') && steps.override-outputs.outputs.environment_exists == 'false' && steps.override-outputs.outputs.environment_name
!= 'production' }}
uses: quantcdn/[email protected]
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
app_name: ${{ steps.init.outputs.quant_application }}
environment_name: ${{ steps.override-outputs.outputs.environment_name }}
source: production
type: database
wait: true
wait_interval: 10
max_retries: 30

- name: Redeploy existing environment
if: ${{ !startsWith(github.ref, 'refs/tags/') && steps.override-outputs.outputs.environment_exists == 'true' }}
uses: quantcdn/quant-cloud-environment-state-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
application: ${{ steps.init.outputs.quant_application }}
environment: ${{ steps.override-outputs.outputs.environment_name }}
action: redeploy
Loading
Loading