diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0be82e2..bebe0d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,28 +1,41 @@ -image: golang:latest - -before_script: - - make go/dependencies - stages: - test - build +.go_template: + image: golang:latest + before_script: + - make go/dependencies + +.docker_template: + image: docker:stable + services: + - docker:dind + before_script: + - apk add git + - apk add make + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + dependencies: + extends: .go_template stage: test script: - make go/checkDependencies format: + extends: .go_template stage: test script: - make go/checkFmt test: + extends: .go_template stage: test script: - make go/test build: + extends: .go_template stage: build only: - main @@ -37,18 +50,20 @@ build: expire_in: 1 day docker/gitlab: + extends: .docker_template stage: build only: - - main - tags - image: docker:stable - services: - - docker:dind - before_script: - - apk add git - - apk add make - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY script: - make docker/build/latest - make docker/build/tag - docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter + +docker/gitlab/nightly: + extends: .docker_template + stage: build + only: + - main + script: + - make docker/build/nightly + - docker push registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter diff --git a/Makefile b/Makefile index f90f80e..456559e 100644 --- a/Makefile +++ b/Makefile @@ -32,5 +32,8 @@ build/docker: docker/build/latest: docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest . +docker/build/nightly: + docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:nightly . + docker/build/tag: docker build -t registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:$(shell git describe --tags) . diff --git a/README.md b/README.md index 2a2cc8a..5549313 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Use it by pulling the following image: registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest ``` -Use the `:latest` tag to get the most up to date code (less stable) or use one of the version tagged images to use a specific release. +Use the `:latest` tag to get the latest stable release. Or use the `:nightly` tag for the latest (unstable) version. See the [registry page](https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/container_registry) for all available tags. ### 3.1. Volumes