From b32c2ac73a1a32ed5719a4f638dc4cd13e28d420 Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 3 Feb 2022 20:43:15 +0000 Subject: [PATCH 1/3] ci: prevent docker build with latest tag on main branch (#19) --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0be82e2..e046560 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -39,7 +39,6 @@ build: docker/gitlab: stage: build only: - - main - tags image: docker:stable services: From 49656af487e16757831c24e289c182f466b1774e Mon Sep 17 00:00:00 2001 From: Hector Date: Thu, 3 Feb 2022 20:49:25 +0000 Subject: [PATCH 2/3] add new nightly build job --- .gitlab-ci.yml | 40 ++++++++++++++++++++++++++++------------ Makefile | 3 +++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e046560..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,17 +50,20 @@ build: expire_in: 1 day docker/gitlab: + extends: .docker_template stage: build only: - 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) . From 3abbe2a95735c9708240b105aef52ee5bb74416c Mon Sep 17 00:00:00 2001 From: Hector Date: Sat, 12 Feb 2022 17:27:52 +0000 Subject: [PATCH 3/3] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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