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

Adds Storybook topic deploys to Bacon #2292

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
cfd4edc
fix: upgrades Applitools
KevinGhadyani-Okta May 24, 2024
181ba04
fix: reduces Applitools concurrency per Ali Parsa
KevinGhadyani-Okta May 24, 2024
f849a50
fix: adds Visual Regression Test to Bacon
KevinGhadyani-Okta May 24, 2024
7e12332
fix: adds Storybook publish script
KevinGhadyani-Okta May 24, 2024
45117e3
fix: updates visual regression test script
KevinGhadyani-Okta May 24, 2024
871f36e
fix: updates Bacon yaml
KevinGhadyani-Okta May 24, 2024
cd4b49a
Merge branch 'main' into kg_bacon_another
KevinGhadyani-Okta May 24, 2024
85a3572
fix: removed root version number that isn't used in Odyssey
KevinGhadyani-Okta May 28, 2024
2ddc7c2
fix: add releng.yml
KevinGhadyani-Okta May 31, 2024
00a5804
fix: updates to 1.17.1
KevinGhadyani-Okta Jun 4, 2024
78568bd
fix: rename releng.yml to .releng.yml
KevinGhadyani-Okta Jun 5, 2024
0c5f359
Merge branch '1.17' into kg_bacon_another
KevinGhadyani-Okta Jun 11, 2024
04b320f
fix: added APPLITOOLS_SERVER_URL as an env var to visual-regression-t…
KevinGhadyani-Okta Jun 11, 2024
38248ff
feat: updated Storybook publish steps
KevinGhadyani-Okta Jun 11, 2024
6ee893b
fix: update queue name of Visual Regression test
KevinGhadyani-Okta Jun 11, 2024
5263842
fix: adds vrt logging
KevinGhadyani-Okta Jun 13, 2024
594deea
fix: install Chromium before running VRTs
KevinGhadyani-Okta Jun 13, 2024
c028e1d
fix: trying snap install
KevinGhadyani-Okta Jun 13, 2024
68fdca7
fix: only installing Chromium with snap
KevinGhadyani-Okta Jun 13, 2024
097af4f
fix: change to setup_service
KevinGhadyani-Okta Jun 13, 2024
e5b4d2e
fix: another attempt at a Chromium install
KevinGhadyani-Okta Jun 14, 2024
c312888
build: fix VRT using Monolith version
KevinGhadyani-Okta Jun 17, 2024
12954f4
fix: removes unused Chrome check
KevinGhadyani-Okta Jun 20, 2024
4e2904d
build: adds chromedriver install
KevinGhadyani-Okta Jul 8, 2024
084e9b2
build: upgrades chrome version
KevinGhadyani-Okta Jul 8, 2024
aed2a42
build: use Artifactory chromedriver
KevinGhadyani-Okta Jul 8, 2024
84f019f
build: updates CHROME_DRIVER variable name
KevinGhadyani-Okta Jul 8, 2024
e881621
Merge remote-tracking branch 'origin/main' into kg_bacon_another
KevinGhadyani-Okta Jul 8, 2024
6c2da9f
fix: upgrades eyes-storybook
KevinGhadyani-Okta Jul 8, 2024
d1287f3
fix: adds logging from Applitools
KevinGhadyani-Okta Jul 9, 2024
9ea0522
build: potential fix for Puppeteer failing on Amazon Linux 2023
KevinGhadyani-Okta Jul 9, 2024
ecea098
build: second fix for Puppeteer to get Applitools working on Amazon L…
KevinGhadyani-Okta Jul 9, 2024
f0f99ab
build: running VRTs as limited user
KevinGhadyani-Okta Jul 9, 2024
9cdab4f
build: add Puppeteer debugging
KevinGhadyani-Okta Jul 9, 2024
a544c76
build: try running VRTs as another user again
KevinGhadyani-Okta Jul 9, 2024
4c1466c
build: forced headless in Applitools
KevinGhadyani-Okta Jul 10, 2024
d699b18
build: seeing if interaction tests work with the AL2023 image
KevinGhadyani-Okta Jul 10, 2024
36f5d7d
build: removed `sudo` from VRTs chromedriver install
KevinGhadyani-Okta Jul 10, 2024
df24f84
Revert "build: seeing if interaction tests work with the AL2023 image"
KevinGhadyani-Okta Jul 10, 2024
2fdcb0f
build: removes creating user and fixes chromedriver code
KevinGhadyani-Okta Jul 10, 2024
26f36e8
build: updates Storybook topic deploy to use Aperture
KevinGhadyani-Okta Jul 12, 2024
f9806fb
build: adds missing build step to publishing topic package and Storybook
KevinGhadyani-Okta Jul 12, 2024
fe0992f
build: switched from npm-release to npm-topic for Storybook Aperture
KevinGhadyani-Okta Jul 12, 2024
deb68f5
build: storybook topic
KevinGhadyani-Okta Jul 15, 2024
3be4bc4
build: adds Storybook URL
KevinGhadyani-Okta Jul 15, 2024
f64ae35
build: removes Notify Slack webhook for now
KevinGhadyani-Okta Jul 15, 2024
021d23d
build: deploy storybook from correct dist dir
KevinGhadyani-Okta Jul 15, 2024
9ef5616
build: fixed Storybook topic publish step
KevinGhadyani-Okta Jul 15, 2024
97243f3
build: attempt at fixing Storybook topic deploy
KevinGhadyani-Okta Jul 15, 2024
7f9c08c
build: made VRTs optional as they're not yet working
KevinGhadyani-Okta Jul 16, 2024
9b692fc
build: removed extra logging from Applitools config
KevinGhadyani-Okta Jul 18, 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
94 changes: 52 additions & 42 deletions .bacon.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
test_suites:
- name: "build"
- name: "Build"
abort_commit_on_failure: true
criteria: MERGE
prereq_test_suite_names:
- "lint"
- "test"
- "typecheck"
queue_name: al2023
queue_name: ci-queue-productionJenga-AL2023
script_path: /root/okta/odyssey/scripts
sort_order: "1"
sort_order: "4"
steps:
- event: SOURCE
action: setup.sh
Expand All @@ -18,43 +14,30 @@ test_suites:
name: Build Packages
timeout: "20"

- name: publish
abort_commit_on_failure: true
script_path: /root/okta/odyssey/scripts
sort_order: "2"
timeout: "15"
script_name: publish
criteria: MERGE
prereq_test_suite_names:
- "build"
queue_name: al2023

- name: "code coverage"
- name: "Code Coverage"
abort_commit_on_failure: true
criteria: OPTIONAL
# Playwright only works with certain distros of Linux
queue_name: ci-queue-prodJenga-Ubuntu20
script_path: /root/okta/odyssey/scripts
queue_name: ci-queue-prodJenga-Ubuntu20 # Playwright only works with certain distros of Linux
script_name: code-coverage
sort_order: "5"
script_path: /root/okta/odyssey/scripts
sort_order: "6"
timeout: "20"

- name: "interaction test"
- name: "Interaction Test"
abort_commit_on_failure: true
criteria: MERGE
# Playwright only works with certain distros of Linux
queue_name: ci-queue-prodJenga-Ubuntu20
queue_name: ci-queue-prodJenga-Ubuntu20 # Playwright only works with certain distros of Linux
script_path: /root/okta/odyssey/scripts
script_name: interaction-test
sort_order: "6"
sort_order: "5"
timeout: "20"

- name: "lint"
- name: "Lint"
abort_commit_on_failure: true
criteria: MERGE
queue_name: al2023
queue_name: ci-queue-productionJenga-AL2023
script_path: /root/okta/odyssey/scripts
sort_order: "3"
sort_order: "1"
steps:
- event: SOURCE
action: setup.sh
Expand All @@ -64,21 +47,47 @@ test_suites:
name: Lint Code
timeout: "20"

- name: "test"
- name: "Publish Package"
abort_commit_on_failure: true
criteria: MERGE
queue_name: ci-queue-productionJenga-AL2023
script_name: publish-packages
script_path: /root/okta/odyssey/scripts
sort_order: "4"
script_name: unit-test
sort_order: "8"
timeout: "15"

- name: "Publish Storybook"
abort_commit_on_failure: true
criteria: MERGE
queue_name: al2023
timeout: "20"
queue_name: ci-queue-productionJenga-AL2023
script_name: publish-storybook
script_path: /root/okta/odyssey/scripts
sort_order: "9"
timeout: "15"

- name: "typecheck"
- name: "Semgrep"
criteria: MERGE
queue_name: ci-queue-productionJenga-AL2023
script_name: semgrep
script_path: /root/okta/odyssey/scripts
sort_order: "7"
timeout: "10"

- name: "Test"
abort_commit_on_failure: true
criteria: MERGE
queue_name: al2023
queue_name: ci-queue-productionJenga-AL2023
script_name: unit-test
script_path: /root/okta/odyssey/scripts
sort_order: "3"
timeout: "20"

- name: "Typecheck"
abort_commit_on_failure: true
criteria: MERGE
queue_name: ci-queue-productionJenga-AL2023
script_path: /root/okta/odyssey/scripts
sort_order: "2"
steps:
- event: SOURCE
action: setup.sh
Expand All @@ -88,10 +97,11 @@ test_suites:
name: Typecheck Code
timeout: "20"

- name: semgrep
criteria: MERGE
queue_name: al2023
script_name: semgrep
- name: "Visual Regression Test"
abort_commit_on_failure: true
criteria: OPTIONAL
queue_name: ci-queue-productionJenga-AL2023
script_name: visual-regression-test
script_path: /root/okta/odyssey/scripts
sort_order: "7"
timeout: "10"
timeout: "20"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,5 @@
"ws@npm:8.13.0": "^8.17.1",
"ws@npm:8.16.0": "^8.17.1"
},
"version": "0.6.0",
"packageManager": "[email protected]"
}
6 changes: 5 additions & 1 deletion packages/odyssey-storybook/applitools.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ module.exports = {
exitcode: true,
matchLevel: "Strict",
parentBranchName,
puppeteerOptions: {
args: ["--no-sandbox", "--disable-setuid-sandbox"],
headless: true,
},
serverUrl: "https://oktaeyes.applitools.com",
showStorybookOutput: true,
testConcurrency: 10,
testConcurrency: 5,
};
9 changes: 5 additions & 4 deletions packages/odyssey-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@storybook/theming": "^7.2.0"
},
"devDependencies": {
"@applitools/eyes-storybook": "^3.47.0",
"@applitools/eyes-storybook": "^3.50.6",
"@babel/core": "^7.23.9",
"@okta/odyssey-babel-loader": "workspace:*",
"@okta/odyssey-lifecycle": "workspace:*",
Expand Down Expand Up @@ -69,11 +69,12 @@
},
"scripts": {
"build": "storybook build --output-dir dist",
"ci:coverage": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --coverage --browsers chromium --ci\"",
"ci:interactionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --browsers chromium --ci\"",
"ci:visualRegressionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,VISUAL-REGRESSION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn eyes-storybook --conf ./applitools.config.js -u http://127.0.0.1:6006\"",
"dev:coverage": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --url http://127.0.0.1:6006\" --coverage",
"dev:interactionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --url http://127.0.0.1:6006\"",
"ci:coverage": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --coverage --browsers chromium --ci\"",
"ci:interactionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,INTERACTION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn test-storybook --browsers chromium --ci\"",
"dev:visualRegressionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,VISUAL-REGRESSION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn eyes-storybook --conf ./applitools.config.js -u http://127.0.0.1:6006\"",
"dev:visualRegressionTest": "yarn build && yarn concurrently --kill-others --success first --names \"STORYBOOK-SERVER,VISUAL-REGRESSION-TEST\" --prefix-colors \"magenta,green\" \"http-server dist --port 6006 --silent\" \"wait-on tcp:127.0.0.1:6006 && yarn eyes-storybook --conf ./applitools.config.js -u http://127.0.0.1:6006\"",
"prepack": "yarn build && yarn exec prepack",
"start:storybook": "storybook dev -p 6006",
"start:types": "tsc --build --watch",
Expand Down
2 changes: 1 addition & 1 deletion scripts/interaction-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ fi

# Tests were successful if it reached here
echo "Playwright tests passed!"
report_results SUCCESS publish_type_and_result_dir_but_succeed_if_no_results
report_results SUCCESS publish_type_and_result_dir_but_succeed_if_no_results
2 changes: 2 additions & 0 deletions scripts/publish.sh → scripts/publish-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function lerna_publish() {
# prevent local changes from being reported so lerna can publish
git checkout .

# All packages are built by `prepack`.

# update version with commit SHA to allow lerna to publish
FILES_TO_UPDATE_VERSION="lerna.json packages/odyssey-design-tokens/package.json packages/odyssey-babel-preset/package.json packages/odyssey-babel-loader/package.json packages/odyssey-react-mui/package.json packages/browserslist-config-odyssey/package.json"
for PATH_AND_FILE in $FILES_TO_UPDATE_VERSION; do
Expand Down
65 changes: 65 additions & 0 deletions scripts/publish-storybook-temp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this -temp file still needed? I don't see it referenced in .bacon.yml or the other scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I might switch over to this -temp method of hitting Aperture after I finish up the other tasks, so we're not having to hit S3 directly.


source $OKTA_HOME/$REPO/scripts/setup.sh

cd $OKTA_HOME/$REPO

PUBLISH_SHA="$(git rev-parse --short $SHA)"
PUBLISH_REGISTRY="${ARTIFACTORY_URL}/api/npm/npm-topic"
CURRENT_VERSION=$(< lerna.json jq -r '.version')
TAGGED_VERSION=$CURRENT_VERSION-$PUBLISH_SHA

npm config set @okta:registry ${PUBLISH_REGISTRY}

function lerna_publish() {
# use lerna to publish without making a commit to the repo
MY_CMD="yarn run lerna publish from-package --force-publish=* --ignore-changes --no-push --no-git-tag-version --no-verify-access --registry \"${PUBLISH_REGISTRY}\" --yes"
echo "Running ${MY_CMD}"
${MY_CMD}
}

# prevent local changes from being reported so lerna can publish
git checkout .

# All packages are built by `prepack`.

# update version with commit SHA to allow lerna to publish
FILES_TO_UPDATE_VERSION="packages/odyssey-storybook/package.json"
for PATH_AND_FILE in $FILES_TO_UPDATE_VERSION; do
FULL_PATH="$OKTA_HOME/$REPO/$PATH_AND_FILE"
json_contents="$(jq '.version = "'$TAGGED_VERSION'"' $FULL_PATH)" && \
echo -E "${json_contents}" > $FULL_PATH
git update-index --assume-unchanged $FULL_PATH
done

echo "Publishing to artifactory"
if ! lerna_publish; then
echo "ERROR: Lerna Publish has failed."
exit $PUBLISH_ARTIFACTORY_FAILURE
else
echo "Publish successful. Sending promotion message"
fi

##
## Publish docs
##
## While the package artifact is already in npm-release, we use this
## promotion event workaround to trigger the conductor workflow to deploy
##

echo "Publish successful. Sending promotion message"

function send_promotion_message() {
curl -H "x-aurm-token: ${AURM_TOKEN}" \
-H "Content-Type: application/json" \
-X POST -d "[{\"artifactId\":\"$1\",\"repository\":\"npm-topic\",\"artifact\":\"$2\",\"version\":\"$3\",\"promotionType\":\"ARTIFACT\"}]" \
-k "${APERTURE_BASE_URL}/v1/artifact-promotion/createPromotionEvent"
}

ARTIFACT="@okta/odyssey-storybook/-/@okta/odyssey-storybook-${CURRENT_VERSION}.tgz"
echo "Artifact is ${ARTIFACT}"
if ! send_promotion_message "odyssey-storybook" "${ARTIFACT}" "${CURRENT_VERSION}"; then
echo "Error sending docs promotion event to Aperture"
fi

exit $SUCCESS
27 changes: 27 additions & 0 deletions scripts/publish-storybook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

source $OKTA_HOME/$REPO/scripts/setup.sh

cd $OKTA_HOME/$REPO

get_terminus_secret "/" AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID
get_terminus_secret "/" AWS_SECRET_ACCESS_KEY AWS_SECRET_ACCESS_KEY
get_terminus_secret "/" AWS_REGION AWS_REGION

export URL_STORYBOOK="https://${SHA}.ods.dev"
echo $URL_STORYBOOK

# Build all packages except Storybook because it's excluded.
yarn build

# Build Storybook package.
cd ./packages/odyssey-storybook && rm -rf ./node_modules/.cache && yarn build

aws s3 sync ./dist/ s3://ods.dev/$SHA --delete

# bash ./scripts/notify-slack.sh

echo "Publish successful."
log_custom_message "Storybook URL" $URL_STORYBOOK

exit $SUCCESS
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ else
fi

echo "installing yarn v${YARN_VERSION}"
if setup_service yarn ${YARN_VERSION}; then
if setup_service yarn-berry ${YARN_VERSION}; then
echo "Installed yarn ${YARN_VERSION} successfully"
else
echo "Yarn ${YARN_VERSION} installation failed."
Expand Down
43 changes: 43 additions & 0 deletions scripts/visual-regression-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -x

source $OKTA_HOME/$REPO/scripts/setup.sh

cd $OKTA_HOME/$REPO

export TEST_SUITE_TYPE="junit"
export TEST_RESULT_FILE_DIR="${REPO}/src/v3/build2/reports/unit"
echo $TEST_SUITE_TYPE > $TEST_SUITE_TYPE_FILE
echo $TEST_RESULT_FILE_DIR > $TEST_RESULT_FILE_DIR_FILE

get_terminus_secret "/" APPLITOOLS_API_KEY APPLITOOLS_API_KEY
get_terminus_secret "/" APPLITOOLS_SERVER_URL APPLITOOLS_SERVER_URL

if [[ -z "$APPLITOOLS_API_KEY" ]]; then
echo "Error in getting APPLITOOLS_API_KEY from Terminous."
report_results FAILURE PUBLISH_TYPE_AND_RESULT_DIR_BUT_SUCCEED_IF_NO_RESULTS
exit 1
fi

export APPLITOOLS_SHOW_LOGS=true
export CHROME_VERSION="126.0.6478.55"

if ! setup_service google-chrome-stable ${CHROME_VERSION}-1 ; then
echo "failure" > ${setup_chrome_status_file}
fi

if ! wget https://artifacts.aue1e.internal/artifactory/thirdparty-yum/x86_64/chrome-sel3/${CHROME_VERSION}-1/webdriver/${CHROME_VERSION}/chromedriver-linux64.zip ; then
echo "failure" > ${setup_chrome_status_file}
fi

unzip chromedriver_linux64.zip
mv chromedriver_linux64 /usr/local/bin/
chmod +x /usr/local/bin/chromedriver_linux64
rm chromedriver_linux64.zip

if ! yarn workspace @okta/odyssey-storybook ci:visualRegressionTest; then
echo "Applitools Visual Regression Tests failed! Exiting..."
exit ${PUBLISH_TYPE_AND_RESULT_DIR_BUT_ALWAYS_FAIL}
fi

echo "Visual Regression Tests passed!"
report_results SUCCESS publish_type_and_result_dir_but_succeed_if_no_results
Loading
Loading