Skip to content

Commit

Permalink
envoy.mk: Clean up variables a touch
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeShu committed Feb 19, 2020
1 parent 519290c commit 5b28532
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ARG base="frolvlad/alpine-glibc:alpine-3.10"
ARG artifacts="builder"

# This controls where we copy envoy from.
ARG envoy="quay.io/datawire/ambassador-base:envoy-7.d17d947caef13f1bdd235c3fccff77814883bb46.opt"
ARG envoy="i-forgot-to-set-build-arg-envoy"

########################################
# The builder image
Expand Down
8 changes: 4 additions & 4 deletions builder/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bootstrap() {

if [ -z "$(builder)" ] ; then
printf "${CYN}==> ${GRN}Bootstrapping build image${END}\n"
${DBUILD} --target builder ${DIR} -t builder
${DBUILD} --build-arg envoy="${ENVOY_DOCKER_TAG}" --target builder ${DIR} -t builder
if [ "$(uname -s)" == Darwin ]; then
DOCKER_GID=$(stat -f "%g" /var/run/docker.sock)
else
Expand Down Expand Up @@ -356,11 +356,11 @@ case "${cmd}" in
docker rmi -f "${name}" &> /dev/null
docker commit -c 'ENTRYPOINT [ "/bin/bash" ]' $(builder) "${name}"
printf "${CYN}==> ${GRN}Building ${BLU}${BUILDER_NAME}${END}\n"
${DBUILD} ${DIR} --build-arg artifacts=${name} --target ambassador -t ${BUILDER_NAME}
${DBUILD} ${DIR} --build-arg artifacts=${name} --build-arg envoy="${ENVOY_DOCKER_TAG}" --target ambassador -t ${BUILDER_NAME}
printf "${CYN}==> ${GRN}Building ${BLU}kat-client${END}\n"
${DBUILD} ${DIR} --build-arg artifacts=${name} --target kat-client -t kat-client
${DBUILD} ${DIR} --build-arg artifacts=${name} --build-arg envoy="${ENVOY_DOCKER_TAG}" --target kat-client -t kat-client
printf "${CYN}==> ${GRN}Building ${BLU}kat-server${END}\n"
${DBUILD} ${DIR} --build-arg artifacts=${name} --target kat-server -t kat-server
${DBUILD} ${DIR} --build-arg artifacts=${name} --build-arg envoy="${ENVOY_DOCKER_TAG}" --target kat-server -t kat-server
fi
dexec rm -f /buildroot/image.dirty
;;
Expand Down
20 changes: 13 additions & 7 deletions cxx/envoy.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ srcdir := $(OSS_HOME)/cxx
include $(OSS_HOME)/build-aux/prelude.mk

YES_I_AM_OK_WITH_COMPILING_ENVOY ?=
YES_I_AM_UPDATING_THE_BASE_IMAGES ?=

_git_remote_urls := $(shell git remote | xargs -n1 git remote get-url --all)
IS_PRIVATE ?= $(findstring private,$(_git_remote_urls))

# IF YOU MESS WITH ANY OF THESE VALUES, YOU MUST RUN `make update-base`.
_git_remote_urls := $(shell git remote | xargs -n1 git remote get-url --all)
IS_PRIVATE ?= $(findstring private,$(_git_remote_urls))
ENVOY_REPO ?= $(if $(IS_PRIVATE),git@github.com:datawire/envoy-private.git,git://github.com/datawire/envoy.git)
ENVOY_COMMIT ?= d17d947caef13f1bdd235c3fccff77814883bb46
ENVOY_COMPILATION_MODE ?= opt
# Increment BASE_ENVOY_RELVER on changes to `docker/base-envoy/Dockerfile`, or Envoy recipes
BASE_ENVOY_RELVER ?= 7
ENVOY_DOCKER_TAG ?= $(if $(IS_PRIVATE),quay.io/datawire/ambassador-base-private:envoy-$(BASE_ENVOY_RELVER).$(ENVOY_COMMIT).$(ENVOY_COMPILATION_MODE),quay.io/datawire/ambassador-base:envoy-$(BASE_ENVOY_RELVER).$(ENVOY_COMMIT).$(ENVOY_COMPILATION_MODE))

BASE_VERSION.envoy ?= $(BASE_ENVOY_RELVER).$(ENVOY_COMMIT).$(ENVOY_COMPILATION_MODE)
ENVOY_DOCKER_REPO ?= quay.io/datawire/ambassador-base$(if $(IS_PRIVATE),-private)
ENVOY_DOCKER_VERSION ?= $(BASE_ENVOY_RELVER).$(ENVOY_COMMIT).$(ENVOY_COMPILATION_MODE)
ENVOY_DOCKER_TAG ?= $(ENVOY_DOCKER_REPO):envoy-$(ENVOY_DOCKER_VERSION)
# END LIST OF VARIABLES REQUIRING `make update-base`.

# for builder.sh...
export ENVOY_DOCKER_TAG

#
# Envoy build

Expand Down Expand Up @@ -100,12 +106,12 @@ ENVOY_BASH.deps = $(srcdir)/envoy-build-container.txt
$(OSS_HOME)/bin_linux_amd64/envoy-static: $(ENVOY_BASH.deps) FORCE
mkdir -p $(@D)
@PS4=; set -ex; { \
if docker run --rm --entrypoint=true $(BASE_IMAGE.envoy); then \
rsync -Pav --blocking-io -e 'docker run --rm -i' $$(docker image inspect $(BASE_IMAGE.envoy) --format='{{.Id}}' | sed 's/^sha256://'):/usr/local/bin/envoy $@; \
if docker run --rm --entrypoint=true $(ENVOY_DOCKER_TAG); then \
rsync -Pav --blocking-io -e 'docker run --rm -i' $$(docker image inspect $(ENVOY_DOCKER_TAG) --format='{{.Id}}' | sed 's/^sha256://'):/usr/local/bin/envoy $@; \
else \
if [ -z '$(YES_I_AM_UPDATING_THE_BASE_IMAGES)' ]; then \
{ set +x; } &>/dev/null; \
echo 'error: failed to pull $(BASE_IMAGE.envoy), but $$YES_I_AM_UPDATING_THE_BASE_IMAGES is not set'; \
echo 'error: failed to pull $(ENVOY_DOCKER_TAG), but $$YES_I_AM_UPDATING_THE_BASE_IMAGES is not set'; \
echo ' If you are trying to update the base images, then set that variable to a non-empty value.'; \
echo ' If you are not trying to update the base images, then check your network connection and Docker credentials.'; \
exit 1; \
Expand Down

0 comments on commit 5b28532

Please sign in to comment.