Skip to content
Merged
Changes from all commits
Commits
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
13 changes: 10 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ jobs:
# - PR builds pass the branch name in as release_ref, so massage it if it is missing a semver prefix.
echo "Branch (PR) build detected, sanitizing release tag..."
LAST_SEMVER_TAG=$(git describe --tags --match 'v*.*.*' --abbrev=0 | cut -d"-" -f1)
RELEASE_REF="${LAST_SEMVER_TAG}-<< parameters.release_ref >>"
BRANCH_NAME=$(echo "<< parameters.release_ref >>" | sed 's/\//-/g')
RELEASE_REF="${LAST_SEMVER_TAG}-${BRANCH_NAME}"
Comment on lines +270 to +271
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 This replaces / with - as if the slash stretches between words. This makes a valid semantic version.

Copy link
Member

Choose a reason for hiding this comment

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

LOVE THIS! ❤️

fi
echo "Will use RELEASE_REF=${RELEASE_REF}"
echo "export RELEASE_REF=${RELEASE_REF}" >> $BASH_ENV
Expand Down Expand Up @@ -386,18 +387,24 @@ jobs:
command: |
# TODO: once CircleCI updates its pipeline-invocation API, move off of Cheng's personal CircleCI access token, which is saved to both of the slackapi CircleCI "contexts" as an env var:
# https://app.circleci.com/settings/organization/github/slackapi/contexts
if [[ -z "$CIRCLE_BRANCH" || "$CIRCLE_BRANCH" == pull/* ]]; then
BRANCH_NAME="main"
echo "Performing the standard end-to-end test suite for changes of a forked branch"
else
BRANCH_NAME="$CIRCLE_BRANCH"
fi
Comment on lines +390 to +395
Copy link
Member Author

Choose a reason for hiding this comment

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

📝 Changes the E2E tests are not with this repo so we are defaulting to the main branch.

This is required since matching PR numbers might or might not exist upstream which can cause unexpected testing behavior!

Copy link
Member Author

Choose a reason for hiding this comment

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

📝 I am making a note that this is worth mentioning in the changes of #36!

TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
--header 'Content-Type: application/json' \
-u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
--data "{\"branch\":\"${CIRCLE_BRANCH}\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
--data "{\"branch\":\"${BRANCH_NAME}\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
echo "Performing the standard test suite found on the \"main\" branch of the end-to-end tests"
TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
--header 'Content-Type: application/json' \
-u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
--data "{\"branch\":\"main\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
else
echo "Performing the changed tests on the \"$CIRCLE_BRANCH\" branch of the end-to-end tests"
echo "Performing the changed tests on the \"$BRANCH_NAME\" branch of the end-to-end tests"
fi
if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
echo "Failed to start the testing workflow"
Expand Down
Loading