From 90dff0d44c047d2c80518727c922b17a2816b264 Mon Sep 17 00:00:00 2001 From: Ella Rohm-Ensing Date: Thu, 4 Jan 2024 09:13:12 -0600 Subject: [PATCH] Use 'dev' sentry environment for airbyte-ci pipx installs in PRs (#33920) --- .github/actions/run-dagger-pipeline/action.yml | 18 +++++++++++++++--- airbyte-ci/connectors/pipelines/README.md | 1 + .../pipelines/helpers/sentry_utils.py | 1 + airbyte-ci/connectors/pipelines/pyproject.toml | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/actions/run-dagger-pipeline/action.yml b/.github/actions/run-dagger-pipeline/action.yml index 81eeebb44d34..b54aab2fff83 100644 --- a/.github/actions/run-dagger-pipeline/action.yml +++ b/.github/actions/run-dagger-pipeline/action.yml @@ -101,6 +101,17 @@ runs: pipelines: - 'airbyte-ci/connectors/pipelines/**' + - name: Determine how Airbyte CI should be installed + shell: bash + id: determine-install-mode + run: | + if [[ "${{ github.ref }}" != "refs/heads/master" ]] && [[ "${{ steps.changes.outputs.pipelines_any_changed }}" == "true" ]]; then + echo "Making changes to Airbyte CI on a non-master branch. Airbyte-CI will be installed from source." + echo "install-mode=dev" >> $GITHUB_OUTPUT + else + echo "install-mode=production" >> $GITHUB_OUTPUT + fi + - name: Docker login uses: docker/login-action@v1 with: @@ -114,7 +125,7 @@ runs: - name: Install airbyte-ci binary id: install-airbyte-ci - if: github.ref == 'refs/heads/master' || steps.changes.outputs.pipelines_any_changed == 'false' + if: steps.determine-install-mode.outputs.install-mode == 'production' shell: bash run: | curl -sSL ${{ inputs.airbyte_ci_binary_url }} --output airbyte-ci-bin @@ -123,13 +134,13 @@ runs: - name: Install Python 3.10 uses: actions/setup-python@v4 - if: github.ref != 'refs/heads/master' && steps.changes.outputs.pipelines_any_changed == 'true' + if: steps.determine-install-mode.outputs.install-mode == 'dev' with: python-version: "3.10" token: ${{ inputs.github_token }} - name: Install ci-connector-ops package - if: github.ref != 'refs/heads/master' && steps.changes.outputs.pipelines_any_changed == 'true' + if: steps.determine-install-mode.outputs.install-mode == 'dev' shell: bash run: | pip install pipx @@ -157,6 +168,7 @@ runs: PRODUCTION: ${{ inputs.production }} PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} SENTRY_DSN: ${{ inputs.sentry_dsn }} + SENTRY_ENVIRONMENT: ${{ steps.determine-install-mode.outputs.install-mode }} SLACK_WEBHOOK: ${{ inputs.slack_webhook_url }} SPEC_CACHE_BUCKET_NAME: ${{ inputs.spec_cache_bucket_name }} SPEC_CACHE_GCS_CREDENTIALS: ${{ inputs.spec_cache_gcs_credentials }} diff --git a/airbyte-ci/connectors/pipelines/README.md b/airbyte-ci/connectors/pipelines/README.md index 8e4bd299a777..cc3821bf17b3 100644 --- a/airbyte-ci/connectors/pipelines/README.md +++ b/airbyte-ci/connectors/pipelines/README.md @@ -521,6 +521,7 @@ E.G.: running `pytest` on a specific test folder: | Version | PR | Description | | ------- | ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| 2.13.1 | [#33920](https://github.com/airbytehq/airbyte/pull/33920) | Report different sentry environments | 2.13.0 | [#33784](https://github.com/airbytehq/airbyte/pull/33784) | Make `airbyte-ci test` able to run any poetry command | | 2.12.0 | [#33313](https://github.com/airbytehq/airbyte/pull/33313) | Add upgrade CDK command | | 2.11.0 | [#32188](https://github.com/airbytehq/airbyte/pull/32188) | Add -x option to connector test to allow for skipping steps | diff --git a/airbyte-ci/connectors/pipelines/pipelines/helpers/sentry_utils.py b/airbyte-ci/connectors/pipelines/pipelines/helpers/sentry_utils.py index 9b90064d7bd2..fb1a44138a60 100644 --- a/airbyte-ci/connectors/pipelines/pipelines/helpers/sentry_utils.py +++ b/airbyte-ci/connectors/pipelines/pipelines/helpers/sentry_utils.py @@ -21,6 +21,7 @@ def initialize() -> None: if "SENTRY_DSN" in os.environ: sentry_sdk.init( dsn=os.environ.get("SENTRY_DSN"), + environment=os.environ.get("SENTRY_ENVIRONMENT") or "production", before_send=before_send, release=f"pipelines@{importlib.metadata.version('pipelines')}", ) diff --git a/airbyte-ci/connectors/pipelines/pyproject.toml b/airbyte-ci/connectors/pipelines/pyproject.toml index f168e548b9d5..c7ec2c1f4c2f 100644 --- a/airbyte-ci/connectors/pipelines/pyproject.toml +++ b/airbyte-ci/connectors/pipelines/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pipelines" -version = "2.13.0" +version = "2.13.1" description = "Packaged maintained by the connector operations team to perform CI for connectors' pipelines" authors = ["Airbyte "]