diff --git a/.bacon.yml b/.bacon.yml index 68a6802e6b..ece167be3f 100644 --- a/.bacon.yml +++ b/.bacon.yml @@ -17,18 +17,16 @@ test_suites: - 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 + script_path: /root/okta/odyssey/scripts sort_order: "6" timeout: "20" - 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: "5" @@ -51,21 +49,21 @@ test_suites: - 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: "8" timeout: "15" - script_name: publish-package - criteria: MERGE - queue_name: ci-queue-productionJenga-AL2023 - name: "Publish Storybook" abort_commit_on_failure: true + criteria: MERGE + queue_name: ci-queue-productionJenga-AL2023 + script_name: publish-storybook script_path: /root/okta/odyssey/scripts sort_order: "9" timeout: "15" - script_name: publish-storybook-topic - criteria: MERGE - queue_name: ci-queue-productionJenga-AL2023 - name: "Semgrep" criteria: MERGE @@ -77,11 +75,11 @@ test_suites: - name: "Test" abort_commit_on_failure: true - script_path: /root/okta/odyssey/scripts - sort_order: "3" - script_name: unit-test criteria: MERGE queue_name: ci-queue-productionJenga-AL2023 + script_name: unit-test + script_path: /root/okta/odyssey/scripts + sort_order: "3" timeout: "20" - name: "Typecheck" @@ -101,9 +99,9 @@ test_suites: - 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" - script_name: visual-regression-test - criteria: MERGE - queue_name: ci-queue-productionJenga-AL2023 timeout: "20" diff --git a/scripts/publish-package.sh b/scripts/publish-packages.sh similarity index 100% rename from scripts/publish-package.sh rename to scripts/publish-packages.sh diff --git a/scripts/publish-storybook-temp.sh b/scripts/publish-storybook-temp.sh new file mode 100644 index 0000000000..5ceb1c302e --- /dev/null +++ b/scripts/publish-storybook-temp.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +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 diff --git a/scripts/publish-storybook-topic.sh b/scripts/publish-storybook-topic.sh deleted file mode 100644 index b1bd3445c5..0000000000 --- a/scripts/publish-storybook-topic.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 diff --git a/scripts/publish-storybook.sh b/scripts/publish-storybook.sh index 5ceb1c302e..b1bd3445c5 100644 --- a/scripts/publish-storybook.sh +++ b/scripts/publish-storybook.sh @@ -4,62 +4,24 @@ 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 +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 -npm config set @okta:registry ${PUBLISH_REGISTRY} +export URL_STORYBOOK="https://${SHA}.ods.dev" +echo $URL_STORYBOOK -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} -} +# Build all packages except Storybook because it's excluded. +yarn build -# prevent local changes from being reported so lerna can publish -git checkout . +# Build Storybook package. +cd ./packages/odyssey-storybook && rm -rf ./node_modules/.cache && yarn build -# All packages are built by `prepack`. +aws s3 sync ./dist/ s3://ods.dev/$SHA --delete -# 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 +# bash ./scripts/notify-slack.sh -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 +echo "Publish successful." +log_custom_message "Storybook URL" $URL_STORYBOOK exit $SUCCESS diff --git a/scripts/setup.sh b/scripts/setup.sh index 0a3b411823..74834b07ca 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -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."