summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/bazel.mk13
-rw-r--r--tools/images.mk14
2 files changed, 14 insertions, 13 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 396785e16..678593acf 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -160,8 +160,8 @@ bazel-image: load-default ## Ensures that the local builder exists.
@$(call header,DOCKER BUILD)
@docker rm -f $(BUILDER_NAME) 2>/dev/null || true
@docker run --user 0:0 --entrypoint "" --name $(BUILDER_NAME) gvisor.dev/images/default \
- sh -c "$(GROUPADD_DOCKER) $(USERADD_DOCKER) if test -e /dev/kvm; then chmod a+rw /dev/kvm; fi"
- @docker commit $(BUILDER_NAME) gvisor.dev/images/builder
+ sh -c "$(GROUPADD_DOCKER) $(USERADD_DOCKER) if test -e /dev/kvm; then chmod a+rw /dev/kvm; fi" >&2
+ @docker commit $(BUILDER_NAME) gvisor.dev/images/builder >&2
.PHONY: bazel-image
ifneq (true,$(shell $(wrapper echo true)))
@@ -175,7 +175,7 @@ bazel-server: bazel-image ## Ensures that the server exists.
--workdir "$(CURDIR)" \
$(DOCKER_RUN_OPTIONS) \
gvisor.dev/images/builder \
- sh -c "set -x; tail -f --pid=\$$($(BAZEL) info server_pid) /dev/null"
+ sh -c "set -x; tail -f --pid=\$$($(BAZEL) info server_pid) /dev/null" >&2
else
bazel-server:
@
@@ -191,6 +191,7 @@ endif
#
# The last line is used to prevent terminal shenanigans.
build_paths = \
+ (set -euo pipefail; \
$(call wrapper,$(BAZEL) build $(BASE_OPTIONS) $(1)) 2>&1 \
| tee /proc/self/fd/2 \
| grep -A1 -E '^Target' \
@@ -199,7 +200,7 @@ build_paths = \
| strings -n 10 \
| awk '{$$1=$$1};1' \
| xargs -n 1 -I {} readlink -f "{}" \
- | xargs -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)'
+ | xargs -n 1 -I {} bash -c 'set -xeuo pipefail; $(2)')
clean = $(call header,CLEAN) && $(call wrapper,$(BAZEL) clean)
build = $(call header,BUILD $(1)) && $(call build_paths,$(1),echo {})
@@ -215,7 +216,7 @@ clean: ## Cleans the bazel cache.
testlogs: ## Returns the most recent set of test logs.
@if test -f .build_events.json; then \
cat .build_events.json | jq -r \
- 'select(.testSummary?.overallStatus? | tostring | test("(FAILED|FLAKY|TIMEOUT)")) | .testSummary.failed | .[] | .uri' | \
- awk -Ffile:// '{print $$2;}'; \
+ 'select(.testSummary?.overallStatus? | tostring | test("(FAILED|FLAKY|TIMEOUT)")) | "\(.id.testSummary.label) \(.testSummary.failed[].uri)"' | \
+ sed -e 's|file://||'; \
fi
.PHONY: testlogs
diff --git a/tools/images.mk b/tools/images.mk
index 46f56bb2c..2003da5bd 100644
--- a/tools/images.mk
+++ b/tools/images.mk
@@ -108,9 +108,9 @@ $(foreach image, $(ALL_IMAGES), $(eval $(call tag_expand_rule,$(image))))
# ensure that caching works as expected, as well as the "latest" tag that is
# used by the tests.
local_tag = \
- docker tag $(call remote_image,$(1)):$(call tag,$(1)) $(call local_image,$(1)):$(call tag,$(1))
+ docker tag $(call remote_image,$(1)):$(call tag,$(1)) $(call local_image,$(1)):$(call tag,$(1)) >&2
latest_tag = \
- docker tag $(call local_image,$(1)):$(call tag,$(1)) $(call local_image,$(1))
+ docker tag $(call local_image,$(1)):$(call tag,$(1)) $(call local_image,$(1)) >&2
tag-%: ## Tag a local image.
@$(call header,TAG $*)
@$(call local_tag,$*) && $(call latest_tag,$*)
@@ -118,7 +118,7 @@ tag-%: ## Tag a local image.
# pull forces the image to be pulled.
pull = \
$(call header,PULL $(1)) && \
- docker pull $(DOCKER_PLATFORM_ARGS) $(call remote_image,$(1)):$(call tag,$(1)) && \
+ docker pull $(DOCKER_PLATFORM_ARGS) $(call remote_image,$(1)):$(call tag,$(1)) >&2 && \
$(call local_tag,$(1)) && \
$(call latest_tag,$(1))
pull-%: register-cross ## Force a repull of the image.
@@ -131,11 +131,11 @@ pull-%: register-cross ## Force a repull of the image.
rebuild = \
$(call header,REBUILD $(1)) && \
(T=$$(mktemp -d) && cp -a $(call path,$(1))/* $$T && \
- $(foreach image,$(shell grep FROM "$(call path,$(1))/$(call dockerfile,$(1))" 2>/dev/null | cut -d' ' -f2),docker pull $(DOCKER_PLATFORM_ARGS) $(image) &&) \
+ $(foreach image,$(shell grep FROM "$(call path,$(1))/$(call dockerfile,$(1))" 2>/dev/null | cut -d' ' -f2),docker pull $(DOCKER_PLATFORM_ARGS) $(image) >&2 &&) \
docker build $(DOCKER_PLATFORM_ARGS) \
-f "$$T/$(call dockerfile,$(1))" \
-t "$(call remote_image,$(1)):$(call tag,$(1))" \
- $$T && \
+ $$T >&2 && \
rm -rf $$T) && \
$(call local_tag,$(1)) && \
$(call latest_tag,$(1))
@@ -152,7 +152,7 @@ load-%: register-cross ## Pull or build an image locally.
# already exists) or building manually. Note that this generic rule will match
# the fully-expanded remote image tag.
push-%: load-% ## Push a given image.
- @docker push $(call remote_image,$*):$(call tag,$*)
+ @docker push $(call remote_image,$*):$(call tag,$*) >&2
# register-cross registers the necessary qemu binaries for cross-compilation.
# This may be used by any target that may execute containers that are not the
@@ -160,7 +160,7 @@ push-%: load-% ## Push a given image.
register-cross:
ifneq ($(ARCH),$(shell uname -m))
ifeq (,$(wildcard /proc/sys/fs/binfmt_misc/qemu-*))
- @docker run --rm --privileged multiarch/qemu-user-static --reset --persistent yes
+ @docker run --rm --privileged multiarch/qemu-user-static --reset --persistent yes >&2
else
@
endif