diff --git a/tools/bin/ci_integration_workflow_launcher.sh b/tools/bin/ci_integration_workflow_launcher.sh index 98c007ca43dd..f1dfbb8978b3 100755 --- a/tools/bin/ci_integration_workflow_launcher.sh +++ b/tools/bin/ci_integration_workflow_launcher.sh @@ -4,7 +4,7 @@ set -e # launches integration test workflows for master builds -if [[ -z "$GITHUB_TOKEN" ]] ; then +if [[ -z "$GITHUB_TOKEN" ]]; then echo "GITHUB_TOKEN not set..." exit 1 fi @@ -12,27 +12,29 @@ fi REPO_API=https://api.github.com/repos/airbytehq/airbyte WORKFLOW_PATH=.github/workflows/test-command.yml WORKFLOW_ID=$(curl --header "Authorization: Bearer $GITHUB_TOKEN" "$REPO_API/actions/workflows" | jq -r ".workflows[] | select( .path == \"$WORKFLOW_PATH\" ) | .id") -MATCHING_WORKFLOW_IDS=$(wc -l <<< "${WORKFLOW_ID}") +MATCHING_WORKFLOW_IDS=$(wc -l <<<"${WORKFLOW_ID}") -if [ "$MATCHING_WORKFLOW_IDS" -ne "1" ] ; then +if [ "$MATCHING_WORKFLOW_IDS" -ne "1" ]; then echo "More than one workflow exists with the path $WORKFLOW_PATH" exit 1 fi MAX_RUNNING_MASTER_WORKFLOWS=5 RUNNING_MASTER_WORKFLOWS=$(curl "$REPO_API/actions/workflows/$WORKFLOW_ID/runs?branch=master&status=in_progress" --header "Authorization: Bearer $GITHUB_TOKEN" | jq -r ".total_count") -if [ "$RUNNING_MASTER_WORKFLOWS" -gt "$MAX_RUNNING_MASTER_WORKFLOWS" ] ; then +if [ "$RUNNING_MASTER_WORKFLOWS" -gt "$MAX_RUNNING_MASTER_WORKFLOWS" ]; then echo "More than $MAX_RUNNING_MASTER_WORKFLOWS integration tests workflows running on master." echo "Skipping launching workflows." exit 0 fi CONNECTORS=$(./gradlew integrationTest --dry-run | grep 'integrationTest SKIPPED' | cut -d: -f 4 | sort | uniq) -echo "$CONNECTORS" | while read -r connector ; do +echo "$CONNECTORS" | while read -r connector; do echo "Issuing request for connector $connector..." curl \ + -i \ -X POST \ - --header "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ "$REPO_API/actions/workflows/$WORKFLOW_ID/dispatches" \ -d "{\"ref\":\"master\", \"inputs\": { \"connector\": \"$connector\"} }" done