From fcc1a7a64e14ba237641ffeec53e2d161290d4b4 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 21:55:17 -0700 Subject: [PATCH 01/17] pass the pr number to slash dispatch workflows --- .github/workflows/slash-commands.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/slash-commands.yml b/.github/workflows/slash-commands.yml index f205da2d76c9..bb3a440dbad7 100644 --- a/.github/workflows/slash-commands.yml +++ b/.github/workflows/slash-commands.yml @@ -29,6 +29,7 @@ jobs: static-args: | repo=${{ steps.getref.outputs.repo }} gitref=${{ steps.getref.outputs.ref }} + pr=${{ github.event.issue.number }} comment-id=${{ github.event.comment.id }} dispatch-type: workflow From bd00c8193fe5fa46ff8972e518c50e56752660d4 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:08:07 -0700 Subject: [PATCH 02/17] ci: add pr number as input to test command --- .github/workflows/test-command.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 72312f57938a..d5275bd3df4e 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -1,4 +1,4 @@ -name: Deprecation message for test slash command +name: On-Demand Connector Tests for PRs on: workflow_dispatch: inputs: @@ -13,19 +13,12 @@ on: description: "The git ref to check out from the specified repository." required: false default: master + pr: + description: "Pull request number. Used to link the comment to the PR." + required: false comment-id: description: "The comment-id of the slash command. Used to update the comment with the status." required: false - uuid: - description: "Custom UUID of workflow run. Used because GitHub dispatches endpoint does not return workflow run id." - required: false - connector-acceptance-test-version: - description: "Set a specific connector acceptance test version to use. Enter 'dev' to test, build and use a local version of Connector Acceptance Test." - required: false - default: "latest" - local_cdk: - description: "Run Connector Acceptance Tests against the CDK version on the current branch." - required: false jobs: write-deprecation-message: runs-on: ubuntu-latest From 2ed5706f9401522225ecc71e2e198865e8e32e85 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:29:53 -0700 Subject: [PATCH 03/17] add back on-demand test with airbyte-ci --- .github/workflows/test-command.yml | 63 +++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index d5275bd3df4e..92fb06471a9d 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -23,12 +23,57 @@ jobs: write-deprecation-message: runs-on: ubuntu-latest steps: - - name: Print deprecation message - uses: peter-evans/create-or-update-comment@v1 - with: - comment-id: ${{ github.event.inputs.comment-id }} - body: | - > :warning: The test slash command is now deprecated.
- The connector tests are automatically triggered as CI checks.
- Please use /legacy-test if you need to test CDK or CAT changes.
- Please join post to #pipeline-complaint-hotline slack channel if something is not working as expected.
+ - name: Create URL to the run output + id: vars + run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT + - name: Append comment with job run link + id: first-comment-action + uses: peter-evans/create-or-update-comment@v4 + with: + comment-id: ${{ github.event.inputs.comment-id }} + issue-number: ${{ github.event.inputs.pr }} + body: | + + > PR test job started... [Check job output.][1] + + [1]: ${{ steps.vars.outputs.run-url }} + + - name: Checkout Airbyte + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_PAT_APPROVINGTON_OCTAVIA }} + + - name: Checkout PR (${{ github.event.inputs.pr }}) + uses: dawidd6/action-checkout-pr@v1 + with: + pr: ${{ github.event.inputs.pr }} + + - name: Get PR info + id: pr-info + shell: bash + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}) + echo "repo=$(echo $PR_JSON | jq -r .head.repo.full_name)" >> $GITHUB_OUTPUT + echo "branch=$(echo $PR_JSON | jq -r .head.ref)" >> $GITHUB_OUTPUT + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install `airbyte-ci` CLI + # We use the stable `airbyte-ci` from `master`. Intentionally ignores any CI changes + # local to this branch. + run: > + pip install + git+https://github.com/airbytehq/airbyte.git#subdirectory=airbyte-ci/connectors/pipelines + + - name: Run `airbyte-ci` test + env: + GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} + run: > + airbyte-ci connector + --name=${{ github.event.inputs.connector }} + test From 6bad179cb9f527de177e3c5b64f7ccc1528923d9 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:34:48 -0700 Subject: [PATCH 04/17] remove redundant branch and ref inputs --- .github/workflows/test-command.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 92fb06471a9d..c0c08677d322 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -5,14 +5,6 @@ on: connector: description: "Airbyte Connector" required: true - repo: - description: "Repo to check out code from. Defaults to the main airbyte repo. Set this when building connectors from forked repos." - required: false - default: "airbytehq/airbyte" - gitref: - description: "The git ref to check out from the specified repository." - required: false - default: master pr: description: "Pull request number. Used to link the comment to the PR." required: false From d60d6c0f181353132ff1b2ec08972b7099dec0e6 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:37:57 -0700 Subject: [PATCH 05/17] fix typo --- .github/workflows/test-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index c0c08677d322..4a6462e90f13 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -66,6 +66,6 @@ jobs: env: GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} run: > - airbyte-ci connector + airbyte-ci connectors --name=${{ github.event.inputs.connector }} test From f3b49acb6e67e1e780e62a6c1e092be5b1914df8 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:41:02 -0700 Subject: [PATCH 06/17] disable update check --- .github/workflows/test-command.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 4a6462e90f13..cee6fceb0916 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -66,6 +66,8 @@ jobs: env: GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} run: > - airbyte-ci connectors + airbyte-ci + --disable-update-check + connectors --name=${{ github.event.inputs.connector }} test From 10cf9482bb32a4429e40d7ccc3c5ed781e776cad Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:42:46 -0700 Subject: [PATCH 07/17] rename job --- .github/workflows/test-command.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index cee6fceb0916..9d101a75daab 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -12,7 +12,8 @@ on: description: "The comment-id of the slash command. Used to update the comment with the status." required: false jobs: - write-deprecation-message: + on-demand-connector-tests: + name: On-Demand Connector Tests runs-on: ubuntu-latest steps: - name: Create URL to the run output From c925e996a1b958b99893e8b880d0770ee1fd2c0c Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:49:18 -0700 Subject: [PATCH 08/17] add step to upload reports as artifacts --- .github/workflows/test-command.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 9d101a75daab..13445e32d607 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -72,3 +72,9 @@ jobs: connectors --name=${{ github.event.inputs.connector }} test + + - name: Upload pipeline reports + uses: actions/upload-artifact@v2 + with: + name: pipeline-reports + path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports From c6e377cd89875e70fe7e7103f35603b1d4677330 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 22:53:52 -0700 Subject: [PATCH 09/17] try warm up --- .github/workflows/test-command.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 13445e32d607..01fdfe10fa35 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -63,6 +63,9 @@ jobs: pip install git+https://github.com/airbytehq/airbyte.git#subdirectory=airbyte-ci/connectors/pipelines + - name: Warm up `airbyte-ci` CLI + run: airbyte-ci --help + - name: Run `airbyte-ci` test env: GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} From 9d3637d8b3f132a0f9a70db46dc1e9dfc9814f9e Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 23:08:16 -0700 Subject: [PATCH 10/17] add status updates after execution --- .github/workflows/test-command.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 01fdfe10fa35..d460c79d6b87 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -67,6 +67,7 @@ jobs: run: airbyte-ci --help - name: Run `airbyte-ci` test + id: test-on-demand env: GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} run: > @@ -81,3 +82,22 @@ jobs: with: name: pipeline-reports path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports + + - name: Append success comment + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.inputs.pr }} + comment-id: ${{ github.event.inputs.comment-id }} + reactions: hooray + body: | + > ✅ Tests passed. + + - name: Append failure comment + if: failure() + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.inputs.pr }} + comment-id: ${{ github.event.inputs.comment-id }} + reactions: confused + body: | + > ❌ Tests failed. From 3379a438d2eb0bfc446deb9f1c9af33d36dd3eb2 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 23:26:53 -0700 Subject: [PATCH 11/17] link to report artifact --- .github/workflows/test-command.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index d460c79d6b87..d5e46401f96a 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -78,10 +78,11 @@ jobs: test - name: Upload pipeline reports - uses: actions/upload-artifact@v2 + id: upload-artifact + uses: actions/upload-artifact@v4 with: name: pipeline-reports - path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports + path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports/connectors - name: Append success comment uses: peter-evans/create-or-update-comment@v4 @@ -90,7 +91,9 @@ jobs: comment-id: ${{ github.event.inputs.comment-id }} reactions: hooray body: | - > ✅ Tests passed. + > ✅ Tests passed. [🔗][1] + + [1]: ${{ steps.upload-artifact.outputs.artifact-url }} - name: Append failure comment if: failure() @@ -100,4 +103,6 @@ jobs: comment-id: ${{ github.event.inputs.comment-id }} reactions: confused body: | - > ❌ Tests failed. + > ❌ Tests failed. [🔗][1] + + [1]: ${{ steps.upload-artifact.outputs.artifact-url }} From 514dd819f1c4841b00ab3f685500f37b782665d2 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Wed, 17 Apr 2024 23:59:42 -0700 Subject: [PATCH 12/17] fix artifact path --- .github/workflows/test-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index d5e46401f96a..183a9a35ace2 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -82,7 +82,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: pipeline-reports - path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports/connectors + path: /home/runner/work/airbyte/airbyte/airbyte-ci/connectors/pipelines/pipeline_reports/airbyte-ci/connectors/test/manual - name: Append success comment uses: peter-evans/create-or-update-comment@v4 From fd1061df69c9673b6511979cc09d0cfe9e700165 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Thu, 18 Apr 2024 00:14:44 -0700 Subject: [PATCH 13/17] change emoji for attachment --- .github/workflows/test-command.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 183a9a35ace2..1490e4d8d305 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -91,7 +91,7 @@ jobs: comment-id: ${{ github.event.inputs.comment-id }} reactions: hooray body: | - > ✅ Tests passed. [🔗][1] + > ✅ Tests passed. [📎][1] [1]: ${{ steps.upload-artifact.outputs.artifact-url }} @@ -103,6 +103,6 @@ jobs: comment-id: ${{ github.event.inputs.comment-id }} reactions: confused body: | - > ❌ Tests failed. [🔗][1] + > ❌ Tests failed. [📎][1] [1]: ${{ steps.upload-artifact.outputs.artifact-url }} From 63d97dbdc1f6e8743182510710f1780965fc20ad Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 22 Apr 2024 13:59:32 -0700 Subject: [PATCH 14/17] fix issue where not providing a comment ID generates 2 comments --- .github/workflows/test-command.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 1490e4d8d305..37a51c5187e9 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -88,7 +88,7 @@ jobs: uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ github.event.inputs.pr }} - comment-id: ${{ github.event.inputs.comment-id }} + comment-id: ${{ steps.first-comment-action.outputs.comment-id }} reactions: hooray body: | > ✅ Tests passed. [📎][1] @@ -100,7 +100,7 @@ jobs: uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ github.event.inputs.pr }} - comment-id: ${{ github.event.inputs.comment-id }} + comment-id: ${{ steps.first-comment-action.outputs.comment-id }} reactions: confused body: | > ❌ Tests failed. [📎][1] From 85d2145b44cc844b30fc3b547b22e6df61ed874c Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 22 Apr 2024 14:11:03 -0700 Subject: [PATCH 15/17] mark success in github and try to fix dockerhub creds --- .github/workflows/test-command.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 37a51c5187e9..4a30b3a955fe 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -48,8 +48,9 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PR_JSON=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr }}) - echo "repo=$(echo $PR_JSON | jq -r .head.repo.full_name)" >> $GITHUB_OUTPUT - echo "branch=$(echo $PR_JSON | jq -r .head.ref)" >> $GITHUB_OUTPUT + echo "source_repo=$(echo $PR_JSON | jq -r .head.repo.full_name)" >> $GITHUB_OUTPUT + echo "source_branch=$(echo $PR_JSON | jq -r .head.ref)" >> $GITHUB_OUTPUT + echo "sha=$(echo $PR_JSON | jq -r .head.sha)" >> $GITHUB_OUTPUT - name: Set up Python uses: actions/setup-python@v5 @@ -70,6 +71,8 @@ jobs: id: test-on-demand env: GCS_CREDENTIALS: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }} + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} run: > airbyte-ci --disable-update-check @@ -94,6 +97,17 @@ jobs: > ✅ Tests passed. [📎][1] [1]: ${{ steps.upload-artifact.outputs.artifact-url }} + - name: "Mark success in GitHub Actions" + run: | + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.pr-info.outputs.sha }} \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "state": "success", + "context": "Connectors CI tests", + "target_url": "${{ steps.vars.outputs.run-url }}" + }' \ - name: Append failure comment if: failure() From 75c8bd8e6932145f7bd0c0c4473dfc86cff5604d Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 22 Apr 2024 14:54:20 -0700 Subject: [PATCH 16/17] mark success or fail --- .github/workflows/test-command.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index 4a30b3a955fe..bc40dcad8977 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -98,16 +98,20 @@ jobs: [1]: ${{ steps.upload-artifact.outputs.artifact-url }} - name: "Mark success in GitHub Actions" + if: always() run: | - curl --request POST \ - --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.pr-info.outputs.sha }} \ - --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ - --header 'content-type: application/json' \ - --data '{ - "state": "success", - "context": "Connectors CI tests", - "target_url": "${{ steps.vars.outputs.run-url }}" - }' \ + jobs=("Connectors CI tests" "Connector Ops CI - Connectors Acceptance Tests") + for job in "${jobs[@]}"; do + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.pr-info.outputs.sha }} \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "state": "${{ job.status }}", + "context": "'"$job"'", + "target_url": "${{ steps.vars.outputs.run-url }}" + }' + done - name: Append failure comment if: failure() From 83dec6ccd9989cabdb5b4b89911740b6da118215 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Mon, 22 Apr 2024 15:09:30 -0700 Subject: [PATCH 17/17] adapt post to hit both jobs (attempt) --- .github/workflows/test-command.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index bc40dcad8977..1cc115f95786 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -100,7 +100,7 @@ jobs: - name: "Mark success in GitHub Actions" if: always() run: | - jobs=("Connectors CI tests" "Connector Ops CI - Connectors Acceptance Tests") + jobs=("Connectors CI tests" "Connectors CI") for job in "${jobs[@]}"; do curl --request POST \ --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ steps.pr-info.outputs.sha }} \