Skip to content

Commit a19df88

Browse files
committed
chore(Makefile): Use immutable tags
1 parent 44f6cfe commit a19df88

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,18 @@
33
# - Docker image name
44
# - Kubernetes service, rc, pod, secret, volume names
55
SHORT_NAME := postgres
6-
7-
VERSION ?= git-$(shell git rev-parse --short HEAD)
8-
9-
# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY.
106
DEIS_REGISTY ?= ${DEV_REGISTRY}/
117
IMAGE_PREFIX ?= deis
128

13-
# Canonical docker image name
14-
IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${VERSION}
9+
include versioning.mk
1510

1611
all: docker-build docker-push
1712

1813
# For cases where we're building from local
1914
# We also alter the RC file to set the image name.
2015
docker-build:
2116
docker build --rm -t ${IMAGE} rootfs
22-
23-
# Push to a registry that Kubernetes can access.
24-
docker-push:
25-
docker push ${IMAGE}
17+
docker tag -f ${IMAGE} ${MUTABLE_IMAGE}
2618

2719
test:
2820
contrib/ci/test.sh ${IMAGE}

_scripts/deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
cd "$(dirname "$0")" || exit 1
77

8-
export IMAGE_PREFIX=deisci VERSION=v2-beta
8+
export IMAGE_PREFIX=deisci
99
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
1010
DEIS_REGISTRY='' make -C .. docker-build docker-push
1111
docker login -e="$QUAY_EMAIL" -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io

versioning.mk

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MUTABLE_VERSION ?= canary
2+
VERSION ?= git-$(shell git rev-parse --short HEAD)
3+
4+
IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${VERSION}
5+
MUTABLE_IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${MUTABLE_VERSION}
6+
7+
info:
8+
@echo "Build tag: ${VERSION}"
9+
@echo "Registry: ${DEIS_REGISTRY}"
10+
@echo "Immutable tag: ${IMAGE}"
11+
@echo "Mutable tag: ${MUTABLE_IMAGE}"
12+
13+
.PHONY: docker-push
14+
docker-push: docker-immutable-push docker-mutable-push
15+
16+
.PHONY: docker-immutable-push
17+
docker-immutable-push:
18+
docker push ${IMAGE}
19+
20+
.PHONY: docker-mutable-push
21+
docker-mutable-push:
22+
docker push ${MUTABLE_IMAGE}

0 commit comments

Comments
 (0)