prometheus-fail2ban-exporter/.gitlab-ci.yml

59 lines
1.2 KiB
YAML
Raw Permalink Normal View History

2021-02-05 22:49:47 +00:00
stages:
- test
- build
- release
2021-02-05 22:49:47 +00:00
.go_template:
image: golang:latest
dependencies:
extends: .go_template
stage: test
script:
2023-06-19 18:37:27 +00:00
- make check/dependencies
2021-02-05 22:49:47 +00:00
format:
extends: .go_template
2021-02-05 22:49:47 +00:00
stage: test
script:
2023-06-19 18:37:27 +00:00
- make check/fmt
2021-02-05 22:49:47 +00:00
test:
extends: .go_template
2021-02-05 22:49:47 +00:00
stage: test
script:
2023-06-19 18:37:27 +00:00
- make test
build:
extends: .go_template
stage: build
script:
- make build
artifacts:
paths:
- fail2ban_exporter
expire_in: 1 day
release:
stage: release
image: docker:stable
services:
- docker:dind
variables:
DOCKER_REGISTRY: $CI_REGISTRY
DOCKER_USERNAME: $CI_REGISTRY_USER
DOCKER_PASSWORD: $CI_REGISTRY_PASSWORD
GIT_DEPTH: 0
rules:
- if: $CI_COMMIT_TAG =~ /^v.*$/
script: |
# GITLAB_TOKEN is needed to create GitLab releases.
# DOCKER_* are needed to push Docker images.
docker run --rm --privileged \
-v $PWD:/go/src/gitlab.com/hectorjsmith/fail2ban-prometheus-exporter \
-w /go/src/gitlab.com/hectorjsmith/fail2ban-prometheus-exporter \
-v /var/run/docker.sock:/var/run/docker.sock \
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
goreleaser/goreleaser release --clean