Skip to content

ci: migrate docs + vrt websites from netlify to azure #5450

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

Merged
merged 62 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
7deed4e
ci: upgraded to azure from netlify
May 7, 2025
c5a2564
ci: upgraded to azure from netlify
May 7, 2025
e00527c
ci: upgraded to azure from netlify
May 7, 2025
d1a963c
ci: upgraded to azure from netlify
May 7, 2025
055a84a
ci: upgraded to azure from netlify
May 7, 2025
7c5a931
ci: upgraded to azure from netlify
May 7, 2025
87b1879
ci: upgraded to azure from netlify
May 7, 2025
8fb7d83
ci: upgraded to azure from netlify
May 7, 2025
dc1b3f0
ci: upgraded to azure from netlify
May 7, 2025
846b0f0
ci: upgraded to azure from netlify
May 7, 2025
b194525
ci: upgraded to azure from netlify
May 8, 2025
92990ff
ci: upgraded to azure from netlify
May 8, 2025
349c75a
chore: testing azure deployments
May 8, 2025
e93be74
chore: testing azure deployments
May 8, 2025
6d5b40d
chore: testing azure deployments
May 8, 2025
53e8199
ci: try commenting with azure
TarunAdobe May 21, 2025
723480f
chore: host vrts on azure
TarunAdobe May 22, 2025
fe18be0
chore: separate azure and node jobs in circleci
TarunAdobe Jun 10, 2025
718d658
chore: fix comment cleanup and revert config.yml
TarunAdobe Jun 10, 2025
fc20d0f
chore: fix typo in circleci
TarunAdobe Jun 10, 2025
00e5067
chore: migrate hcm-visual to azure swa
TarunAdobe Jun 10, 2025
2582126
chore: migrate other visual tests to azure swa
TarunAdobe Jun 10, 2025
f997a44
chore: try using a share env for all tests
TarunAdobe Jun 10, 2025
9f82a25
chore: create separate urls for each vrt combinations
TarunAdobe Jun 11, 2025
1b52ddd
chore: use same subdirectories
TarunAdobe Jun 11, 2025
8a6b5ce
chore: only run 1 vrt for testing
TarunAdobe Jun 12, 2025
4973a9b
chore: revert hcm back to deploying from test/visual
TarunAdobe Jun 12, 2025
482a47a
chore: persist each vrt run and deploy separately
TarunAdobe Jun 12, 2025
4f0efb7
chore: run vrts for only selected packages
TarunAdobe Jun 12, 2025
b66d629
chore: add debugging logic to test ci
TarunAdobe Jun 12, 2025
99bec5d
chore: use azure blob storage for doc preview site
TarunAdobe Jun 16, 2025
3dacc88
Merge branch 'main' into rajdeep/azure-circle-ci
TarunAdobe Jun 16, 2025
22dbae9
chore: fix preview docs
TarunAdobe Jun 16, 2025
d8899e5
chore: use a clean sas token
TarunAdobe Jun 16, 2025
5a4ca2c
chore: migrate vrts to azure blob storage
TarunAdobe Jun 16, 2025
57b6513
chore: add vrt comments from github actions
TarunAdobe Jun 16, 2025
cb3d9db
chore: use same subdirectory for all commits
TarunAdobe Jun 16, 2025
e870f41
chore: run all vrts now cz im done
TarunAdobe Jun 16, 2025
c91b446
chore: pinned azcopy version and minor fixes
TarunAdobe Jun 17, 2025
9698bf7
chore: wait for deploy job before smoke testing
TarunAdobe Jun 17, 2025
a670df2
chore: add swc_dir to smoke tests
TarunAdobe Jun 17, 2025
ca01ca0
chore: pr comments
TarunAdobe Jun 18, 2025
76139c7
chore: add fallback for missing circleci vars
TarunAdobe Jun 18, 2025
8f8c78f
chore: rerun ci on opening a pr
TarunAdobe Jun 18, 2025
31896de
chore: migrate beta-docs to azure blob storage
TarunAdobe Jun 18, 2025
2eb38a5
chore: remove all netlify instances (#5548)
TarunAdobe Jun 19, 2025
439f6c4
Merge branch 'main' into rajdeep/azure-circle-ci
TarunAdobe Jun 19, 2025
ad33e5f
chore: remove netlify from gitignore
TarunAdobe Jun 20, 2025
d66d6fe
Merge branch 'main' into rajdeep/azure-circle-ci
TarunAdobe Jun 20, 2025
01283a8
chore: hash packagejson in docs workflow
TarunAdobe Jun 23, 2025
799439a
chore: use spn vars instead of sas token for azure
TarunAdobe Jun 23, 2025
5e8e27e
chore: minor code review changes
TarunAdobe Jun 23, 2025
6e42f20
chore: use a secure way for azure auth in ci
TarunAdobe Jun 23, 2025
32b3d2d
Merge branch 'main' into rajdeep/azure-circle-ci
TarunAdobe Jun 23, 2025
00799ac
chore: remove single quoted echo
TarunAdobe Jun 23, 2025
46f0f0d
Merge branch 'main' into rajdeep/azure-circle-ci
rubencarvalho Jun 23, 2025
c90e863
chore: remove debugging echos
rubencarvalho Jun 23, 2025
b42fd37
chore: add debugging logs
TarunAdobe Jun 24, 2025
7ca2a12
chore: add env vars to bash env
TarunAdobe Jun 24, 2025
b44ac75
chore: remove custom trigger to ci workflow
TarunAdobe Jun 24, 2025
91374a1
chore: run install azcopy always
TarunAdobe Jun 24, 2025
a6b7ed9
Merge branch 'main' into rajdeep/azure-circle-ci
rubencarvalho Jun 25, 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
230 changes: 164 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
version: 2.1

executors:
default:
docker:
- image: cimg/base:stable
resource_class: medium
node:
docker:
- image: mcr.microsoft.com/playwright:v1.44.0
resource_class: xlarge
environment:
NODE_ENV: development
AZCOPY_AUTO_LOGIN_TYPE: SPN
AZCOPY_SPA_APPLICATION_ID: $AZURE_CLIENT_ID
AZCOPY_SPA_CLIENT_SECRET: $AZURE_CLIENT_SECRET
AZCOPY_TENANT_ID: $AZURE_TENANT_ID
parameters:
# In order to update the VRT baseline images:
# 1. Copy the hash of the latest golden images cache from the left sidebar in the VRT preview link (not to be confused with the arbitrary hash in the URL).
Expand All @@ -19,6 +27,27 @@ parameters:
type: string
default: wireit
commands:
install-azcopy:
description: 'Install AzCopy and set up authentication'
steps:
- run:
when: always
name: Install AzCopy
command: |
# Create a bin directory in the home folder
mkdir -p ~/bin
cd ~/bin
wget -O azcopy.tar.gz https://github.com/Azure/azure-storage-azcopy/releases/download/v10.29.1/azcopy_linux_amd64_10.29.1.tar.gz
tar -xf azcopy.tar.gz --strip-components=1
chmod +x azcopy
# Add to PATH and set environment variables
echo 'export PATH=~/bin:$PATH' >> $BASH_ENV
echo 'export AZCOPY_AUTO_LOGIN_TYPE="SPN"' >> $BASH_ENV
echo 'export AZCOPY_SPA_APPLICATION_ID="$AZURE_CLIENT_ID"' >> $BASH_ENV
echo 'export AZCOPY_SPA_CLIENT_SECRET="$AZURE_CLIENT_SECRET"' >> $BASH_ENV
echo 'export AZCOPY_TENANT_ID="$AZURE_TENANT_ID"' >> $BASH_ENV
source $BASH_ENV
azcopy --version
downstream:
steps:
- checkout
Expand Down Expand Up @@ -97,32 +126,66 @@ commands:
branch=$(git symbolic-ref --short HEAD)
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="<< parameters.regression_system >> << parameters.regression_color >> << parameters.regression_scale >> << parameters.regression_dir >>"
yarn rollup -c test/visual/rollup.config.js
- install-azcopy
- run:
when: always
name: Publish review site
name: Deploy VRT Results to Azure Blob Storage
command: |
cp projects/documentation/content/favicon.ico test/visual
branch=$(git symbolic-ref --short HEAD)
hash=$(echo -n $branch-<< parameters.regression_system >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >> | md5sum | cut -c 1-32)
echo "Netlify alias hash: $hash"
echo "Deploying from test/visual directory..."

max_attempts=3
attempt=0

while [ $attempt -lt $max_attempts ]; do
if yarn netlify deploy --alias=$hash --cwd test/visual; then
echo "Deployment successful!"
exit 0
# Get PR number from CircleCI environment
PR_NUMBER=""
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
echo "Deploying VRT for PR #$PR_NUMBER"
elif [ -n "$CIRCLE_PR_NUMBER" ]; then
PR_NUMBER="$CIRCLE_PR_NUMBER"
echo "Deploying VRT for PR #$PR_NUMBER"
elif [[ "$CIRCLE_BRANCH" =~ ^pull/[0-9]+$ ]]; then
PR_NUMBER=$(echo $CIRCLE_BRANCH | sed 's/pull\///')
echo "Deploying VRT for forked PR #$PR_NUMBER"
elif [ -n "$GITHUB_TOKEN" ]; then
# GitHub API fallback
PR_NUMBER=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \
| grep -o '"number":[0-9]*' | head -1 | sed 's/"number"://')

if [ -n "$PR_NUMBER" ]; then
echo "Deploying VRT for PR #$PR_NUMBER (via GitHub API)"
else
attempt=$((attempt + 1))
echo "Deploy failed, retrying ($attempt/$max_attempts)..."
sleep 10 # Adjust delay if needed
echo "⏭️ No PR found - skipping VRT deployment"
exit 0
fi
done
else
echo "⏭️ No PR detected - skipping VRT deployment"
exit 0
fi

# Only proceed if we have a valid PR number
if [ -z "$PR_NUMBER" ]; then
echo "⏭️ No PR number available - skipping VRT deployment"
exit 0
fi

echo "Deployment failed after $max_attempts attempts."
exit 1
# Create PR hash using just PR number for overwriting deployments
PR_HASH="pr-${PR_NUMBER}"

# VRT combination for subdirectory
combination="<< parameters.regression_system >>-<< parameters.regression_color >>-<< parameters.regression_scale >>-<< parameters.regression_dir >>"

# Prepare files for deployment
cp projects/documentation/content/favicon.ico test/visual/ || echo "Failed to copy favicon"

# Upload VRT results to Azure Blob Storage
echo "Uploading VRT results to ${PR_HASH}/${combination}/"
azcopy copy "test/visual/*" \
"https://swcpreviews.blob.core.windows.net/\$web/${PR_HASH}/${combination}/" \
--recursive \
--from-to LocalBlob

# Generate the deployment URL
VRT_URL="https://swcpreviews.z13.web.core.windows.net/${PR_HASH}/${combination}/"
echo "$VRT_URL" > vrt_url.txt
echo "VRT URL for ${combination}: $VRT_URL"

# move "updated" screenshot into the baseline directory before making the new cache
- run:
Expand Down Expand Up @@ -195,27 +258,17 @@ jobs:
- store_test_results:
path: /root/project/results/

preview-docs:
lint:
executor: node

steps:
- downstream
- run:
name: Generate Custom Elements Manifest
command: yarn docs:analyze
name: Lint
command: yarn lint
- run:
name: Move CEM to Storybook directory
command: cp projects/documentation/custom-elements.json storybook/
- run:
name: Build documentation
command: yarn docs:build
- run:
name: Build Storybook
command: yarn storybook:build
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
- run: |
branch=$(git symbolic-ref --short HEAD)
branch=$(npx slugify-cli $branch)
yarn netlify deploy --alias=$branch --cwd projects/documentation
name: Are there changes?
command: git diff-files --exit-code

beta-docs:
executor: node
Expand All @@ -234,11 +287,29 @@ jobs:
- run:
name: Build Storybook
command: yarn storybook:build
- run: echo '/* /index.html 200' > projects/documentation/dist/_redirects
- run: |
branch=$(git symbolic-ref --short HEAD)
branch=$(npx slugify-cli $branch)
yarn netlify deploy --alias=beta --cwd projects/documentation
- install-azcopy
- run:
name: Deploy Beta Documentation to Azure Blob Storage
command: |
# Upload documentation to beta path
echo "Uploading documentation to beta/docs/"
azcopy copy "projects/documentation/dist/*" \
"https://swcpreviews.blob.core.windows.net/\$web/beta/docs/" \
--recursive \
--from-to LocalBlob

# Upload Storybook to beta path
echo "Uploading Storybook to beta/docs/storybook/"
azcopy copy "storybook-static/*" \
"https://swcpreviews.blob.core.windows.net/\$web/beta/docs/storybook/" \
--recursive \
--from-to LocalBlob

# Generate the deployment URLs
DOCS_URL="https://swcpreviews.z13.web.core.windows.net/beta/docs/"
STORYBOOK_URL="https://swcpreviews.z13.web.core.windows.net/beta/docs/storybook/"
echo "Beta Documentation URL: $DOCS_URL"
echo "Beta Storybook URL: $STORYBOOK_URL"

hcm-visual:
executor: node
Expand Down Expand Up @@ -281,32 +352,64 @@ jobs:
branch=$(git symbolic-ref --short HEAD)
node test/visual/review.js --branch=$branch --commit=<< pipeline.git.revision >> --system="hcm"
yarn rollup -c test/visual/rollup.config.js
- install-azcopy
- run:
when: always
name: Publish review site
name: Deploy Visual Tests to Azure Blob Storage
command: |
cp projects/documentation/content/favicon.ico test/visual
branch=$(git symbolic-ref --short HEAD)
hash=$(echo -n $branch-hcm | md5sum | cut -c 1-32)
echo "Netlify alias hash: $hash"
echo "Deploying from test/visual directory..."

max_attempts=3
attempt=0

while [ $attempt -lt $max_attempts ]; do
if yarn netlify deploy --alias=$hash --cwd test/visual; then
echo "Deployment successful!"
exit 0
# Get PR number from CircleCI environment
set +x
PR_NUMBER=""
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
set +x
if [ -n "$CIRCLE_PULL_REQUEST" ]; then

PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's/.*\/pull\///')
Copy link
Contributor

Choose a reason for hiding this comment

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

Under what circumstance does this not exist? CIRCLE_PR_NUMBER shows to always be there. 🤔
I'd love to get rid of the complexity below 😛

Copy link
Contributor

Choose a reason for hiding this comment

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

its flaky. i tested by making many prs and there were a total of 2 instances out of 7-8 where this didn't exist.
https://discuss.circleci.com/t/ci-pull-reuqest-and-other-pr-environment-variables-are-missing/38535
this has happened before and to a lot of many people so i wanted to avoid flakiness here

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the context! I’m OK with keeping the fallback logic for now, but could we try to pinpoint when it is missing and follow up with CircleCI support?
For example, we know the PR-related env vars are only set when the build is part of a PR - could those failures have happened on a regular branch commit?

echo "Deploying HCM VRT for PR #$PR_NUMBER"
elif [ -n "$CIRCLE_PR_NUMBER" ]; then
PR_NUMBER="$CIRCLE_PR_NUMBER"
echo "Deploying HCM VRT for PR #$PR_NUMBER"
elif [[ "$CIRCLE_BRANCH" =~ ^pull/[0-9]+$ ]]; then
PR_NUMBER=$(echo $CIRCLE_BRANCH | sed 's/pull\///')
echo "Deploying HCM VRT for forked PR #$PR_NUMBER"
elif [ -n "$GITHUB_TOKEN" ]; then
# GitHub API fallback
PR_NUMBER=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls?head=$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH&state=open" \
| grep -o '"number":[0-9]*' | head -1 | sed 's/"number"://')

if [ -n "$PR_NUMBER" ]; then
echo "Deploying HCM VRT for PR #$PR_NUMBER (via GitHub API)"
else
attempt=$((attempt + 1))
echo "Deploy failed, retrying ($attempt/$max_attempts)..."
sleep 10 # Adjust delay if needed
echo "⏭️ No PR found - skipping HCM VRT deployment"
exit 0
fi
done
else
echo "⏭️ No PR detected - skipping HCM VRT deployment"
exit 0
fi

# Only proceed if we have a valid PR number
if [ -z "$PR_NUMBER" ]; then
echo "⏭️ No PR number available - skipping HCM VRT deployment"
exit 0
fi

# Create PR hash using just PR number for overwriting deployments
PR_HASH="pr-${PR_NUMBER}"

# Prepare files for deployment
cp projects/documentation/content/favicon.ico test/visual/

echo "Deployment failed after $max_attempts attempts."
exit 1
# Upload HCM VRT results to Azure Blob Storage
echo "Uploading HCM VRT to ${PR_HASH}/hcm/"
azcopy copy "test/visual/*" \
"https://swcpreviews.blob.core.windows.net/\$web/${PR_HASH}/hcm/" \
--recursive \
--from-to LocalBlob

# Generate the deployment URL
VRT_URL="https://swcpreviews.z13.web.core.windows.net/${PR_HASH}/hcm/"
echo "$VRT_URL" > vrt_url.txt
echo "HCM Visual Test URL: $VRT_URL"

# move "updated" screenshot into the baseline directory before making the new cache
- run:
Expand Down Expand Up @@ -357,11 +460,6 @@ workflows:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- preview-docs:
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- beta-docs:
filters:
branches:
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/setup-azcopy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Setup AzCopy'
description: 'Downloads and installs AzCopy for use in workflows'

runs:
using: composite
steps:
- name: Install AzCopy
shell: bash
run: |
# Download and install AzCopy
wget -O azcopy.tar.gz https://github.com/Azure/azure-storage-azcopy/releases/download/v10.29.1/azcopy_linux_amd64_10.29.1.tar.gz
tar -xf azcopy.tar.gz --strip-components=1
sudo mv azcopy /usr/local/bin/
azcopy --version
Loading
Loading