diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33a5442..2081a95 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -62,17 +62,3 @@ release: -e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \ -e GITLAB_TOKEN \ goreleaser/goreleaser release --clean - -tag images: - stage: release - image: docker:stable - services: - - docker:dind - needs: - - release - rules: - - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/ - variables: - IMAGE_NAME: registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter - script: - - ./.gitlab-ci/tagLatestImage.sh diff --git a/.gitlab-ci/tagLatestImage.sh b/.gitlab-ci/tagLatestImage.sh deleted file mode 100755 index a2973c7..0000000 --- a/.gitlab-ci/tagLatestImage.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -VERSION=`echo $CI_COMMIT_TAG | cut -c 2-` -MAJOR=`echo $VERSION | cut -d "." -f 1` -MINOR=`echo $VERSION | cut -d "." -f 2` - -echo "version: $VERSION (major: $MAJOR; minor: $MINOR)" - -docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY -docker pull $IMAGE_NAME:$VERSION -docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest -docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$MAJOR -docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$MAJOR.$MINOR -docker push $IMAGE_NAME diff --git a/.goreleaser.yml b/.goreleaser.yml index 300e1a5..479c2fd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -15,9 +15,15 @@ builds: - "7" dockers: -- image_templates: ["registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}"] - dockerfile: Dockerfile +- image_templates: + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-amd64" + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-amd64" + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-amd64' + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-amd64" + use: buildx build_flag_templates: + - "--pull" + - "--platform=linux/amd64" - --label=org.opencontainers.image.title={{ .ProjectName }} - --label=org.opencontainers.image.description={{ .ProjectName }} - --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter @@ -26,6 +32,45 @@ dockers: - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - --label=org.opencontainers.image.revision={{ .FullCommit }} - --label=org.opencontainers.image.licenses=MIT +- image_templates: + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-arm64" + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-arm64" + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-arm64' + - "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-arm64" + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/arm64" + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter + - --label=org.opencontainers.image.source=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=MIT + goarch: arm64 + +docker_manifests: +- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}' + image_templates: + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-amd64' + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-arm64' + +- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}' + image_templates: + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-amd64' + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-arm64' + +- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}' + image_templates: + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-amd64' + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-arm64' + +- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest' + image_templates: + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-amd64' + - 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-arm64' changelog: groups: