Skip to content

Commit

Permalink
chore(v7): only tag latest Docker images on default branch (#301)
Browse files Browse the repository at this point in the history
When a v7 release happens, one of the docker images published will be
`ld-relay:latest` (this is also true for the individual architecture
images, after the ARM builds PR was just merged.) The same occurs for
v8.

This is confusing, to say the least. You might get a `v7` or `v8`
revision just depending on the order of Relay releases.

Although one shouldn't ever rely on `latest` tag in production, some
may, and it's the default when you run `docker pull`.

This PR modifies the publishing step to only push `latest` and
`latest-{architecture}` images from the default branch (which is
currently `v8`).
  • Loading branch information
cwaldren-ld authored Feb 12, 2024
1 parent 52ade4c commit d024d57
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ runs:
args: release --clean ${{ inputs.dry-run == 'true' && '--skip=publish' || '' }}
env:
GITHUB_TOKEN: ${{ inputs.token }}
NOT_DEFAULT_BRANCH: ${{ github.ref_name != github.event.repository.default_branch }}

- name: Upload Release Artifacts
shell: bash
Expand Down
72 changes: 59 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ dockers:
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-i386"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"
- "launchdarkly/ld-relay:latest-i386"
use: buildx
goos: linux
goarch: '386'
Expand All @@ -77,11 +76,22 @@ dockers:
- "--pull"
- "--platform=linux/386"

# i386 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-i386"
use: buildx
goos: linux
goarch: '386'
dockerfile: Dockerfile.goreleaser
skip_push: "{{ .Env.NOT_DEFAULT_BRANCH }}"
build_flag_templates:
- "--pull"
- "--platform=linux/386"

# AMD64
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:latest-amd64"
use: buildx
goos: linux
goarch: amd64
Expand All @@ -91,11 +101,22 @@ dockers:
- "--pull"
- "--platform=linux/amd64"

# AMD64 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-amd64"
use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: "{{ .Env.NOT_DEFAULT_BRANCH }}"
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"

# ARMv7
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:latest-armv7"
use: buildx
goos: linux
goarch: arm
Expand All @@ -106,11 +127,23 @@ dockers:
- "--pull"
- "--platform=linux/arm/v7"

# ARMv7 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-armv7"
use: buildx
goos: linux
goarch: arm
goarm: 7
dockerfile: Dockerfile.goreleaser
skip_push: "{{ .Env.NOT_DEFAULT_BRANCH }}"
build_flag_templates:
- "--pull"
- "--platform=linux/arm/v7"

# ARM64v8
- image_templates:
- "launchdarkly/ld-relay:{{ .Version }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:latest-arm64v8"
use: buildx
goos: linux
goarch: arm64
Expand All @@ -119,6 +152,19 @@ dockers:
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"

# ARM64v8 - latest tag
- image_templates:
- "launchdarkly/ld-relay:latest-arm64v8"
use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile.goreleaser
skip_push: "{{ .Env.NOT_DEFAULT_BRANCH }}"
build_flag_templates:
- "--pull"
- "--platform=linux/arm64/v8"

docker_manifests:
- name_template: "launchdarkly/ld-relay:{{ .Version}}"
skip_push: false
Expand All @@ -131,15 +177,15 @@ docker_manifests:
- name_template: "launchdarkly/ld-relay:v{{ .Major }}"
skip_push: false
image_templates:
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"
- "launchdarkly/ld-relay:v{{ .Major }}-amd64"
- "launchdarkly/ld-relay:v{{ .Major }}-armv7"
- "launchdarkly/ld-relay:v{{ .Major }}-arm64v8"
- "launchdarkly/ld-relay:v{{ .Major }}-i386"

- name_template: "launchdarkly/ld-relay:latest"
skip_push: false
skip_push: "{{ .Env.NOT_DEFAULT_BRANCH }}"
image_templates:
- "launchdarkly/ld-relay:latest-amd64"
- "launchdarkly/ld-relay:latest-armv7"
- "launchdarkly/ld-relay:latest-arm64v8"
- "launchdarkly/ld-relay:latest-i386"
- "launchdarkly/ld-relay:latest-amd64"
- "launchdarkly/ld-relay:latest-armv7"
- "launchdarkly/ld-relay:latest-arm64v8"
- "launchdarkly/ld-relay:latest-i386"

0 comments on commit d024d57

Please sign in to comment.