ci: update creation of tags (#19)
Update creation of docker tags to only tag actual releases with the `:latest` tag. Builds on the main branch are now tagged with a `:nightly` tag.
This commit is contained in:
parent
191dda3b9f
commit
05f236902a
3 changed files with 32 additions and 14 deletions
|
@ -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
|
||||
|
|
3
Makefile
3
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) .
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue