From 1786e754f90cc188bbdce287bddd48edc4850d19 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Tue, 6 Dec 2022 19:19:14 -0800 Subject: [PATCH 1/9] ci: Initial self-hosted end-to-end Github Action --- .github/workflows/self-hosted-e2e-tests.yml | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/self-hosted-e2e-tests.yml diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml new file mode 100644 index 00000000000000..3e934d01a9087f --- /dev/null +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -0,0 +1,43 @@ +name: Self-hosted Sentry end to end tests +on: + push: + branches: + - master + - releases/** + pull_request: + +# Cancel in progress workflows on pull_requests. +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + self-hosted-end-to-end: + runs-on: ubuntu-20.04 + # temporary, remove once we are confident the action is working + continue-on-error: true + timeout-minutes: 30 + steps: + - name: Pull the test image + id: image_pull + env: + SENTRY_TEST_IMAGE: us.gcr.io/sentryio/sentry:${{ github.event.pull_request.head.sha || github.sha }} + run: | + echo "We poll for the Sentry Docker image that the GCB build produces until it succeeds or this job times out." + if [[ -z "$SENTRY_TEST_IMAGE" ]]; then + echo "The SENTRY_TEST_IMAGE needs to be set" 1>&2 + exit 1 + fi + echo "Polling for $SENTRY_TEST_IMAGE" + until docker pull "$SENTRY_TEST_IMAGE" 2>/dev/null; do + sleep 10 + done + echo "sentry-test-image-name=$SENTRY_TEST_IMAGE" >> "$GITHUB_OUTPUT" + # TODO: push the image here + - name: Run Sentry self-hosted e2e CI + uses: getsentry/action-self-hosted-e2e-tests@5bbd3d6725bbe4bf5cc12f8a3291ce87df6a891f + with: + project_name: sentry + local_image: ${{ steps.image_pull.outputs.sentry-test-image-name }} + docker_repo: docker.io/getsentry/sentry From 0d1d111d072a18c60cb02f42b6d7566a68d7d0f8 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 7 Dec 2022 18:37:19 -0800 Subject: [PATCH 2/9] Update to newer workflow commit --- .github/workflows/self-hosted-e2e-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml index 3e934d01a9087f..4c5ff09edc3025 100644 --- a/.github/workflows/self-hosted-e2e-tests.yml +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -36,7 +36,7 @@ jobs: echo "sentry-test-image-name=$SENTRY_TEST_IMAGE" >> "$GITHUB_OUTPUT" # TODO: push the image here - name: Run Sentry self-hosted e2e CI - uses: getsentry/action-self-hosted-e2e-tests@5bbd3d6725bbe4bf5cc12f8a3291ce87df6a891f + uses: getsentry/action-self-hosted-e2e-tests@fa5b8240848f0e645ac2918c530e60ec8f50e4b8 with: project_name: sentry local_image: ${{ steps.image_pull.outputs.sentry-test-image-name }} From 52fd693448349328cace935223ac68e03b6410cb Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 7 Dec 2022 18:57:02 -0800 Subject: [PATCH 3/9] Add backend file filter --- .github/workflows/self-hosted-e2e-tests.yml | 79 +++++++++++++-------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml index 4c5ff09edc3025..a96afb07c8350f 100644 --- a/.github/workflows/self-hosted-e2e-tests.yml +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -13,31 +13,54 @@ concurrency: cancel-in-progress: true jobs: - self-hosted-end-to-end: - runs-on: ubuntu-20.04 - # temporary, remove once we are confident the action is working - continue-on-error: true - timeout-minutes: 30 - steps: - - name: Pull the test image - id: image_pull - env: - SENTRY_TEST_IMAGE: us.gcr.io/sentryio/sentry:${{ github.event.pull_request.head.sha || github.sha }} - run: | - echo "We poll for the Sentry Docker image that the GCB build produces until it succeeds or this job times out." - if [[ -z "$SENTRY_TEST_IMAGE" ]]; then - echo "The SENTRY_TEST_IMAGE needs to be set" 1>&2 - exit 1 - fi - echo "Polling for $SENTRY_TEST_IMAGE" - until docker pull "$SENTRY_TEST_IMAGE" 2>/dev/null; do - sleep 10 - done - echo "sentry-test-image-name=$SENTRY_TEST_IMAGE" >> "$GITHUB_OUTPUT" - # TODO: push the image here - - name: Run Sentry self-hosted e2e CI - uses: getsentry/action-self-hosted-e2e-tests@fa5b8240848f0e645ac2918c530e60ec8f50e4b8 - with: - project_name: sentry - local_image: ${{ steps.image_pull.outputs.sentry-test-image-name }} - docker_repo: docker.io/getsentry/sentry + files-changed: + name: detect what files changed + runs-on: ubuntu-20.04 + timeout-minutes: 3 + # Map a step output to a job output + outputs: + api_docs: ${{ steps.changes.outputs.api_docs }} + backend: ${{ steps.changes.outputs.backend_all }} + backend_dependencies: ${{ steps.changes.outputs.backend_dependencies }} + backend_any_type: ${{ steps.changes.outputs.backend_any_type }} + migration_lockfile: ${{ steps.changes.outputs.migration_lockfile }} + plugins: ${{ steps.changes.outputs.plugins }} + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + + - name: Check for backend file changes + uses: getsentry/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: changes + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + + self-hosted-end-to-end: + if: needs.files-changed.outputs.backend == 'true' + runs-on: ubuntu-20.04 + # temporary, remove once we are confident the action is working + continue-on-error: true + timeout-minutes: 30 + steps: + - name: Pull the test image + id: image_pull + env: + SENTRY_TEST_IMAGE: us.gcr.io/sentryio/sentry:${{ github.event.pull_request.head.sha || github.sha }} + run: | + echo "We poll for the Sentry Docker image that the GCB build produces until it succeeds or this job times out." + if [[ -z "$SENTRY_TEST_IMAGE" ]]; then + echo "The SENTRY_TEST_IMAGE needs to be set" 1>&2 + exit 1 + fi + echo "Polling for $SENTRY_TEST_IMAGE" + until docker pull "$SENTRY_TEST_IMAGE" 2>/dev/null; do + sleep 10 + done + echo "sentry-test-image-name=$SENTRY_TEST_IMAGE" >> "$GITHUB_OUTPUT" + # TODO: push the image here + - name: Run Sentry self-hosted e2e CI + uses: getsentry/action-self-hosted-e2e-tests@fa5b8240848f0e645ac2918c530e60ec8f50e4b8 + with: + project_name: sentry + local_image: ${{ steps.image_pull.outputs.sentry-test-image-name }} + docker_repo: docker.io/getsentry/sentry From 82ce85f2cdcc529631f133f11f83595de5ebe239 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 7 Dec 2022 18:58:33 -0800 Subject: [PATCH 4/9] Test backend change --- src/sentry/auth/authenticators/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/auth/authenticators/base.py b/src/sentry/auth/authenticators/base.py index 78881e4040d80e..0c9d1dc71200e6 100644 --- a/src/sentry/auth/authenticators/base.py +++ b/src/sentry/auth/authenticators/base.py @@ -14,7 +14,7 @@ class ActivationResult: class ActivationMessageResult(ActivationResult): - def __init__(self, message, type="info"): + def __init__(self, message: str, type="info"): assert type in ("error", "warning", "info") self.type = type self.message = message From 3f9e73a2ecd1b5281a2062c0eb04a4f67178e239 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 7 Dec 2022 18:59:42 -0800 Subject: [PATCH 5/9] Add needs --- .github/workflows/self-hosted-e2e-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml index a96afb07c8350f..fec02e91e6eb9c 100644 --- a/.github/workflows/self-hosted-e2e-tests.yml +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -37,6 +37,8 @@ jobs: self-hosted-end-to-end: if: needs.files-changed.outputs.backend == 'true' + needs: files-changed + name: self-hosted tests runs-on: ubuntu-20.04 # temporary, remove once we are confident the action is working continue-on-error: true From 734e258a27d254630b248cc09ac848c37b9e8aee Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Wed, 7 Dec 2022 19:02:49 -0800 Subject: [PATCH 6/9] Revert "Test backend change" This reverts commit 82ce85f2cdcc529631f133f11f83595de5ebe239. --- src/sentry/auth/authenticators/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/auth/authenticators/base.py b/src/sentry/auth/authenticators/base.py index 0c9d1dc71200e6..78881e4040d80e 100644 --- a/src/sentry/auth/authenticators/base.py +++ b/src/sentry/auth/authenticators/base.py @@ -14,7 +14,7 @@ class ActivationResult: class ActivationMessageResult(ActivationResult): - def __init__(self, message: str, type="info"): + def __init__(self, message, type="info"): assert type in ("error", "warning", "info") self.type = type self.message = message From 175ed9a2a261bd65efb7783563a3b3f75d377446 Mon Sep 17 00:00:00 2001 From: anthony sottile <103459774+asottile-sentry@users.noreply.github.com> Date: Thu, 8 Dec 2022 10:54:05 -0500 Subject: [PATCH 7/9] ref: typo fix to trigger CI --- src/sentry/event_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sentry/event_manager.py b/src/sentry/event_manager.py index 5f767bab8f0c39..ec1e5ad05566a9 100644 --- a/src/sentry/event_manager.py +++ b/src/sentry/event_manager.py @@ -2209,8 +2209,8 @@ def _save_grouphash_and_group( def _message_from_metadata(meta: Mapping[str, str]) -> str: title = meta.get("title", "") location = meta.get("location", "") - seperator = ": " if title and location else "" - return f"{title}{seperator}{location}" + separator = ": " if title and location else "" + return f"{title}{separator}{location}" @metrics.wraps("save_event.save_aggregate_performance") From b820a3f43907e3cc0af5613328a8d9543676e3e7 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Thu, 8 Dec 2022 10:24:14 -0800 Subject: [PATCH 8/9] Merge file changed test into self-hosted CI job --- .github/workflows/self-hosted-e2e-tests.yml | 28 ++++++--------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml index fec02e91e6eb9c..8ea668310a8710 100644 --- a/.github/workflows/self-hosted-e2e-tests.yml +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -13,18 +13,12 @@ concurrency: cancel-in-progress: true jobs: - files-changed: - name: detect what files changed + self-hosted-end-to-end: + name: self-hosted tests runs-on: ubuntu-20.04 - timeout-minutes: 3 - # Map a step output to a job output - outputs: - api_docs: ${{ steps.changes.outputs.api_docs }} - backend: ${{ steps.changes.outputs.backend_all }} - backend_dependencies: ${{ steps.changes.outputs.backend_dependencies }} - backend_any_type: ${{ steps.changes.outputs.backend_any_type }} - migration_lockfile: ${{ steps.changes.outputs.migration_lockfile }} - plugins: ${{ steps.changes.outputs.plugins }} + # temporary, remove once we are confident the action is working + continue-on-error: true + timeout-minutes: 30 steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 @@ -35,16 +29,8 @@ jobs: token: ${{ github.token }} filters: .github/file-filters.yml - self-hosted-end-to-end: - if: needs.files-changed.outputs.backend == 'true' - needs: files-changed - name: self-hosted tests - runs-on: ubuntu-20.04 - # temporary, remove once we are confident the action is working - continue-on-error: true - timeout-minutes: 30 - steps: - name: Pull the test image + if: steps.changes.outputs.backend == 'true' id: image_pull env: SENTRY_TEST_IMAGE: us.gcr.io/sentryio/sentry:${{ github.event.pull_request.head.sha || github.sha }} @@ -59,8 +45,10 @@ jobs: sleep 10 done echo "sentry-test-image-name=$SENTRY_TEST_IMAGE" >> "$GITHUB_OUTPUT" + # TODO: push the image here - name: Run Sentry self-hosted e2e CI + if: steps.changes.outputs.backend == 'true' uses: getsentry/action-self-hosted-e2e-tests@fa5b8240848f0e645ac2918c530e60ec8f50e4b8 with: project_name: sentry From 3ccfa8ffc20cf0b057d4acf22c6e5fa523b6c0b2 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Thu, 8 Dec 2022 10:26:43 -0800 Subject: [PATCH 9/9] Replace "backend" with "backend_all" --- .github/workflows/self-hosted-e2e-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/self-hosted-e2e-tests.yml b/.github/workflows/self-hosted-e2e-tests.yml index 8ea668310a8710..f2ec58c524933d 100644 --- a/.github/workflows/self-hosted-e2e-tests.yml +++ b/.github/workflows/self-hosted-e2e-tests.yml @@ -30,7 +30,7 @@ jobs: filters: .github/file-filters.yml - name: Pull the test image - if: steps.changes.outputs.backend == 'true' + if: steps.changes.outputs.backend_all == 'true' id: image_pull env: SENTRY_TEST_IMAGE: us.gcr.io/sentryio/sentry:${{ github.event.pull_request.head.sha || github.sha }} @@ -48,7 +48,7 @@ jobs: # TODO: push the image here - name: Run Sentry self-hosted e2e CI - if: steps.changes.outputs.backend == 'true' + if: steps.changes.outputs.backend_all == 'true' uses: getsentry/action-self-hosted-e2e-tests@fa5b8240848f0e645ac2918c530e60ec8f50e4b8 with: project_name: sentry