Skip to content

Commit

Permalink
prepare for new version release
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil committed Sep 12, 2022
1 parent b588324 commit 52586e3
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 22 deletions.
82 changes: 82 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# taken from https://github.com/bxcodec/go-clean-arch/blob/master/.golangci.yaml

govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
golint:
min-confidence: 0.8
gocyclo:
min-complexity: 20
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 5
misspell:
locale: US
lll:
line-length: 160
# tab width in spaces. Default to 1.
tab-width: 1
funlen:
lines: 120
statements: 50

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- deadcode
- errcheck
- funlen
- goconst
# - gocritic
- gocyclo
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- lll
- misspell
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck

run:
# default concurrency is a available CPU number
concurrency: 2

skip-dirs:
# - test/testdata_etc
skip-files:
# - .*_test.go

issues:
exclude-rules:
- path: internal/(cache|renameio)/
linters:
- lll
- gochecknoinits
- gocyclo
- funlen
- path: .*_test.go
linters:
- funlen
exclude-use-default: false
exclude:
- should have a package comment
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.12-alpine AS builder
FROM golang:1.19-alpine AS builder

WORKDIR /src/app

Expand All @@ -9,7 +9,7 @@ RUN apk add --no-cache git \
COPY . .
RUN go install

FROM alpine:latest
FROM alpine:3.16
LABEL maintainer "Alex Simenduev <[email protected]>"

ENTRYPOINT ["odfe-alerts-handler"]
Expand Down
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

An HTTP server which used to handle webhooks triggered by [OpenDistro for Elasticsearch Alerting](https://opendistro.github.io/for-elasticsearch-docs/docs/alerting)

> Notice, the readme is for `0.2.x` version
> Notice, the readme is for `0.3.x` version
## Why?

Expand All @@ -22,25 +22,29 @@ Download latest version for your platform from [releases](https://github.com/bri

## With Docker

docker run --rm -p 8080:8080 bringg/odfe-alerts-handler --help
```shell
docker run --rm -p 8080:8080 bringg/odfe-alerts-handler --help
```

## Usage

usage: odfe-alerts-handler [<flags>]

Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--web.listen-address=":8080"
Address to listen on for incoming HTTP requests.
--smtp.host="localhost" SMTP server hostname.
--smtp.port=25 SMTP server port.
--smtp.username="" SMTP server login username.
--smtp.password="" SMTP server login password.
--smtp.from="opendistro@localhost"
SMTP from address.
--smtp.default-subject="Opendistro Alert fired"
SMTP default subject.
--slack.token="" Slack token for posting messages.
```plain
usage: odfe-alerts-handler [<flags>]
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--web.listen-address=":8080"
Address to listen on for incoming HTTP requests.
--smtp.host="localhost" SMTP server hostname.
--smtp.port=25 SMTP server port.
--smtp.username="" SMTP server login username.
--smtp.password="" SMTP server login password.
--smtp.from="opendistro@localhost"
SMTP from address.
--smtp.default-subject="Opendistro Alert fired"
SMTP default subject.
--slack.token="" Slack token for posting messages.
```

## Configure ODFE Alerting destinations

Expand All @@ -59,7 +63,7 @@ Download latest version for your platform from [releases](https://github.com/bri

```yaml
to: ['[email protected]']
subject: ['Optional subject param']
subject: Optional subject param
---
This is the body of the message
Here you can use the templeting as usual...
Expand All @@ -86,8 +90,8 @@ Optionally, for `channels` you can omit the leading `#`.
## Creating a release

```shell
RELEASE_TITLE="First release"
RELEASE_VERSION=0.2.0
RELEASE_TITLE="Module maintenance, and fix slack deprecations"
RELEASE_VERSION=0.3.0

git tag -a v${RELEASE_VERSION} -m "${RELEASE_TITLE}"
git push --tags
Expand Down

0 comments on commit 52586e3

Please sign in to comment.