From d03d72c67761817b26623bb88f09829075105f0e Mon Sep 17 00:00:00 2001 From: Tim Yao <31641325+tim-yao@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:38:02 +1100 Subject: [PATCH] fix GHA e2e trigger (#1325) --- scripts/trigger-e2e.sh | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/scripts/trigger-e2e.sh b/scripts/trigger-e2e.sh index 4c26b02a9..4277349d1 100644 --- a/scripts/trigger-e2e.sh +++ b/scripts/trigger-e2e.sh @@ -8,13 +8,11 @@ # The reason is CMDB sometimes set develop LAGOON_ROUTE as a project-level variable. PR_BRANCH_REGEX="pr-" if [[ $(expr match "$LAGOON_GIT_SAFE_BRANCH" $PR_BRANCH_REGEX) != 0 ]]; then - FE_URL=https://app.${LAGOON_GIT_SAFE_BRANCH}.ripple.sdp4.sdp.vic.gov.au + FE_URL=$(echo $LAGOON_AUTOGENERATED_ROUTES | grep -Eo '(https://app[^,]*)') BRANCH=$LAGOON_PR_HEAD_BRANCH -# else - # TODO: No need to handle as we only trigger on release branch for now. - # $LAGOON_ROUTE will return stroybook route, we need to check $LAGOON_ROUTES to find out the APP route. - # FE_URL=$LAGOON_ROUTE - # BRANCH=$LAGOON_GIT_BRANCH +else + FE_URL=$(echo $LAGOON_AUTOGENERATED_ROUTES | grep -Eo '(https://app[^,]*)') + BRANCH=$LAGOON_GIT_BRANCH fi # Add basic auth credentials to the url if it's enabled. @@ -27,24 +25,6 @@ fi echo "Triggering end to end testing for $LAGOON_PROJECT..." -if [ -z $E2E_CI_TOKEN ]; then - echo "Error: No E2E CI token found, end to end is not triggered. Please make sure E2E_CI_TOKEN is set up." -else - # Trigger CircleCI to run the pipeline - curl --location --request POST "https://circleci.com/api/v2/project/github/dpc-sdp/ripple/pipeline" \ - --header "Circle-Token: $E2E_CI_TOKEN" \ - --header 'content-type: application/json' \ - --data-raw '{ - "branch": "'"$BRANCH"'", - "parameters": { - "e2e": true, - "e2e_be_url": "'"$BE_URL"'", - "e2e_fe_url": "'"$FE_URL"'", - "e2e_project": "reference" - } - }' -fi - E2E_ESTUARY_URL="${E2E_ESTUARY_URL:-http://estuary.sdp-services:8080/v1/actions/trigger-e2e}" E2E_ESTUARY_TOKEN_PATH="${E2E_ESTUARY_TOKEN_PATH:-/run/secrets/kubernetes.io/serviceaccount/token}" # Trigger GitHub Action to run the e2e workflow via estuary @@ -58,5 +38,5 @@ curl --location --request POST "$E2E_ESTUARY_URL" \ "ref": "'"$BRANCH"'", "be_url": "'"$BE_URL"'", "fe_url": "'"$FE_URL"'", - "project": "reference" + "project": "reference-sdp-vic-gov-au" }'