Add linter.
This commit is contained in:
parent
53e95073d2
commit
c30d17a4a0
8 changed files with 187 additions and 113 deletions
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
|
@ -1,18 +1,32 @@
|
|||
name: PullRequest
|
||||
|
||||
on: [pull_request]
|
||||
"on": [pull_request]
|
||||
|
||||
jobs:
|
||||
|
||||
lint-yaml:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ibiqlik/action-yamllint@v3
|
||||
with:
|
||||
format: colored
|
||||
strict: true
|
||||
|
||||
lint-markdown:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: docker://avtodev/markdown-lint:v1
|
||||
with:
|
||||
args: /github/workspace
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: setup
|
||||
uses: actions/setup-java@v1
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: dependencies
|
||||
run: mvn -B -q dependency:go-offline
|
||||
- name: verify
|
||||
run: mvn -B verify
|
||||
- run: mvn -B dependency:go-offline -q
|
||||
- run: mvn -B verify
|
||||
|
|
41
.github/workflows/release.yml
vendored
41
.github/workflows/release.yml
vendored
|
@ -1,22 +1,41 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
"on":
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
lint-yaml:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ibiqlik/action-yamllint@v3
|
||||
with:
|
||||
format: colored
|
||||
strict: true
|
||||
|
||||
lint-markdown:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: docker://avtodev/markdown-lint:v1
|
||||
with:
|
||||
args: /github/workspace
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- lint-markdown
|
||||
- lint-yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.GIT_ACTION_TOKEN }}
|
||||
- name: git-configure
|
||||
run: |
|
||||
git config user.email "actions@github.com"
|
||||
git config user.name "GitHub Actions"
|
||||
- name: setup
|
||||
uses: actions/setup-java@v1
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
server-id: sonatype-nexus
|
||||
|
@ -24,14 +43,10 @@ jobs:
|
|||
server-password: SERVER_PASSWORD
|
||||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
gpg-passphrase: GPG_PASSPHRASE
|
||||
- name: dependencies
|
||||
run: mvn -B -q dependency:go-offline
|
||||
- name: prepare
|
||||
run: mvn -B release:prepare
|
||||
- name: perform
|
||||
run: mvn -B release:perform
|
||||
- run: mvn -B dependency:go-offline -q
|
||||
- run: mvn -B release:prepare
|
||||
- run: mvn -B release:perform -DreleaseProfiles=oss-release
|
||||
env:
|
||||
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
|
||||
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
|
||||
|
|
37
.github/workflows/snapshot.yml
vendored
37
.github/workflows/snapshot.yml
vendored
|
@ -1,28 +1,45 @@
|
|||
name: Snapshot
|
||||
|
||||
on:
|
||||
"on":
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- '[1-9]+.[0-9]+.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
lint-yaml:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: setup
|
||||
uses: actions/setup-java@v1
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ibiqlik/action-yamllint@v3
|
||||
with:
|
||||
format: colored
|
||||
strict: true
|
||||
|
||||
lint-markdown:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: docker://avtodev/markdown-lint:v1
|
||||
with:
|
||||
args: /github/workspace
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- lint-markdown
|
||||
- lint-yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
server-id: sonatype-nexus
|
||||
server-username: SERVER_USERNAME
|
||||
server-password: SERVER_PASSWORD
|
||||
- name: dependencies
|
||||
run: mvn -B -q dependency:go-offline
|
||||
- name: deploy
|
||||
run: mvn -B deploy
|
||||
- run: mvn -B dependency:go-offline -q
|
||||
- run: mvn -B deploy -Poss
|
||||
env:
|
||||
SERVER_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
|
||||
SERVER_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
|
||||
|
|
6
.markdownlint.yaml
Normal file
6
.markdownlint.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Default state for all rules
|
||||
default: true
|
||||
|
||||
# MD013/line-length - Line length
|
||||
MD013:
|
||||
line_length: 10000
|
10
.yamllint
Normal file
10
.yamllint
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends: default
|
||||
|
||||
## see https://yamllint.readthedocs.io/en/stable/rules.html
|
||||
rules:
|
||||
|
||||
# no need for document start
|
||||
document-start: disable
|
||||
|
||||
# line length is not important
|
||||
line-length: disable
|
76
README.md
76
README.md
|
@ -4,20 +4,22 @@
|
|||
|
||||
### Available Appender
|
||||
|
||||
* console format
|
||||
* Stackdriver format (with support for error reporting)
|
||||
* console format
|
||||
* Stackdriver format (with support for error reporting)
|
||||
|
||||
### Set log level based on MDC values
|
||||
|
||||
Configuration:
|
||||
* *enabled*: enable MDC filter (`true` is default)
|
||||
* *key*: MDC key, is optional (will use name instead, see example `user` below)
|
||||
* *level*: log level to use (`TRACE` is default)
|
||||
* *loggers*: passlist of logger names, matches all loggers if empty
|
||||
* *values*: values for matching MDC key, matches all values if empty
|
||||
|
||||
* *enabled*: enable MDC filter (`true` is default)
|
||||
* *key*: MDC key, is optional (will use name instead, see example `user` below)
|
||||
* *level*: log level to use (`TRACE` is default)
|
||||
* *loggers*: passlist of logger names, matches all loggers if empty
|
||||
* *values*: values for matching MDC key, matches all values if empty
|
||||
|
||||
Example for setting different values for different values/logger:
|
||||
```
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
levels:
|
||||
io.kokuwa: INFO
|
||||
|
@ -41,7 +43,8 @@ logger:
|
|||
```
|
||||
|
||||
Example for omiting level and key:
|
||||
```
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
levels:
|
||||
io.kokuwa: INFO
|
||||
|
@ -55,7 +58,8 @@ logger:
|
|||
```
|
||||
|
||||
Example for minimal configuration:
|
||||
```
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
levels:
|
||||
io.kokuwa: INFO
|
||||
|
@ -66,19 +70,22 @@ logger:
|
|||
### Set log level based on HTTP request header
|
||||
|
||||
Configuration for server filter (prefixed with *logger.request.filter*):
|
||||
* *enabled*: enable HTTP server filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) (highest is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *header*: name of HTTP header (`x-log-level` is default)
|
||||
|
||||
* *enabled*: enable HTTP server filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) (highest is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *header*: name of HTTP header (`x-log-level` is default)
|
||||
|
||||
Configuration for client filter for propagation (prefixed with *logger.request.propagation*):
|
||||
* *enabled*: enable HTTP client filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) (tracing is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *header*: name of HTTP header (server header is default)
|
||||
|
||||
* *enabled*: enable HTTP client filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) (tracing is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *header*: name of HTTP header (server header is default)
|
||||
|
||||
Example with default configuration:
|
||||
```
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
request:
|
||||
filter:
|
||||
|
@ -96,13 +103,15 @@ logger:
|
|||
### Add principal for request to MDC
|
||||
|
||||
Configuration:
|
||||
* *enabled*: enable HTTP principal filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) ([ServerFilterPhase.SECURITY.after()](https://github.com/micronaut-projects/micronaut-core/blob/v2.0.1/http/src/main/java/io/micronaut/http/filter/ServerFilterPhase.java#L54) is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *key*: name of MDC header (`principal` is default)
|
||||
|
||||
* *enabled*: enable HTTP principal filter (`true` is default)
|
||||
* *order*: order for [Ordered](https://github.com/micronaut-projects/micronaut-core/blob/master/core/src/main/java/io/micronaut/core/order/Ordered.java) ([ServerFilterPhase.SECURITY.after()](https://github.com/micronaut-projects/micronaut-core/blob/v2.0.1/http/src/main/java/io/micronaut/http/filter/ServerFilterPhase.java#L54) is default)
|
||||
* *path*: filter path (`/**` is default)
|
||||
* *key*: name of MDC header (`principal` is default)
|
||||
|
||||
Example with default configuration:
|
||||
```
|
||||
|
||||
```yaml
|
||||
logger:
|
||||
request:
|
||||
principal:
|
||||
|
@ -117,25 +126,28 @@ logger:
|
|||
### Dependency updates
|
||||
|
||||
Display dependency updates:
|
||||
```
|
||||
|
||||
```sh
|
||||
mvn versions:display-property-updates -U
|
||||
```
|
||||
|
||||
Update dependencies:
|
||||
```
|
||||
|
||||
```sh
|
||||
mvn versions:update-properties
|
||||
```
|
||||
|
||||
### Release locally
|
||||
|
||||
Run:
|
||||
```
|
||||
mvn release:prepare release:perform release:clean -B
|
||||
|
||||
```sh
|
||||
mvn release:prepare release:perform release:clean -B -DreleaseProfiles=oss-release
|
||||
```
|
||||
|
||||
## Open Topics
|
||||
|
||||
* configure mdc on refresh event
|
||||
* add stackdriver per configuration
|
||||
* add fluent per configuration
|
||||
* read **serviceName** and **serviceVersion** from yaml
|
||||
* configure mdc on refresh event
|
||||
* add stackdriver per configuration
|
||||
* add fluent per configuration
|
||||
* read **serviceName** and **serviceVersion** from yaml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue