Skip to content

Commit d836c1f

Browse files
committed
Re-tag images instead of re-building
Signed-off-by: Jose Fuentes <[email protected]>
1 parent 701a677 commit d836c1f

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

.github/workflows/release-master.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ jobs:
5151
registry: quay.io
5252
username: ${{ secrets.QUAY_USER }}
5353
password: ${{ secrets.QUAY_PASSWORD }}
54-
- name: Build images
55-
run: make push-docker-image-canary
54+
- name: Build and push
55+
run: make push-docker-image
56+
- name: Tag
57+
run: make create-docker-image-tag NEW_TAG=canary

.github/workflows/release-tag.yml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,7 @@ on:
77
- v*
88

99
jobs:
10-
golint:
11-
name: vet fmt and lint
12-
runs-on: ubuntu-20.04
13-
container: golang:1.13.7
14-
steps:
15-
- uses: actions/[email protected]
16-
- name: Install golint
17-
run: go get -u golang.org/x/lint/golint
18-
- run: make lint
19-
shell: bash
20-
gotest:
21-
name: go test
22-
runs-on: ubuntu-20.04
23-
container: golang:1.13.7
24-
steps:
25-
- uses: actions/[email protected]
26-
- run: make test
27-
docker_build:
10+
docker_tag:
2811
name: docker_build
2912
runs-on: ubuntu-20.04
3013
container:
@@ -41,6 +24,8 @@ jobs:
4124
- name: Install Tools
4225
run: apk add --update make git jq rsync curl
4326
- uses: actions/[email protected]
27+
- name: Capture tag in env
28+
run: echo "TAG_LABEL=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
4429
- name: Set up QEMU
4530
uses: docker/setup-qemu-action@v1
4631
- name: Set up Docker Buildx
@@ -51,5 +36,7 @@ jobs:
5136
registry: quay.io
5237
username: ${{ secrets.QUAY_USER }}
5338
password: ${{ secrets.QUAY_PASSWORD }}
54-
- name: Build images
55-
run: make push-docker-image
39+
- name: Tag latest
40+
run: make create-docker-image-tag NEW_TAG=latest
41+
- name: Tag with git tag
42+
run: make create-docker-image-tag NEW_TAG=${{ env.TAG_LEVEL }}

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GOARCH:=$(shell go env GOARCH)
1010
BIN_NAME:=preflight
1111

1212
DOCKER_IMAGE?=quay.io/jetstack/preflight
13-
DOCKER_IMAGE_TAG?=$(DOCKER_IMAGE):$(VERSION)
13+
DOCKER_IMAGE_TAG?=$(DOCKER_IMAGE):$(COMMIT)
1414

1515
# BUILD_IN decides if the binaries will be built in `docker` or in the `host`.
1616
BUILD_IN?=docker
@@ -90,7 +90,7 @@ build-all-platforms-in-docker:
9090
PLATFORMS?=linux/arm/v7,linux/arm64/v8,linux/amd64
9191
BUILDX_EXTRA_ARGS?=
9292

93-
push_buildx_args=--tag $(DOCKER_IMAGE):latest --push $(BUILDX_EXTRA_ARGS)
93+
push_buildx_args=--push $(BUILDX_EXTRA_ARGS)
9494
push-canary_buildx_args=--tag $(DOCKER_IMAGE):canary --push $(BUILDX_EXTRA_ARGS)
9595
build_buildx_args=$(BUILDX_EXTRA_ARGS)
9696

@@ -103,7 +103,10 @@ _docker-%: build-all-platforms
103103

104104
build-docker-image: _docker-build
105105
push-docker-image: _docker-push
106-
push-docker-image-canary: _docker-push-canary
106+
107+
NEW_TAG?=latest
108+
create-docker-image-tag:
109+
docker buildx imagetools create $(DOCKER_IMAGE):$(COMMIT) --tag $(DOCKER_IMAGE):$(NEW_TAG)
107110

108111
# CI
109112

0 commit comments

Comments
 (0)