-
Notifications
You must be signed in to change notification settings - Fork 24
ci: escape pull request branch tag before creating releases to test #38
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
Changes from all commits
576cdba
134602b
71df460
fa32ad4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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}" | ||
| fi | ||
| echo "Will use RELEASE_REF=${RELEASE_REF}" | ||
| echo "export RELEASE_REF=${RELEASE_REF}" >> $BASH_ENV | ||
|
|
@@ -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
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 This is required since matching PR numbers might or might not exist upstream which can cause unexpected testing behavior!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
|
|
||
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOVE THIS! ❤️