Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a597824b5 | |||
| 0429746ec5 | |||
| 9674c2bb72 | |||
|
d3b4ed7572
|
|||
| 193e39409d | |||
| 60c0c6c1b7 | |||
| e6b2a811e8 | |||
| 6ee067ed33 | |||
| 508df4247d | |||
| 7c98af2a00 | |||
| 04a159cb13 | |||
| d6827caf63 | |||
| ef8aa739c6 | |||
| 4219456fe3 | |||
| d9a760e625 | |||
| 8bcfc0f36d | |||
| 1a314802b5 | |||
| 6b9adcb959 | |||
| 7313374a23 | |||
| cea2045b12 | |||
| bfbec75aa9 | |||
| 96d4f3c2fd | |||
| f0c1a66729 | |||
|
3e8f7cd7e4
|
|||
| ba836dde7c | |||
| 3729f1f35a | |||
| 8dfe0bc370 | |||
| 5f2b986f45 | |||
| 99c4e9f0a9 | |||
| 2dee45e3bf | |||
| 0df1392f3e | |||
| 3f96abbe06 | |||
| 053bdab30d | |||
| 3d72e88ead | |||
| 26ff4918a4 | |||
| 229d562871 | |||
| 7f4114f20e | |||
| 9c29614fac | |||
| d95a2bb845 | |||
| bccb9722c7 | |||
| 5ec4512263 | |||
|
5238b02f23
|
|||
|
ec8cffe82e
|
|||
| db4c4dc3a4 | |||
| b561fc9c3c | |||
| b9668b771c | |||
| 84df23f47d | |||
| d340927525 | |||
| 4c8cc71c9e | |||
| be3863cbd5 | |||
| 243b6d7bea | |||
| fb8504e81c | |||
| 0527e59af3 | |||
| baeb828171 | |||
| 471f1e5f8a | |||
|
2c5eee11b8
|
|||
| 22fb82182f | |||
| aece78d62d | |||
| 281c377bd5 | |||
| 63948f534c | |||
| 5140e54d35 | |||
| 0a557737e1 | |||
| 661675dce8 | |||
| 1692698bd0 | |||
| a8aaaf97f7 | |||
| 0af40157f3 | |||
| ae1ce2988a | |||
| ed15398148 | |||
| 346533f03b | |||
| 32fe214a87 | |||
| 3481096941 | |||
| 425f6e0544 | |||
| d52488db95 | |||
| 9c72b183e7 | |||
| 6007249910 | |||
| 974f4b2eb2 | |||
| dc45d34bae | |||
| 571da9733b | |||
| e1bf56b1d1 | |||
| 32843b4e1a | |||
| e532d3633e | |||
| 79198551f6 | |||
| 59f4950fd6 | |||
| 5ae9d66073 | |||
| 427842334f | |||
| 81f93f6f7a | |||
| 9551de6ba2 | |||
| a3f8159305 | |||
| 4487e0def8 | |||
| b422de4c1c | |||
| c43915dfd3 | |||
| 3168c6b6ec | |||
| 571923c460 | |||
| 0231c3e944 | |||
| 6e1a22112e | |||
| 56d451931c | |||
| 83e6120969 | |||
| 50fc0788b7 | |||
| 5cbed948ea | |||
| 4ef7565a50 | |||
| 99ee066a50 | |||
| d147741c09 | |||
| 9ed1c3241c | |||
| 48760d7512 |
+6
-45
@@ -1,27 +1,15 @@
|
||||
include:
|
||||
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
||||
- project: unboundsoftware/ci-templates
|
||||
file: Release.gitlab-ci.yml
|
||||
- project: unboundsoftware/ci-templates
|
||||
file: Pre-Commit-Go.gitlab-ci.yml
|
||||
|
||||
image: golang:1.21.0
|
||||
image: golang:1.23.4@sha256:7ea4c9dcb2b97ff8ee80a67db3d44f98c8ffa0d191399197007d8459c1453041
|
||||
|
||||
stages:
|
||||
- deps
|
||||
- test
|
||||
- prepare
|
||||
- release
|
||||
|
||||
run-pre-commit:
|
||||
stage: .pre
|
||||
image: unbound/pre-commit
|
||||
variables:
|
||||
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
||||
cache:
|
||||
- key:
|
||||
files:
|
||||
- .pre-commit-config.yaml
|
||||
paths:
|
||||
- ${PRE_COMMIT_HOME}
|
||||
script:
|
||||
- pre-commit run --all-files
|
||||
|
||||
deps:
|
||||
stage: deps
|
||||
@@ -42,34 +30,7 @@ test:
|
||||
|
||||
vulnerabilities:
|
||||
stage: test
|
||||
image: golang:1.21.0
|
||||
image: golang:1.23.4@sha256:7ea4c9dcb2b97ff8ee80a67db3d44f98c8ffa0d191399197007d8459c1453041
|
||||
script:
|
||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
- govulncheck ./...
|
||||
|
||||
prepare_release:
|
||||
image: node:18
|
||||
stage: prepare
|
||||
before_script:
|
||||
- npm install -g conventional-changelog-cli
|
||||
script:
|
||||
- conventional-changelog -p conventionalcommits > ./release.description
|
||||
artifacts:
|
||||
paths:
|
||||
- release.description
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
||||
release:
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
stage: release
|
||||
needs:
|
||||
- job: prepare_release
|
||||
artifacts: true
|
||||
script:
|
||||
- echo "Running release_job for $TAG"
|
||||
release:
|
||||
tag_name: '$CI_COMMIT_TAG'
|
||||
description: ./release.description
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gomod"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
open-pull-requests-limit: 20
|
||||
rebase-strategy: none
|
||||
@@ -1,2 +1,3 @@
|
||||
run:
|
||||
allow-parallel-runners: true
|
||||
timeout: 5m
|
||||
|
||||
+10
-6
@@ -2,7 +2,7 @@
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
@@ -11,14 +11,14 @@ repos:
|
||||
- --allow-multiple-documents
|
||||
- id: check-added-large-files
|
||||
- repo: https://gitlab.com/devopshq/gitlab-ci-linter
|
||||
rev: v1.0.5
|
||||
rev: v1.0.6
|
||||
hooks:
|
||||
- id: gitlab-ci-linter
|
||||
args:
|
||||
- --project
|
||||
- unboundsoftware/shiny/sentrysetup
|
||||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
||||
rev: v9.5.0
|
||||
rev: v9.20.0
|
||||
hooks:
|
||||
- id: commitlint
|
||||
stages: [ commit-msg ]
|
||||
@@ -32,11 +32,15 @@ repos:
|
||||
- -local
|
||||
- gitlab.com/unboundsoftware/shiny/authz_client
|
||||
- repo: https://github.com/lietu/go-pre-commit
|
||||
rev: v0.0.1
|
||||
rev: v0.1.0
|
||||
hooks:
|
||||
- id: go-test
|
||||
- id: gofumpt
|
||||
- repo: https://github.com/golangci/golangci-lint
|
||||
rev: v1.54.2
|
||||
rev: v1.63.0
|
||||
hooks:
|
||||
- id: golangci-lint
|
||||
- id: golangci-lint-full
|
||||
- repo: https://github.com/gitleaks/gitleaks
|
||||
rev: v8.22.1
|
||||
hooks:
|
||||
- id: gitleaks
|
||||
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [0.3.0] - 2025-01-01
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- *(golangci)* Increase timeout for parallel runners to 5m
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/stretchr/testify to v1.10.0
|
||||
- *(deps)* Update module github.com/getsentry/sentry-go to v0.30.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- *(ci)* Remove pre-commit job and include new template
|
||||
|
||||
## [0.2.2] - 2024-10-21
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/getsentry/sentry-go to v0.29.1
|
||||
|
||||
## [0.2.1] - 2024-10-05
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/getsentry/sentry-go to v0.28.0
|
||||
- *(deps)* Update module github.com/getsentry/sentry-go to v0.28.1
|
||||
- *(deps)* Update module github.com/getsentry/sentry-go to v0.29.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update pre-commit hooks for golangci-lint to golangci-lint-full
|
||||
- Update to include Release stage and use external Release templates
|
||||
- Remove old release jobs
|
||||
|
||||
## [0.2.0] - 2024-03-23
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Replace apex with slog
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- *(deps)* Update module github.com/stretchr/testify to v1.9.0
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.24.0 to 0.24.1
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.24.1 to 0.25.0
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.25.0 to 0.26.0
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.26.0 to 0.27.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update to Go 1.21.1 for vulnerabilities
|
||||
- Use 1.21.1 in go.mod for Dependabot
|
||||
- Update to go 1.21.3 and remove patch level
|
||||
- Update version of Go
|
||||
- Update to Go 1.21.6
|
||||
- Update to Go 1.22.0
|
||||
- Remove Dependabot config
|
||||
- Add gitleaks to pre-commit setup
|
||||
|
||||
## [0.0.6] - 2023-09-06
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.23.0 to 0.24.0
|
||||
|
||||
## [0.0.5] - 2023-09-05
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.21.0 to 0.22.0
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.22.0 to 0.23.0
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.23.0 to 0.24.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update Go version
|
||||
- Make releases handle multi-line release notes
|
||||
- Update to Go 1.20.7
|
||||
- Update pre-commit versions
|
||||
- Update to Golang 1.21.0 for vulnerabilities
|
||||
|
||||
## [0.0.4] - 2023-06-04
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
|
||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update pre-commit and fix golangci-lint
|
||||
- Update golangci-lint
|
||||
|
||||
## [0.0.3] - 2023-05-08
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.20.0 to 0.21.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update to Go 1.20.3
|
||||
- Fix Gitlab CI lint
|
||||
- Update Go version for vulnerabilities
|
||||
|
||||
## [0.0.2] - 2023-03-31
|
||||
|
||||
### 💼 Other
|
||||
|
||||
- *(deps)* Bump github.com/stretchr/testify from 1.7.2 to 1.8.1
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.17.0 to 0.18.0
|
||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.18.0 to 0.19.0
|
||||
- *(deps)* Bump github.com/getsentry/sentry-go from 0.19.0 to 0.20.0
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Update to golang 1.20.1
|
||||
- Update Go verion for vulnerabilities scan
|
||||
|
||||
## [0.0.1] - 2023-01-29
|
||||
|
||||
### 🚀 Features
|
||||
|
||||
- Initial version
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- Add release job
|
||||
|
||||
<!-- generated by git-cliff -->
|
||||
@@ -1,19 +1,18 @@
|
||||
module gitlab.com/unboundsoftware/shiny/sentrysetup
|
||||
|
||||
go 1.19
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/apex/log v1.9.0
|
||||
github.com/getsentry/sentry-go v0.24.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
gitlab.com/unboundsoftware/apex-mocks v0.2.0
|
||||
github.com/getsentry/sentry-go v0.30.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/kr/pretty v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
golang.org/x/sys v0.6.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,90 +1,30 @@
|
||||
github.com/apex/log v1.9.0 h1:FHtw/xuaM8AgmvDDTI9fiwoAL25Sq2cxojnZICUU8l0=
|
||||
github.com/apex/log v1.9.0/go.mod h1:m82fZlWIuiWzWP04XCTXmnX0xRkYYbCdYn8jbJeLBEA=
|
||||
github.com/apex/logs v1.0.0/go.mod h1:XzxuLZ5myVHDy9SAmYpamKKRNApGj54PfYLcFrXqDwo=
|
||||
github.com/aphistic/golf v0.0.0-20180712155816-02c07f170c5a/go.mod h1:3NqKYiepwy8kCu4PNA+aP7WUV72eXWJeP9/r3/K9aLE=
|
||||
github.com/aphistic/sweet v0.2.0/go.mod h1:fWDlIh/isSE9n6EPsRmC0det+whmX6dJid3stzu0Xys=
|
||||
github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/getsentry/sentry-go v0.24.0 h1:02b7qEmJ56EHGe9KFgjArjU/vG/aywm7Efgu+iPc01Y=
|
||||
github.com/getsentry/sentry-go v0.24.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY=
|
||||
github.com/getsentry/sentry-go v0.30.0 h1:lWUwDnY7sKHaVIoZ9wYqRHJ5iEmoc0pqcRqFkosKzBo=
|
||||
github.com/getsentry/sentry-go v0.30.0/go.mod h1:WU9B9/1/sHDqeV8T+3VwwbjeR5MSXs/6aqG3mqZrezA=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/smartystreets/assertions v1.0.0/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
|
||||
github.com/smartystreets/gunit v1.0.0/go.mod h1:qwPWnhz6pn0NnRBP++URONOVyNkPyr4SauJk4cUOwJs=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tj/assert v0.0.0-20171129193455-018094318fb0/go.mod h1:mZ9/Rh9oLWpLLDRpvE+3b7gP/C2YyLFYxNmcLnPTMe0=
|
||||
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
|
||||
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
|
||||
github.com/tj/go-buffer v1.1.0/go.mod h1:iyiJpfFcR2B9sXu7KvjbT9fpM4mOelRSDTbntVj52Uc=
|
||||
github.com/tj/go-elastic v0.0.0-20171221160941-36157cbbebc2/go.mod h1:WjeM0Oo1eNAjXGDx2yma7uG2XoyRZTq1uv3M/o7imD0=
|
||||
github.com/tj/go-kinesis v0.0.0-20171128231115-08b17f58cb1b/go.mod h1:/yhzCV0xPfx6jb1bBgRFjl5lytqVqZXEaeqWP8lTEao=
|
||||
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
|
||||
gitlab.com/unboundsoftware/apex-mocks v0.2.0 h1:IFt+uyIoOkSl4qdUBLUSIvOhaRdQRGB6TnpZqfRuXqY=
|
||||
gitlab.com/unboundsoftware/apex-mocks v0.2.0/go.mod h1:FGsQjCu/nS6b+QaBpAFvms6p0Chr0aobGcUPeeZNSNo=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package sentrysetup
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/getsentry/sentry-go"
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ type SentryConfig struct {
|
||||
|
||||
var sentryInit = sentry.Init
|
||||
|
||||
func SetupSentry(logger log.Interface, releaseName string, args SentryConfig) error {
|
||||
func SetupSentry(logger *slog.Logger, releaseName string, args SentryConfig) error {
|
||||
if args.Disabled {
|
||||
logger.Info("Sentry disabled, setup using empty options")
|
||||
return sentryInit(sentry.ClientOptions{})
|
||||
@@ -47,6 +47,9 @@ func SetupSentry(logger log.Interface, releaseName string, args SentryConfig) er
|
||||
if err := sentryInit(cfg); err != nil {
|
||||
return fmt.Errorf("sentry setup: %w", err)
|
||||
}
|
||||
logger.Infof("configured Sentry for env: %s", args.Environment)
|
||||
logger.Info(fmt.Sprintf("configured Sentry for env: %s", args.Environment))
|
||||
if cfg.Debug {
|
||||
sentry.Logger = slog.NewLogLogger(logger.With("part", "sentry").Handler(), slog.LevelDebug)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+40
-5
@@ -1,13 +1,15 @@
|
||||
package sentrysetup
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/getsentry/sentry-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gitlab.com/unboundsoftware/apex-mocks"
|
||||
)
|
||||
|
||||
func TestSetupSentry(t *testing.T) {
|
||||
@@ -34,7 +36,7 @@ func TestSetupSentry(t *testing.T) {
|
||||
},
|
||||
init: nil,
|
||||
wantErr: assert.NoError,
|
||||
wantLogged: []string{"info: Sentry disabled, setup using empty options"},
|
||||
wantLogged: []string{`level=INFO msg="Sentry disabled, setup using empty options"`},
|
||||
},
|
||||
{
|
||||
name: "no environment",
|
||||
@@ -134,19 +136,52 @@ func TestSetupSentry(t *testing.T) {
|
||||
}
|
||||
},
|
||||
wantErr: assert.NoError,
|
||||
wantLogged: []string{"info: configured Sentry for env: production"},
|
||||
wantLogged: []string{`level=INFO msg="configured Sentry for env: production"`},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
logger := apex.New()
|
||||
logged := &bytes.Buffer{}
|
||||
logger := &MockLogger{
|
||||
logger: slog.New(slog.NewTextHandler(logged, &slog.HandlerOptions{
|
||||
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
|
||||
if a.Key == "time" {
|
||||
return slog.Attr{}
|
||||
}
|
||||
return a
|
||||
},
|
||||
})),
|
||||
logged: logged,
|
||||
}
|
||||
if tt.init == nil {
|
||||
sentryInit = sentry.Init
|
||||
} else {
|
||||
sentryInit = tt.init(t)
|
||||
}
|
||||
tt.wantErr(t, SetupSentry(logger, tt.args.releaseName, tt.args.args), fmt.Sprintf("SetupSentry(%v, %v, %v)", logger, tt.args.releaseName, tt.args.args))
|
||||
tt.wantErr(t, SetupSentry(logger.Logger(), tt.args.releaseName, tt.args.args), fmt.Sprintf("SetupSentry(%v, %v, %v)", logger, tt.args.releaseName, tt.args.args))
|
||||
logger.Check(t, tt.wantLogged)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type MockLogger struct {
|
||||
logger *slog.Logger
|
||||
logged *bytes.Buffer
|
||||
}
|
||||
|
||||
func (m *MockLogger) Logger() *slog.Logger {
|
||||
return m.logger
|
||||
}
|
||||
|
||||
func (m *MockLogger) Check(t testing.TB, wantLogged []string) {
|
||||
var gotLogged []string
|
||||
if m.logged.String() != "" {
|
||||
gotLogged = strings.Split(m.logged.String(), "\n")
|
||||
gotLogged = gotLogged[:len(gotLogged)-1]
|
||||
}
|
||||
if len(wantLogged) == 0 {
|
||||
assert.Empty(t, gotLogged)
|
||||
return
|
||||
}
|
||||
assert.Equal(t, wantLogged, gotLogged)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user