Skip to content
Merged
36 changes: 11 additions & 25 deletions .docker/entrypoints/cli/03-provision-site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ set -e
# 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
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
Expand All @@ -20,21 +20,7 @@ set -e
# # @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

# Delegate Drupal provisioning to the Quant-aware script. The standard
# DrevOps provision script is not compatible with Quant Cloud because it relies
# on Lagoon-specific tooling (e.g., rsync to Lagoon SSH).
if [ -x "./scripts/quant/provision-quant.sh" ]; then
./scripts/quant/provision-quant.sh
else
echo "Quant provisioning script missing or not executable." >&2
exit 1
fi
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
21 changes: 19 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ name: Build and Push civictheme-monorepo-drupal to Quant Cloud
- release/*
- hotfix/*
- feature/editorial-*
- project/quant-provision
tags:
- '*'

Expand Down Expand Up @@ -37,9 +38,12 @@ jobs:
quant_application: civictheme-monorepo-drupal
master_branch_override: main

- name: Override outputs for quant-cloud-migration branch
- name: Override outputs for special branches
id: override-outputs
run: |-
# Default: do not skip database sync
skip_db_sync="false"

# 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
Expand All @@ -48,6 +52,17 @@ jobs:
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"
# Override for project/quant-provision branch to skip database sync (fresh install from static content)
elif [[ "${{ github.ref }}" == "refs/heads/project/quant-provision" ]]; then
echo "image_suffix=${{ steps.init.outputs.image_suffix }}" >> $GITHUB_OUTPUT
suffix="${{ steps.init.outputs.image_suffix }}"
clean_suffix="${suffix#-}"
echo "image_suffix_clean=$clean_suffix" >> $GITHUB_OUTPUT
echo "is_production=false" >> $GITHUB_OUTPUT
echo "environment_name=${{ steps.init.outputs.environment_name }}" >> $GITHUB_OUTPUT
echo "environment_exists=${{ steps.init.outputs.environment_exists }}" >> $GITHUB_OUTPUT
skip_db_sync="true"
echo "Overriding outputs for project/quant-provision branch: skipping database sync"
else
# Use the original action outputs
echo "image_suffix=${{ steps.init.outputs.image_suffix }}" >> $GITHUB_OUTPUT
Expand All @@ -60,6 +75,8 @@ jobs:
echo "environment_exists=${{ steps.init.outputs.environment_exists }}" >> $GITHUB_OUTPUT
fi

echo "skip_db_sync=$skip_db_sync" >> $GITHUB_OUTPUT

- name: Build and push cli image
uses: docker/build-push-action@v5
with:
Expand Down Expand Up @@ -121,7 +138,7 @@ jobs:

- 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' }}
!= 'production' && steps.override-outputs.outputs.skip_db_sync != 'true' }}
uses: quantcdn/[email protected]
with:
api_key: ${{ secrets.QUANT_API_KEY }}
Expand Down
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@
"drupal/sdc_devel": {
"Change visibility of the rules constants in TwigValidatorRulePluginBase - https://www.drupal.org/project/sdc_devel/issues/3517321": "./patches/modules/sdc_devel/3517321--updated-visibility-of-rule-constants.patch",
"Remove check for use of default filter in boolean filter": "./patches/modules/sdc_devel/remove-boolean-filter-default.patch"
},
"drupal/simple_sitemap": {
"Error on installing / enabling simple_sitemap in D11: https://www.drupal.org/project/simple_sitemap/issues/3507718": "./patches/modules/simple_sitemap/fix-error-on-install.patch"
}
},
"preserve-paths": [
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion scripts/drevops/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,32 @@ fail() { [ "${TERM:-}" != "dumb" ] && tput colors >/dev/null 2>&1 && printf "\03
# @formatter:on

yesno() { [ "${1}" = "1" ] && echo "Yes" || echo "No"; }
drush() { ./vendor/bin/drush -y "$@"; }

# Prepare Drush URI using QUANT_ROUTE when available.
drush_uri=""
if [ -v QUANT_ROUTE ] && [ -n "${QUANT_ROUTE}" ]; then
case "${QUANT_ROUTE}" in
http://*|https://*)
drush_uri="${QUANT_ROUTE%/}"
info "Using QUANT_ROUTE for Drush URI: ${drush_uri}"
;;
*)
note "QUANT_ROUTE is set but is not a full URL. Drush will fall back to the default site context."
;;
esac
elif [ -v QUANT_ROUTE ]; then
note "QUANT_ROUTE is defined but empty. Drush will fall back to the default site context."
else
note "QUANT_ROUTE not defined. Drush will fall back to the default site context."
fi

drush() {
if [ -n "${drush_uri}" ]; then
./vendor/bin/drush -y --uri="${drush_uri}" "$@"
else
./vendor/bin/drush -y "$@"
fi
}

info "Started site provisioning."

Expand Down