Skip to content

Commit 71ebd4a

Browse files
authored
productionize community-ci workflow (#37404)
1 parent e6b3874 commit 71ebd4a

File tree

14 files changed

+184
-245
lines changed

14 files changed

+184
-245
lines changed

.github/actions/airbyte-ci-requirements/action.yml

-104
This file was deleted.

.github/actions/install-airbyte-ci/action.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,28 @@ inputs:
1010
description: "Path to airbyte-ci source"
1111
required: false
1212
default: airbyte-ci/connectors/pipelines
13+
is_fork:
14+
description: "Whether the PR is from a fork"
15+
required: false
16+
default: "false"
1317
runs:
1418
using: "composite"
1519
steps:
1620
- name: Get changed files
17-
uses: tj-actions/changed-files@v39
21+
uses: tj-actions/changed-files@v44
22+
# When the PR is from a fork, we always install from binary, so we don't need to check for changes
23+
if: inputs.is_fork == 'false'
1824
id: changes
1925
with:
2026
files_yaml: |
2127
pipelines:
2228
- '${{ inputs.path_to_airbyte_ci_source }}/**'
2329
24-
- name: Determine how Airbyte CI should be installed
30+
- name: "Determine how Airbyte CI should be installed"
2531
shell: bash
2632
id: determine-install-mode
33+
# When the PR is from a fork, we always install from binary
34+
if: inputs.is_fork == 'false'
2735
run: |
2836
if [[ "${{ github.ref }}" != "refs/heads/master" ]] && [[ "${{ steps.changes.outputs.pipelines_any_changed }}" == "true" ]]; then
2937
echo "Making changes to Airbyte CI on a non-master branch. Airbyte-CI will be installed from source."
@@ -34,7 +42,7 @@ runs:
3442
3543
- name: Install Airbyte CI from binary
3644
id: install-airbyte-ci-binary
37-
if: steps.determine-install-mode.outputs.install-mode == 'binary'
45+
if: steps.determine-install-mode.outputs.install-mode == 'binary' || ${{ inputs.is_fork }} == 'true'
3846
shell: bash
3947
run: |
4048
curl -sSL ${{ inputs.airbyte_ci_binary_url }} --output airbyte-ci-bin

.github/actions/run-airbyte-ci/action.yml

+10-12
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ inputs:
3434
description: "GCP credentials for GCP Secret Manager"
3535
required: false
3636
default: ""
37+
git_repo_url:
38+
description: "Git repository URL"
39+
default: https://github.com/airbytehq/airbyte.git
40+
required: false
3741
git_branch:
3842
description: "Git branch to checkout"
3943
required: false
@@ -79,7 +83,10 @@ inputs:
7983
python_registry_token:
8084
description: "Python registry API token to publish python package"
8185
required: false
82-
86+
is_fork:
87+
description: "Whether the PR is from a fork"
88+
required: false
89+
default: "false"
8390
runs:
8491
using: "composite"
8592
steps:
@@ -88,16 +95,6 @@ runs:
8895
shell: bash
8996
run: echo "name=start-timestamp=$(date +%s)" >> $GITHUB_OUTPUT
9097

91-
- name: Check if PR is from a fork
92-
id: check-if-pr-is-from-fork
93-
if: github.event_name == 'pull_request'
94-
shell: bash
95-
run: |
96-
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then
97-
echo "PR is from a fork. Exiting workflow..."
98-
exit 78
99-
fi
100-
10198
- name: Docker login
10299
id: docker-login
103100
uses: docker/login-action@v3
@@ -110,14 +107,15 @@ runs:
110107
uses: ./.github/actions/install-airbyte-ci
111108
with:
112109
airbyte_ci_binary_url: ${{ inputs.airbyte_ci_binary_url }}
113-
110+
is_fork: ${{ inputs.is_fork }}
114111
- name: Run airbyte-ci
115112
id: run-airbyte-ci
116113
shell: bash
117114
run: |
118115
airbyte-ci --disable-update-check --disable-dagger-run --is-ci --gha-workflow-run-id=${{ github.run_id }} ${{ inputs.subcommand }} ${{ inputs.options }}
119116
env:
120117
CI_CONTEXT: "${{ inputs.context }}"
118+
CI_GIT_REPO_URL: ${{ inputs.git_repo_url }}
121119
CI_GIT_BRANCH: ${{ inputs.git_branch || github.head_ref }}
122120
CI_GIT_REVISION: ${{ inputs.git_revision || github.sha }}
123121
CI_GITHUB_ACCESS_TOKEN: ${{ inputs.github_token }}

.github/workflows/airbyte-ci-tests.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- name: Checkout Airbyte
2626
if: github.event_name != 'pull_request'
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
2828
- id: changes
2929
uses: dorny/paths-filter@v2
3030
with:
@@ -44,6 +44,7 @@ jobs:
4444
4545
run-tests:
4646
needs: changes
47+
# We only run the Connectors CI job if there are changes to the connectors on a non-forked PR
4748
if: needs.changes.outputs.internal_poetry_packages == 'true'
4849
#name: Internal Poetry packages CI
4950
# To rename in a follow up PR
@@ -53,8 +54,20 @@ jobs:
5354
pull-requests: read
5455
statuses: write
5556
steps:
57+
# The run-tests job will be triggered if a fork made changes to the internal poetry packages.
58+
# We don't want forks to make changes to the internal poetry packages.
59+
# So we fail the job if the PR is from a fork, it will make the required CI check fail.
60+
- name: Check if PR is from a fork
61+
id: check-if-pr-is-from-fork
62+
if: github.event_name == 'pull_request'
63+
shell: bash
64+
run: |
65+
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then
66+
echo "PR is from a fork. Exiting workflow..."
67+
exit 78
68+
fi
5669
- name: Checkout Airbyte
57-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
5871
with:
5972
fetch-depth: 0
6073
ref: ${{ github.event.pull_request.head.ref }}

0 commit comments

Comments
 (0)