Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch stage into main #1914

Merged
merged 31 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
af4b128
ACMS-4329: Update PHP version to 8.3 for acquia pipeline.
rajeshreeputra Nov 27, 2024
26474a9
Merge pull request #1906 from acquia/ACMS-4329
vishalkhode1 Nov 27, 2024
f16d84c
ACMS-4329: New CD workflow added.
vishalkhode1 Nov 29, 2024
eb85968
ACMS-4329: Temp commit to fix CI issue.
vishalkhode1 Dec 3, 2024
ac42022
ACMS-4239: Temp commit.
vishalkhode1 Dec 2, 2024
f9859bc
ACMS-4329: Remove Acquia Pipelines CD.
vishalkhode1 Dec 4, 2024
e0acf49
ACMS-4329: Minor improvements made.
vishalkhode1 Dec 4, 2024
bbcf22a
Merge pull request #1907 from acquia/ACMS-4329
vishalkhode1 Dec 4, 2024
dcdfc34
Revert "ACMS-4239: Temp commit."
vishalkhode1 Dec 4, 2024
6648793
ACMS-4329: Add manual deployment workflow.
vishalkhode1 Dec 4, 2024
9aa939a
Minor debug.
vishalkhode1 Dec 4, 2024
ea08e4b
ACMS-4329: Temp run github CI.
vishalkhode1 Dec 4, 2024
e7d9bd8
ACMS-4329: More improvements.
vishalkhode1 Dec 4, 2024
d3e6f53
ACMS-4329: Try more improvements.
vishalkhode1 Dec 4, 2024
e47351c
Merge pull request #1908 from acquia/ACMS-4329
vishalkhode1 Dec 4, 2024
8cee154
ACMS-4329: Make Drupal Core version as optional.
vishalkhode1 Dec 5, 2024
0c2add3
ACMS-4373: Make Acquia CMS Toolbar and Tour work independent.
rajeshreeputra Dec 20, 2024
e095710
ACMS-4373: Acquia Starter Kit Tour fix failing tests.
rajeshreeputra Dec 20, 2024
52583c8
ACMS-4373: Acquia Starter Kit Tour add google maps dev dependency.
rajeshreeputra Dec 23, 2024
fd16a68
ACMS-4373: Acquia Starter Kit Tour and Toolbar refactor install and e…
rajeshreeputra Dec 23, 2024
7ebf199
ACMS-4373: Update Google map tour plugin.
rajeshreeputra Dec 24, 2024
8104560
ACMS-4373: Review feedback changes for Toolbar.
rajeshreeputra Dec 26, 2024
a3d5e11
ACMS-4373: Add test coverage to Toolbar module.
rajeshreeputra Dec 26, 2024
b882573
ACMS-4373: Rename google maps form and test to geocoder google maps.
rajeshreeputra Dec 26, 2024
8a65096
ACMS-4373: Add permission test coverage to Tour module.
rajeshreeputra Dec 26, 2024
033a896
ACMS-4373: Refactore code and add toolbar test in CI.
rajeshreeputra Dec 26, 2024
ac9d754
ACMS-4373: Remove EntityInsertOperationInterface from toolbar.
rajeshreeputra Dec 27, 2024
9443e5d
ACMS-4373: Revert static code analysis as per ORCA.
rajeshreeputra Dec 27, 2024
ac5ab95
ACMS-4373: execute test on INTEGRATED_TEST_ON_PREVIOUS_MINOR will fix…
rajeshreeputra Dec 27, 2024
e2ea37a
ACMS-4373: Fix headless warnings related to D11 compatibility.
rajeshreeputra Dec 27, 2024
dc1ac52
Merge pull request #1909 from acquia/ACMS-4373
vishalkhode1 Dec 27, 2024
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
11 changes: 11 additions & 0 deletions .github/cd.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/docroot/sites/*/settings.*.php
/docroot/sites/*/services*.yml
/docroot/sites/*/files
/docroot/sites/*/private
/docroot/sites/simpletest

# Directories specific to this template
/docroot/libraries
/docroot/modules/contrib
/docroot/profiles/contrib
/docroot/themes/contrib
21 changes: 15 additions & 6 deletions .github/workflows/acquia_cms_ci.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
paths-ignore:
- README.md

env:
ORCA_VERSION: ^4
jobs:
static_code_analysis:
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -17,7 +19,6 @@ jobs:
# Provide your package's name.
ORCA_SUT_NAME: acquia/acquia_cms
ORCA_SUT_BRANCH: develop
ORCA_VERSION: ^4
ORCA_PACKAGES_CONFIG_ALTER: ../acquia_cms/tests/packages_alter.yml
ORCA_FIXTURE_PROJECT_TEMPLATE: acquia/drupal-recommended-project
ORCA_ENABLE_NIGHTWATCH: "FALSE"
Expand Down Expand Up @@ -127,7 +128,8 @@ jobs:
matrix:
orca-job:
- INTEGRATED_TEST_ON_LATEST_LTS
- ISOLATED_TEST_ON_CURRENT
- INTEGRATED_TEST_ON_PREVIOUS_MINOR
# - ISOLATED_TEST_ON_CURRENT
acms_job:
- integrated_php_unit_tests
- integrated_existing_site_tests
Expand All @@ -151,6 +153,7 @@ jobs:
composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply
curl https://gist.githubusercontent.com/rajeshreeputra/efe6fd50fc839e0e05480a5eb58d1ba4/raw/c5e81aa3c0fba9f4abe42460f3d24c7ca976a527/remove-local-settings.patch | git -C ../orca apply
composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR}
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
Expand Down Expand Up @@ -223,7 +226,8 @@ jobs:
matrix:
orca-job:
- INTEGRATED_TEST_ON_LATEST_LTS
- ISOLATED_TEST_ON_CURRENT
- INTEGRATED_TEST_ON_PREVIOUS_MINOR
# - ISOLATED_TEST_ON_CURRENT
#php-version: [ "8.1" ]
modules:
- acquia_cms_article
Expand All @@ -238,6 +242,7 @@ jobs:
- acquia_cms_place
- acquia_cms_search
- acquia_cms_site_studio
- acquia_cms_toolbar
- acquia_cms_tour
- acquia_cms_video
steps:
Expand All @@ -255,6 +260,7 @@ jobs:
composer self-update
composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply
composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR}
- name: Before Install
run: |
# Remove all ExistingSite test in CI.
Expand Down Expand Up @@ -319,14 +325,16 @@ jobs:
matrix:
orca-job:
- INTEGRATED_TEST_ON_LATEST_LTS
# - INTEGRATED_TEST_ON_PREVIOUS_MINOR
- ISOLATED_TEST_ON_CURRENT
- INTEGRATED_TEST_ON_PREVIOUS_MINOR
# - ISOLATED_TEST_ON_CURRENT
php-version:
- 8.1
- 8.3
exclude:
- php-version: 8.1
orca-job: ISOLATED_TEST_ON_CURRENT
orca-job: INTEGRATED_TEST_ON_PREVIOUS_MINOR
# - php-version: 8.1
# orca-job: ISOLATED_TEST_ON_CURRENT
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
Expand All @@ -346,6 +354,7 @@ jobs:
composer self-update
composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
curl https://gist.githubusercontent.com/rajeshreeputra/170586f217b422eb9cdfd9ca9457a2e3/raw/c2f277ba9005b91d7f662cacf37b3940a66a9b8c/sut-path-reposories.patch | git -C ../orca apply
composer config extra."drupal-scaffold".file-mapping {} --json -d ${ORCA_SUT_DIR}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/acquia_cms_cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ jobs:
- acquia_cms_place
- acquia_cms_search
- acquia_cms_site_studio
- acquia_cms_toolbar
- acquia_cms_tour
- acquia_cms_video
steps:
Expand Down
210 changes: 210 additions & 0 deletions .github/workflows/deployment.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: "Code Deployment (Acquia)"
on:
push:
branches: [ develop, main, ACMS-*, feature/* ]
workflow_dispatch:
inputs:
environment:
description: 'Choose environment'
type: choice
options:
- dev
- stage
- prod
- next
- ode1
- ode2
- ode3
- ode4
- ode5
- ode6
- ode7
- ode8
required: true
default: 'dev'
php-version:
description: 'Choose PHP Version'
type: choice
options:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
required: true
default: '8.3'
drupal-core:
description: 'Choose Drupal Core Version.'
required: false
default: '^11'
download-latest-dependencies:
description: 'Download latest dependencies'
type: boolean
default: false

concurrency:
group: "ci-${{ github.ref }}"
cancel-in-progress: true

env:
GIT_AUTHOR_NAME: "CD"
GIT_COMMITTER_NAME: "CD"
GIT_COMMITTER_EMAIL: "[email protected]"
GIT_AUTHOR_EMAIL: "[email protected]"
PHP_VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.php-version || '8.3' }}
CORE_VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.drupal-core || '' }}
ACQUIA_CLOUD_ENVIRONMENT: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'dev' }}
DOWNLOAD_LATEST_DEPENDENCIES: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.download-latest-dependencies || 'false' }}

jobs:
acquia_code_deployment:
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
name: "Code Deployment"
runs-on: ubuntu-latest
environment: acquia_code_deployment
env:
ACQUIA_CLOUD_API_KEY: ${{ secrets.ACQUIA_CLOUD_API_KEY }}
ACQUIA_CLOUD_API_SECRET: ${{ secrets.ACQUIA_CLOUD_API_SECRET }}
ACQUIA_CLOUD_APPLICATION: ${{ secrets.ACQUIA_CLOUD_APPLICATION }}
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
- name: Setup Drupal Project
run: |
# Download specific version of Drupal Core, if requested.
[ -n "${CORE_VERSION}" ] && echo composer require drupal/core:${CORE_VERSION} drupal/core-composer-scaffold:${CORE_VERSION} drupal/core-recommended:${CORE_VERSION} --no-install --no-update -n || true

# Move some of development dependencies to production dependencies or else acli push:artifact will fail.
composer require oomphinc/composer-installers-extender --no-install --no-update -n

if [ "${DOWNLOAD_LATEST_DEPENDENCIES}" == "true" ]; then
rm composer.lock
composer install
else
# Update specific version of Drupal Core, if requested or else simply install all dependencies.
if [ -n "${CORE_VERSION}" ]; then
composer update "drupal/core-*" drush/drush "drupal/*" -W --with=drupal/core:${CORE_VERSION} --minimal-changes
else
# In CI, we don't need to run composer install again, as it's already will be done by below command.
composer update oomphinc/composer-installers-extender
fi
fi

# Include MySQL 5.7 connection settings, before DRS require line is added.
echo "require DRUPAL_ROOT . '/modules/contrib/mysql57/settings.inc';" >> docroot/sites/default/settings.php

# Download acquia/drupal-recommended-settings plugin & drupal/mysql57 library.
composer require acquia/drupal-recommended-settings:^1.1 drupal/mysql57

# Update .gitignore file, otherwise acli won't push any settings file.
sed -i 's/docroot\//docroot\/core/' .gitignore
cat .github/cd.gitignore >> .gitignore 2>/dev/null

# Create symlink directory for multisite headless and community.
cd docroot/sites
ln -s default headless
ln -s default community
cd -
git add . && git commit -m "Update drupal core and it's dependencies." 2>/dev/null
- name: Setup Acquia CLI
run: |
curl -OL https://github.com/acquia/cli/releases/latest/download/acli.phar
chmod +x acli.phar
mv acli.phar /usr/local/bin/acli
acli --version

acli auth:login --key=${ACQUIA_CLOUD_API_KEY} --secret=${ACQUIA_CLOUD_API_SECRET} -n
ACQUIA_APPLICATION_UUID=$(acli api:applications:find ${ACQUIA_CLOUD_APPLICATION} -n | jq -r '.uuid')
acli link ${ACQUIA_APPLICATION_UUID} -n

acli remote:aliases:download -n
git add . && git commit -m "Added acli & drush alias configurations." 2>/dev/null
- name: Find & Switch PHP Version
run: |
# Find the PHP version.
ENV_PHP_VERSION=$(acli api:environments:find ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.configuration.php.version')
echo "The CI php-version: ${PHP_VERSION}"
echo "The Acquia Cloud environment php-version: $ENV_PHP_VERSION"
# If PHP_VERSION is NOT the same as the one we want to switch to. Then switch PHP version.
if [ "${ENV_PHP_VERSION}" != "${PHP_VERSION}" ]; then
echo "Switching PHP version to ${PHP_VERSION}"
acli api:environments:update ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} --lang_version=${PHP_VERSION} -n
sleep 10
fi
- name: Configure SSH keys
run: |
mkdir -p ~/.ssh
echo "${ACQUIA_CLOUD_SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa

SSH_URL=$(acli api:environments:find ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.ssh_url' | awk -F'[@:]' '{print $2}')
GIT_URL=$(acli api:environments:find ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.vcs.url' | awk -F'[@:]' '{print $2}')

ssh-keyscan "${SSH_URL}" >> ~/.ssh/known_hosts && ssh-keyscan "${GIT_URL}" >> ~/.ssh/known_hosts
shell: bash
env:
ACQUIA_CLOUD_SSH_PRIVATE_KEY: ${{ secrets.ACQUIA_CLOUD_SSH_PRIVATE_KEY }}
- name: Deploy & Switch Code
shell: bash
run: |
BRANCH_TO_DEPLOY=acli-${GITHUB_REF_NAME}

# Push changes on Acuia Cloud.
acli push:artifact ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} --destination-git-branch=${BRANCH_TO_DEPLOY} -n

# If the event is push and branch is develop or if CI is triggered manually, then only switch code.
if [[ "${GITHUB_EVENT_NAME}" == "push" && "${GITHUB_REF_NAME}" == "develop" ]] || [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then

DEPLOYED_BRANCH=$(acli api:environments:find ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} -n | jq -r '.vcs.path')

# If BRANCH_TO_DEPLOY is NOT the same as DEPLOYED_BRANCH. Then switch code.
if [ "${BRANCH_TO_DEPLOY}" != "${DEPLOYED_BRANCH}" ]; then
# Step 1: Run the code:switch command and capture its output.
response=$(acli api:environments:code-switch ${ACQUIA_CLOUD_APPLICATION}.${ACQUIA_CLOUD_ENVIRONMENT} ${BRANCH_TO_DEPLOY} -n)

# Step 2: Extract the notification ID from the JSON response
notification_id=$(echo "$response" | jq -r '.notification')

# Step 3: Check if the notification ID was successfully extracted.
if [[ -z "$notification_id" ]]; then
echo "Error: Notification ID not found in the response."
exit 1
fi

progress=0
timeout=1800 # Timeout in seconds (30 minutes).
start_time=$(date +%s) # Get the current time in seconds

echo "Please wait while code is being switched..."
# Step 4: Poll the notification status until progress reaches 100.
while [[ "$progress" -lt 100 ]]; do
# Run the notification find command.
notification_response=$(acli api:notifications:find "$notification_id" -n)

# Extract the progress value.
progress=$(echo "$notification_response" | jq -r '.progress')

# Display current progress.
#echo "Current progress: $progress%"

# Check if we've exceeded the timeout (5 minutes).
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))

if [[ "$elapsed_time" -ge "$timeout" ]]; then
# Calculate minutes and seconds.
minutes=$((elapsed_time / 60))
seconds=$((elapsed_time % 60))

echo "Error: Timeout reached after $minutes minute(s) and $seconds second(s). Progress did not reach 100%."
exit 1
fi

# Wait for 5 seconds before polling again.
sleep 5
done
fi
fi
47 changes: 0 additions & 47 deletions acquia-pipelines.yml

This file was deleted.

Loading
Loading