Skip to content

Commit

Permalink
fix GHA e2e trigger (#1325)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-yao authored Nov 13, 2023
1 parent c1e696c commit d03d72c
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions scripts/trigger-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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"
}'

0 comments on commit d03d72c

Please sign in to comment.