|
4 | 4 |
|
5 | 5 | # launches integration test workflows for master builds
|
6 | 6 |
|
7 |
| -if [[ -z "$GITHUB_TOKEN" ]] ; then |
| 7 | +if [[ -z "$GITHUB_TOKEN" ]]; then |
8 | 8 | echo "GITHUB_TOKEN not set..."
|
9 | 9 | exit 1
|
10 | 10 | fi
|
11 | 11 |
|
12 | 12 | REPO_API=https://api.github.com/repos/airbytehq/airbyte
|
13 | 13 | WORKFLOW_PATH=.github/workflows/test-command.yml
|
14 | 14 | WORKFLOW_ID=$(curl --header "Authorization: Bearer $GITHUB_TOKEN" "$REPO_API/actions/workflows" | jq -r ".workflows[] | select( .path == \"$WORKFLOW_PATH\" ) | .id")
|
15 |
| -MATCHING_WORKFLOW_IDS=$(wc -l <<< "${WORKFLOW_ID}") |
| 15 | +MATCHING_WORKFLOW_IDS=$(wc -l <<<"${WORKFLOW_ID}") |
16 | 16 |
|
17 |
| -if [ "$MATCHING_WORKFLOW_IDS" -ne "1" ] ; then |
| 17 | +if [ "$MATCHING_WORKFLOW_IDS" -ne "1" ]; then |
18 | 18 | echo "More than one workflow exists with the path $WORKFLOW_PATH"
|
19 | 19 | exit 1
|
20 | 20 | fi
|
21 | 21 |
|
22 | 22 | MAX_RUNNING_MASTER_WORKFLOWS=5
|
23 | 23 | 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")
|
24 |
| -if [ "$RUNNING_MASTER_WORKFLOWS" -gt "$MAX_RUNNING_MASTER_WORKFLOWS" ] ; then |
| 24 | +if [ "$RUNNING_MASTER_WORKFLOWS" -gt "$MAX_RUNNING_MASTER_WORKFLOWS" ]; then |
25 | 25 | echo "More than $MAX_RUNNING_MASTER_WORKFLOWS integration tests workflows running on master."
|
26 | 26 | echo "Skipping launching workflows."
|
27 | 27 | exit 0
|
28 | 28 | fi
|
29 | 29 |
|
30 | 30 | CONNECTORS=$(./gradlew integrationTest --dry-run | grep 'integrationTest SKIPPED' | cut -d: -f 4 | sort | uniq)
|
31 |
| -echo "$CONNECTORS" | while read -r connector ; do |
| 31 | +echo "$CONNECTORS" | while read -r connector; do |
32 | 32 | echo "Issuing request for connector $connector..."
|
33 | 33 | curl \
|
| 34 | + -i \ |
34 | 35 | -X POST \
|
35 |
| - --header "Authorization: Bearer $GITHUB_TOKEN" \ |
| 36 | + -H "Accept: application/vnd.github.v3+json" \ |
| 37 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
36 | 38 | "$REPO_API/actions/workflows/$WORKFLOW_ID/dispatches" \
|
37 | 39 | -d "{\"ref\":\"master\", \"inputs\": { \"connector\": \"$connector\"} }"
|
38 | 40 | done
|
0 commit comments