From 8f425fc4ab1af10c4d601ebe755cdedf2fa2a0fd Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sat, 19 Dec 2020 15:33:58 +0200 Subject: Pump Sentry SDK version from 0.14 to 0.19 --- Pipfile | 2 +- Pipfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Pipfile b/Pipfile index 23422869d..3ff653749 100644 --- a/Pipfile +++ b/Pipfile @@ -23,7 +23,7 @@ more_itertools = "~=8.2" python-dateutil = "~=2.8" pyyaml = "~=5.1" requests = "~=2.22" -sentry-sdk = "~=0.14" +sentry-sdk = "~=0.19" sphinx = "~=2.2" statsd = "~=3.3" emoji = "~=0.6" diff --git a/Pipfile.lock b/Pipfile.lock index ca72fb0f3..085d3d829 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "bfaf61339c0cebb10d76f2e14ff967030008b8512b5f0b4c23c9e8997aab4552" + "sha256": "1ba637e521c654a23bcc82950e155f5366219eae00bbf809170a371122961a4f" }, "pipfile-spec": 6, "requires": { @@ -957,11 +957,11 @@ }, "flake8-tidy-imports": { "hashes": [ - "sha256:2821c79e83c656652d5ac6d3650ca370ed3c9752edb5383b1d50dee5bd8a383f", - "sha256:6cdd51e0d2f221e43ff4d5ac6331b1d95bbf4a5408906e36da913acaaed890e0" + "sha256:52e5f2f987d3d5597538d5941153409ebcab571635835b78f522c7bf03ca23bc", + "sha256:76e36fbbfdc8e3c5017f9a216c2855a298be85bc0631e66777f4e6a07a859dc4" ], "index": "pypi", - "version": "==4.2.0" + "version": "==4.2.1" }, "flake8-todo": { "hashes": [ -- cgit v1.2.3 From 4ebbb5db954fb82a66341cbae13ce6db7641f891 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sat, 19 Dec 2020 15:38:15 +0200 Subject: Create workflow for creating Sentry release --- .github/workflows/sentry_release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/sentry_release.yml diff --git a/.github/workflows/sentry_release.yml b/.github/workflows/sentry_release.yml new file mode 100644 index 000000000..b0e6876f8 --- /dev/null +++ b/.github/workflows/sentry_release.yml @@ -0,0 +1,24 @@ +name: Create Sentry release + +on: + push: + branches: + - master + +jobs: + create_sentry_release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@master + + - name: Create a Sentry.io release + uses: tclindner/sentry-releases-action@v1.2.0 + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + SENTRY_ORG: python-discord + SENTRY_PROJECT: bot + with: + tagName: ${{ github.sha }} + environment: production + releaseNamePrefix: pydis-bot@ -- cgit v1.2.3 From 756fa37d3727e6448dd352d767b0e52c79691d1c Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 08:58:55 +0200 Subject: Consume Git SHA build arg and add to it to environment --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0b1674e7a..5d0380b44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ FROM python:3.8-slim +# Define Git SHA build argument +ARG git_sha="development" + # Set pip to have cleaner logs and no saved cache ENV PIP_NO_CACHE_DIR=false \ PIPENV_HIDE_EMOJIS=1 \ PIPENV_IGNORE_VIRTUALENVS=1 \ - PIPENV_NOSPIN=1 + PIPENV_NOSPIN=1 \ + GIT_SHA=$git_sha RUN apt-get -y update \ && apt-get install -y \ -- cgit v1.2.3 From 8da34233fe7d129ee199efdaa92ea9fc67a0e35f Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:00:32 +0200 Subject: Inject Git SHA in container build workflow --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6152f1543..25bcce848 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,3 +55,5 @@ jobs: tags: | ghcr.io/python-discord/bot:latest ghcr.io/python-discord/bot:${{ steps.sha_tag.outputs.tag }} + build-args: | + git_sha=${{ GITHUB_SHA }} -- cgit v1.2.3 From 33ad294ae9fd1128982c6ccd7e183e5b2dfc4752 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:00:45 +0200 Subject: Add constant for Git SHA --- bot/constants.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bot/constants.py b/bot/constants.py index c4bb6b2d6..92287a930 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -656,6 +656,9 @@ MODERATION_CHANNELS = Guild.moderation_channels # Category combinations MODERATION_CATEGORIES = Guild.moderation_categories +# Git SHA for Sentry +GIT_SHA = os.environ.get("GIT_SHA", "development") + # Bot replies NEGATIVE_REPLIES = [ "Noooooo!!", -- cgit v1.2.3 From 4c7ada8ee41f097e2b9b753114fadca28998da88 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:02:16 +0200 Subject: Attach release on Sentry SDK initialization --- bot/log.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/log.py b/bot/log.py index 13141de40..bb44cee8a 100644 --- a/bot/log.py +++ b/bot/log.py @@ -69,7 +69,8 @@ def setup_sentry() -> None: sentry_logging, AioHttpIntegration(), RedisIntegration(), - ] + ], + release=f"bot@{constants.GIT_SHA}" ) -- cgit v1.2.3 From e7ca3af18b92c732fac8f688df17da614457cd54 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:03:34 +0200 Subject: Use bot prefix instead pydis-bot for Sentry release workflow --- .github/workflows/sentry_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sentry_release.yml b/.github/workflows/sentry_release.yml index b0e6876f8..b8d92e90a 100644 --- a/.github/workflows/sentry_release.yml +++ b/.github/workflows/sentry_release.yml @@ -21,4 +21,4 @@ jobs: with: tagName: ${{ github.sha }} environment: production - releaseNamePrefix: pydis-bot@ + releaseNamePrefix: bot@ -- cgit v1.2.3 From 981eac1427ce7fd8d16bf79bfef68af86b625b10 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 09:05:02 +0200 Subject: Remove aiohttp integration --- bot/log.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/bot/log.py b/bot/log.py index bb44cee8a..0935666d1 100644 --- a/bot/log.py +++ b/bot/log.py @@ -6,7 +6,6 @@ from pathlib import Path import coloredlogs import sentry_sdk -from sentry_sdk.integrations.aiohttp import AioHttpIntegration from sentry_sdk.integrations.logging import LoggingIntegration from sentry_sdk.integrations.redis import RedisIntegration @@ -67,7 +66,6 @@ def setup_sentry() -> None: dsn=constants.Bot.sentry_dsn, integrations=[ sentry_logging, - AioHttpIntegration(), RedisIntegration(), ], release=f"bot@{constants.GIT_SHA}" -- cgit v1.2.3 From d5988993e71e6dcd78b454a29d7132fc11fb6e71 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 20 Dec 2020 17:22:20 +0200 Subject: Fix wrong way for getting Git SHA --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25bcce848..6c97e8784 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,4 +56,4 @@ jobs: ghcr.io/python-discord/bot:latest ghcr.io/python-discord/bot:${{ steps.sha_tag.outputs.tag }} build-args: | - git_sha=${{ GITHUB_SHA }} + git_sha=${{ github.sha }} -- cgit v1.2.3