diff --git a/build/includes/linux.mk b/build/includes/linux.mk index 3c523b8da2..f020bcd054 100644 --- a/build/includes/linux.mk +++ b/build/includes/linux.mk @@ -25,6 +25,7 @@ # Get the sha for a file sha = $(shell sha256sum $(1) | head -c 10) +sha_bash = $(shell sha256sum $(1) | cut -d' ' -f1 | sha256sum | head -c 10 ) # Minikube executable MINIKUBE ?= minikube diff --git a/build/includes/macos.mk b/build/includes/macos.mk index 00e2a15011..148fac723d 100644 --- a/build/includes/macos.mk +++ b/build/includes/macos.mk @@ -25,6 +25,8 @@ # Get the sha for a file sha = $(shell shasum -a 256 $(1) | head -c 10) +# Get the sha of all files specified by wildcard +sha_bash = $(shell shasum -a 256 $(1) | cut -d' ' -f1 | shasum -a 256 | head -c 10 ) # Minikube executable MINIKUBE ?= minikube diff --git a/build/includes/sdk.mk b/build/includes/sdk.mk index a68347b978..84c3be992d 100644 --- a/build/includes/sdk.mk +++ b/build/includes/sdk.mk @@ -22,12 +22,14 @@ build_sdk_base_version = $(call sha,$(build_path)/build-sdk-images/tool/base/Dockerfile) build_sdk_base_tag = agones-build-sdk-base:$(build_sdk_base_version) +build_sdk_version = $(call sha_bash,$(build_path)/build-sdk-images/*/*.sh) build_sdk_base_remote_tag = $(REGISTRY)/$(build_sdk_base_tag) build_sdk_prefix = agones-build-sdk- grpc_release_tag = v1.16.1 sdk_build_folder = build-sdk-images/ SDK_FOLDER ?= go COMMAND ?= gen +SDK_IMAGE_TAG=$(build_sdk_prefix)$(SDK_FOLDER):$(build_sdk_version) .PHONY: test-sdks test-sdk build-sdks build-sdk gen-all-sdk-grpc gen-sdk-grpc run-all-sdk-command run-sdk-command @@ -77,7 +79,7 @@ run-sdk-command: cd - ; \ $(MAKE) ensure-build-sdk-image SDK_FOLDER=$(SDK_FOLDER) ; \ docker run --rm $(common_mounts) -e "VERSION=$(VERSION)" \ - $(DOCKER_RUN_ARGS) $(build_sdk_prefix)$(SDK_FOLDER):$(build_version) $(COMMAND) ; \ + $(DOCKER_RUN_ARGS) $(SDK_IMAGE_TAG) $(COMMAND) ; \ else \ echo "Command $(COMMAND) not found - nothing to execute" ; \ fi @@ -90,7 +92,7 @@ build-build-sdk-image-base: # Builds the docker image used by commands for a specific sdk build-build-sdk-image: DOCKER_BUILD_ARGS= --build-arg BASE_IMAGE=$(build_sdk_base_tag) build-build-sdk-image: ensure-build-sdk-image-base - docker build --tag=$(build_sdk_prefix)$(SDK_FOLDER):$(build_version) $(build_path)build-sdk-images/$(SDK_FOLDER) $(DOCKER_BUILD_ARGS) + docker build --tag=$(SDK_IMAGE_TAG) $(build_path)build-sdk-images/$(SDK_FOLDER) $(DOCKER_BUILD_ARGS) # attempt to pull the image, if it exists and rename it to the local tag # exit's clean if it doesn't exist, so can be used on CI @@ -107,7 +109,7 @@ ensure-build-sdk-image-base: # create the build image sdk if it doesn't exist ensure-build-sdk-image: - $(MAKE) build-build-sdk-image SDK_FOLDER=$(SDK_FOLDER) + $(MAKE) ensure-image IMAGE_TAG=$(SDK_IMAGE_TAG) BUILD_TARGET=build-build-sdk-image SDK_FOLDER=$(SDK_FOLDER) # Run SDK conformance Sidecar server in docker in order to run # SDK client test against it. Useful for test development diff --git a/build/includes/windows.mk b/build/includes/windows.mk index 88571206aa..91e63d4732 100644 --- a/build/includes/windows.mk +++ b/build/includes/windows.mk @@ -25,6 +25,7 @@ # Get the sha for a file sha = $(shell sha256sum $(1) | head -c 10) +sha_bash = $(shell sha256sum $(1) | cut -d' ' -f1 | sha256sum | head -c 10 ) # Minikube executable MINIKUBE ?= minikube.exe