Skip to content

Commit

Permalink
Airbyte CDK: Test via airbyte CI test poetry packages (#36497)
Browse files Browse the repository at this point in the history
  • Loading branch information
erohmensing committed May 3, 2024
1 parent c9ca485 commit f23c2e6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 156 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/airbyte-ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ jobs:
- airbyte-ci/connectors/ci_credentials/**
- airbyte-ci/connectors/metadata_service/lib/**
- airbyte-ci/connectors/metadata_service/orchestrator/**
- airbyte-cdk/python/**
- airbyte-integrations/bases/connector-acceptance-test/**
run-tests:
needs: changes
# We only run the Connectors CI job if there are changes to the connectors on a non-forked PR
# We only run the Internal Poetry packages CI job if there are changes to the packages on a non-forked PR
if: needs.changes.outputs.internal_poetry_packages == 'true'
#name: Internal Poetry packages CI
# To rename in a follow up PR
name: Run Airbyte CI tests
name: Internal Poetry packages CI
runs-on: tooling-test-large
permissions:
pull-requests: read
Expand Down
150 changes: 0 additions & 150 deletions .github/workflows/python_cdk_tests.yml
Original file line number Diff line number Diff line change
@@ -1,150 +0,0 @@
name: Python CDK Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
changes:
runs-on: ubuntu-latest
outputs:
python_cdk: ${{ steps.changes.outputs.python_cdk }}
steps:
- name: Checkout Airbyte
if: github.event_name != 'pull_request'
uses: actions/checkout@v3
- id: changes
uses: dorny/paths-filter@v2
with:
# Note: expressions within a filter are OR'ed
filters: |
python_cdk:
- 'airbyte-cdk/python/**/*'
run-python-cdk-check:
needs:
- changes
if: needs.changes.outputs.python_cdk == 'true'
runs-on: ubuntu-latest
name: Python CDK Tests
timeout-minutes: 30
steps:
# The run-python-cdk-check job will be triggered if a fork made changes to Python CDK.
# We don't want forks to make changes to Python CDK.
# So we fail the job if the PR is from a fork, it will make the required CI check fail.
- name: Check if PR is from a fork
id: check-if-pr-is-from-fork
if: github.event_name == 'pull_request'
shell: bash
run: |
if [ "${{ github.event.pull_request.head.repo.fork }}" == "true" ]; then
echo "PR is from a fork. Exiting workflow..."
exit 78
fi
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Install Dependencies
id: install_dependencies
working-directory: airbyte-cdk/python
run: poetry install --all-extras
- name: Build CDK Package
working-directory: airbyte-cdk/python
run: poetry run poe build
- name: Check Python CDK
working-directory: airbyte-cdk/python
run: poetry run poe check-ci

set-instatus-incident-on-failure:
name: Create Instatus Incident on Failure
runs-on: ubuntu-latest
needs:
- run-python-cdk-check
if: ${{ failure() && github.ref == 'refs/heads/master' }}
steps:
- name: Call Instatus Webhook
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.INSTATUS_CONNECTOR_CI_WEBHOOK_URL }}
body: '{ "trigger": "down", "status": "HASISSUES" }'

set-instatus-incident-on-success:
name: Create Instatus Incident on Success
runs-on: ubuntu-latest
needs:
- run-python-cdk-check
if: ${{ success() && github.ref == 'refs/heads/master' }}
steps:
- name: Call Instatus Webhook
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.INSTATUS_CONNECTOR_CI_WEBHOOK_URL }}
body: '{ "trigger": "up" }'

notify-failure-slack-channel:
name: "Notify Slack Channel on Build Failures"
runs-on: ubuntu-latest
needs:
- run-python-cdk-check
if: ${{ failure() && github.ref == 'refs/heads/master' }}
steps:
- name: Checkout Airbyte
uses: actions/checkout@v3
- name: Match GitHub User to Slack User
id: match-github-to-slack-user
uses: ./.github/actions/match-github-to-slack-user
env:
AIRBYTE_TEAM_BOT_SLACK_TOKEN: ${{ secrets.SLACK_AIRBYTE_TEAM_READ_USERS }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to OSS Build Failure Slack Channel
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
args: >-
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
{\"type\":\"divider\"},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" Merge to OSS Master failed! :bangbang: \n\n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"<@${{ steps.match-github-to-slack-user.outputs.slack_user_ids }}> \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-shocked: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-shocked: \n\"}},
{\"type\":\"divider\"}]}
notify-failure-slack-channel-fixed-broken-build:
name: "Notify Slack Channel on Build Fixes"
runs-on: ubuntu-latest
needs:
- run-python-cdk-check
if: success()
steps:
- name: Get Previous Workflow Status
uses: Mercymeilya/last-workflow-status@v0.3
id: last_status
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# To avoid clogging up the channel, only publish build success if the previous build was a failure since this means the build was fixed.
- name: Publish Build Fixed Message to OSS Build Failure Slack Channel
if: ${{ steps.last_status.outputs.last_status == 'failure' }}
uses: abinoda/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_AIRBYTE_TEAM }}
with:
args: >-
{\"channel\":\"C03BEADRPNY\", \"blocks\":[
{\"type\":\"divider\"},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" OSS Master Fixed! :white_check_mark: \n\n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\"_merged by_: *${{ github.actor }}* \n\"}},
{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" :octavia-rocket: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|View Action Run> :octavia-rocket: \n\"}},
{\"type\":\"divider\"}]}
6 changes: 6 additions & 0 deletions airbyte-cdk/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,9 @@ check-ci = {sequence = ["lint", "unit-test-with-cov"], help = "Lint and run unit

# Build and check
pre-push = {sequence = ["build", "check-local"], help = "Run all build and check tasks."}

[tool.airbyte_ci]
optional_poetry_groups = ["dev"]
poetry_extras = ["file-based", "sphinx-docs", "vector-db-based"]
poe_tasks = ["build", "check-ci"]
mount_docker_socket = true
3 changes: 2 additions & 1 deletion airbyte-ci/connectors/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ E.G.: running Poe tasks on the modified internal packages of the current branch:
## Changelog

| Version | PR | Description |
| ------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|---------| ---------------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------|
| 4.12.6 | [#36497](https://github.com/airbytehq/airbyte/pull/36497) | Add airbyte-cdk to list of poetry packages for testing |
| 4.12.5 | [#37785](https://github.com/airbytehq/airbyte/pull/37785) | Set the `--yes-auto-update` flag to `True` by default. |
| 4.12.4 | [#37786](https://github.com/airbytehq/airbyte/pull/37786) | (fixed 4.12.2): Do not upload dagger log to GCP when no credentials are available. |
| 4.12.3 | [#37783](https://github.com/airbytehq/airbyte/pull/37783) | Revert 4.12.2 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"airbyte-ci/connectors/live-tests",
"airbyte-ci/connectors/metadata_service/lib",
"airbyte-ci/connectors/metadata_service/orchestrator",
"airbyte-cdk/python",
"airbyte-integrations/bases/connector-acceptance-test",
]

Expand Down
2 changes: 1 addition & 1 deletion airbyte-ci/connectors/pipelines/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "pipelines"
version = "4.12.5"
version = "4.12.6"
description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines"
authors = ["Airbyte <contact@airbyte.io>"]

Expand Down

0 comments on commit f23c2e6

Please sign in to comment.