From ae98a081c71332af96e7c3f67b0081f99c70c17a Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Tue, 2 Nov 2021 20:13:06 +0100 Subject: [PATCH 1/5] Use correct opencontainers annotation for created --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index f079bd82..3f187782 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -44,7 +44,7 @@ dockers: - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .Env.GIT_HASH }}" build_flag_templates: - "--pull" - - "--label=com.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" - "--label=org.opencontainers.image.description={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" From 57fd9be8176168b8d3cf467bbc6f76ec8efac761 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Tue, 2 Nov 2021 20:16:32 +0100 Subject: [PATCH 2/5] Simplify release docker image by reusing the goreleaser variables available --- .goreleaser.yml | 4 ++-- Makefile | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3f187782..0b00f778 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -39,9 +39,9 @@ dockers: goarch: amd64 image_templates: - "philipssoftware/{{ .ProjectName }}:{{ .Tag }}" - - "philipssoftware/{{ .ProjectName }}:{{ .Env.GIT_HASH }}" + - "philipssoftware/{{ .ProjectName }}:{{ .FullCommit }}" - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .Tag }}" - - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .Env.GIT_HASH }}" + - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .FullCommit }}" build_flag_templates: - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" diff --git a/Makefile b/Makefile index 6e405c86..e1ddbe69 100644 --- a/Makefile +++ b/Makefile @@ -75,13 +75,12 @@ $(GO_PATH)/bin/goreleaser: .PHONY: snapshot-release snapshot-release: $(GO_PATH)/bin/goreleaser ## creates a snapshot release using goreleaser - LDFLAGS=$(LDFLAGS) GIT_TAG=$(GIT_TAG) GIT_HASH=$(GIT_HASH) goreleaser release --snapshot --rm-dist + LDFLAGS=$(LDFLAGS) goreleaser release --snapshot --rm-dist .PHONY: release release: $(GO_PATH)/bin/goreleaser ## creates a release using goreleaser - LDFLAGS=$(LDFLAGS) GIT_TAG=$(GIT_TAG) GIT_HASH=$(GIT_HASH) goreleaser release + LDFLAGS=$(LDFLAGS) goreleaser release .PHONY: release-vars release-vars: ## print the release variables for goreleaser @echo export LDFLAGS=\"$(LDFLAGS)\" - @echo export GIT_HASH=$(GIT_HASH) From b03b231269dde39cfa41cabe177b85de03f223c5 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Tue, 2 Nov 2021 20:20:07 +0100 Subject: [PATCH 3/5] Add opcontainers vendor label for docker image --- .goreleaser.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 0b00f778..723a5ddb 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -50,6 +50,7 @@ dockers: - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - "--label=org.opencontainers.image.licenses=MIT" + - "--label=org.opencontainers.image.vendor=Koninklijke Philips N.V." extra_files: - "Makefile" - "go.mod" From aaa84a3726100bc858ce865ddf9777d33c23ffe5 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Tue, 2 Nov 2021 20:35:59 +0100 Subject: [PATCH 4/5] Use .Version for tagging docker images https://goreleaser.com/customization/templates/ .Version is dynamically updated in nightly and snapshot releases. e.g. v0.2.0-next allowing us to expand our release flows. --- .goreleaser.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 723a5ddb..63a70762 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -38,9 +38,9 @@ dockers: - goos: linux goarch: amd64 image_templates: - - "philipssoftware/{{ .ProjectName }}:{{ .Tag }}" + - "philipssoftware/{{ .ProjectName }}:{{ .Version }}" - "philipssoftware/{{ .ProjectName }}:{{ .FullCommit }}" - - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .Tag }}" + - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .Version }}" - "ghcr.io/philips-labs/{{ .ProjectName }}:{{ .FullCommit }}" build_flag_templates: - "--pull" From a620c5b4ce26966d46618642ac6971e6353ba9b4 Mon Sep 17 00:00:00 2001 From: Marco Franssen Date: Fri, 5 Nov 2021 09:39:51 +0100 Subject: [PATCH 5/5] Bump actions/checkout from v2.3.5 to v2.4.0 --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e3056633..039ba40e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,7 +17,7 @@ jobs: go-version: 1.17 - name: Checkout - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: Cache Go modules uses: actions/cache@v2.1.6 @@ -72,7 +72,7 @@ jobs: go-version: 1.17 - name: Checkout - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 with: fetch-depth: 0