Skip to content

Commit

Permalink
Add ensure SDK image
Browse files Browse the repository at this point in the history
Use git version instead of build image version.
Does not rebuild SDK images if image was found.
  • Loading branch information
aLekSer committed Jul 15, 2019
1 parent a6b604e commit 8914a45
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions build/build-sdk-images/node/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
# limitations under the License.

set -ex

cd ./sdks/nodejs
npm install-test
1 change: 1 addition & 0 deletions build/includes/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions build/includes/macos.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions build/includes/windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sdks/cpp/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# limitations under the License.

cd ..

mkdir -p .build
cd .build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -Wno-dev -DCMAKE_INSTALL_PREFIX=./install
Expand Down

0 comments on commit 8914a45

Please sign in to comment.