From 54b207fe56880ab33ce8923ed61d772680758660 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sat, 25 Jun 2022 12:47:22 -0700 Subject: [PATCH] e2e: rebuild container less often --- Makefile | 4 ++-- test_e2e.sh | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index bdaba39..fb6839f 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,10 @@ BIN := git-sync REGISTRY ?= gcr.io/k8s-staging-git-sync # This version-strategy uses git tags to set the version string -VERSION := $(shell git describe --tags --always --dirty) +VERSION ?= $(shell git describe --tags --always --dirty) # # This version-strategy uses a manual value to set the version string -#VERSION := 1.2.3 +#VERSION ?= 1.2.3 ### ### These variables should not need tweaking. diff --git a/test_e2e.sh b/test_e2e.sh index 82ea186..a233694 100755 --- a/test_e2e.sh +++ b/test_e2e.sh @@ -98,6 +98,10 @@ function docker_kill() { docker kill "$1" >/dev/null } +# E2E_TAG is the tag used for docker builds. This is needed because docker +# tags are system-global, but one might have multiple repos checked out. +E2E_TAG=$(git rev-parse --show-toplevel | sed 's|/|_|g') + # DIR is the directory in which all this test's state lives. RUNID="${RANDOM}${RANDOM}" DIR="/tmp/git-sync-e2e.$RUNID" @@ -175,7 +179,7 @@ function GIT_SYNC() { -v "$RUNLOG":/var/log/runs \ -v "$DOT_SSH/id_test":"/etc/git-secret/ssh":ro \ --env XDG_CONFIG_HOME=$DIR \ - e2e/git-sync:$(make -s version)__$(go env GOOS)_$(go env GOARCH) \ + e2e/git-sync:"${E2E_TAG}"__$(go env GOOS)_$(go env GOARCH) \ --add-user \ --v=6 \ "$@" @@ -2046,7 +2050,7 @@ if [[ "$#" == 0 ]]; then fi # Build it -make container REGISTRY=e2e VERSION=$(make -s version) +make container REGISTRY=e2e VERSION="${E2E_TAG}" make test-tools REGISTRY=e2e function finish() {