fix(ci): renovate, golang-ci lint
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Markus Pesch 2022-03-11 10:34:55 +01:00
parent 268197aa9e
commit 85c288970a
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
4 changed files with 243 additions and 60 deletions

View File

@ -1,64 +1,29 @@
---
kind: pipeline kind: pipeline
type: docker type: kubernetes
name: amd64 name: linter
platform:
os: linux
steps: steps:
- name: build-linux-amd64 - name: markdown lint
image: docker.io/volkerraschek/build-image:latest
commands: commands:
- make - markdownlint *.md
when: image: docker.io/volkerraschek/markdownlint:0.30.0
event: resources:
- push limits:
- pull_request cpu: 50
- tag memory: 50M
- name: build-image-latest - name: golang-ci lint
image: docker.io/volkerraschek/build-image:latest image: docker.io/golangci/golangci-lint:1.44.2-alpine
commands: resources:
- make CONTAINER_RUNTIME=docker container-image/build limits:
volumes: cpu: 100
- name: docker_socket memory: 250M
path: /var/run/docker.sock
when:
branch:
- master
- name: push-image-latest - name: email-notification
image: docker.io/volkerraschek/build-image:latest
commands:
- make CONTAINER_RUNTIME=docker container-image/push
environment:
CONTAINER_IMAGE_REGISTRY_PASSWORD:
from_secret: container_image_registry_password
volumes:
- name: docker_socket
path: /var/run/docker.sock
when:
repo:
- volker.raschek/dyndns-client
branch:
- master
- name: push-latest-commit
environment:
GIT_PUSH_SSH_KEY:
from_secret:
github_ssh_key
image: appleboy/drone-git-push:0.2.0-linux-amd64
settings:
remote: git@github.com:volker-raschek/dyndns-client.git
force: true
when:
repo:
- volker.raschek/dyndns-client
branch:
- master
event:
- push
- name: notify
image: drillster/drone-email
environment: environment:
PLUGIN_HOST: PLUGIN_HOST:
from_secret: smtp_host from_secret: smtp_host
@ -68,12 +33,164 @@ steps:
from_secret: smtp_password from_secret: smtp_password
PLUGIN_FROM: PLUGIN_FROM:
from_secret: smtp_mail_address from_secret: smtp_mail_address
image: docker.io/drillster/drone-email:latest
resources:
limits:
cpu: 50
memory: 25M
when: when:
status: status:
- changed - changed
- failure - failure
volumes: trigger:
- name: docker_socket event:
host: exclude:
path: /var/run/docker.sock - tag
---
kind: pipeline
type: kubernetes
name: vulnerability-check
depends_on:
- linter
platform:
os: linux
steps:
- name: gosec
commands:
- gosec ./...
image: docker.io/volkerraschek/gosec:2.9.4
resources:
limits:
cpu: 250
memory: 250M
- name: email-notification
environment:
PLUGIN_HOST:
from_secret: smtp_host
PLUGIN_USERNAME:
from_secret: smtp_username
PLUGIN_PASSWORD:
from_secret: smtp_password
PLUGIN_FROM:
from_secret: smtp_mail_address
image: docker.io/drillster/drone-email:latest
resources:
limits:
cpu: 50
memory: 25M
when:
status:
- changed
- failure
trigger:
event:
exclude:
- tag
---
kind: pipeline
type: kubernetes
name: unit-test-amd64
depends_on:
- linter
platform:
arch: amd64
steps:
- name: unit-test
commands:
- go test -v ./...
image: docker.io/library/golang:1.17.6
resources:
limits:
cpu: 250
memory: 500M
trigger:
event:
exclude:
- tag
---
kind: pipeline
type: kubernetes
name: unit-test-arm64
depends_on:
- linter
platform:
arch: arm64
steps:
- name: unit-test
commands:
- go test -v ./...
image: docker.io/library/golang:1.17.6
resources:
limits:
cpu: 250
memory: 500M
trigger:
event:
exclude:
- tag
---
kind: pipeline
type: kubernetes
name: sync
platform:
os: linux
arch: amd64
steps:
- name: github
image: docker.io/appleboy/drone-git-push:latest
resources:
limits:
cpu: 50
memory: 25M
settings:
branch: master
remote: ssh://git@github.com/volker-raschek/dyndns-client.git
force: true
ssh_key:
from_secret: ssh_key
- name: email-notification
environment:
PLUGIN_HOST:
from_secret: smtp_host
PLUGIN_USERNAME:
from_secret: smtp_username
PLUGIN_PASSWORD:
from_secret: smtp_password
PLUGIN_FROM:
from_secret: smtp_mail_address
image: docker.io/drillster/drone-email:latest
resources:
limits:
cpu: 50
memory: 25M
when:
status:
- changed
- failure
trigger:
event:
- push
repo:
- volker-raschek/dyndns-client

29
.golangci.yml Normal file
View File

@ -0,0 +1,29 @@
run:
skip-dirs:
- it
timeout: 10m
tests: true
linters:
disable-all: true
enable:
# Default
- deadcode
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
# Additionally linters
- bodyclose
- misspell
- nilerr
- rowserrcheck
- sqlclosecheck
- unparam
- whitespace

View File

@ -40,4 +40,4 @@ required.
} }
} }
} }
``` ```

37
renovate.json Normal file
View File

@ -0,0 +1,37 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"assigneesFromCodeOwners": true,
"automergeStrategy": "merge-commit",
"automergeType": "pr",
"labels": [ "renovate" ],
"packageRules": [
{
"description": "Automatically update minor and patch versions of used drone-ci images",
"addLabels": [ "renovate/droneci", "renovate/automerge" ],
"automerge": true,
"matchManagers": "droneci",
"matchUpdateTypes": [ "minor", "patch"]
},
{
"description": "Automatically update minor and patch versions of go modules",
"addLabels": [ "renovate/gomod", "renovate/automerge" ],
"automerge": true,
"matchBaseBranches": [ "master" ],
"matchManagers": [ "gomod" ],
"matchUpdateTypes": [ "minor", "patch" ]
},
{
"description": "Prepare MR for major update minor of go modules",
"addLabels": [ "renovate/gomod" ],
"automerge": false,
"matchBaseBranches": [ "master" ],
"matchManagers": [ "gomod" ],
"matchUpdateTypes": [ "major" ]
}
],
"postUpdateOptions": [
"gomodTidy"
],
"rebaseLabel": "renovate/rebase",
"rebaseWhen": "behind-base-branch"
}