Update common files. (#5244)

This commit is contained in:
Martin Taillefer 2019-10-23 15:55:52 -07:00 committed by GitHub
parent e84d07d7f1
commit 7f42b415c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 18 deletions

View File

@ -50,14 +50,15 @@ else
$(error This system's OS $(LOCAL_OS) isn't supported)
endif
export TARGET_OUT ?= $(shell pwd)/out/$(TARGET_ARCH)_$(TARGET_OS)
export TARGET_OUT ?= $(shell pwd)/out/$(TARGET_OS)_$(TARGET_ARCH)
ifeq ($(BUILD_WITH_CONTAINER),1)
export TARGET_OUT = /work/out/$(TARGET_ARCH)_$(TARGET_OS)
export TARGET_OUT = /work/out/$(TARGET_OS)_$(TARGET_ARCH)
CONTAINER_CLI ?= docker
DOCKER_SOCKET_MOUNT ?= -v /var/run/docker.sock:/var/run/docker.sock
IMG ?= gcr.io/istio-testing/build-tools:2019-10-11T13-37-52
IMG ?= gcr.io/istio-testing/build-tools:2019-10-23T21-12-16
UID = $(shell id -u)
GID = `grep docker /etc/group | cut -f3 -d:`
PWD = $(shell pwd)
$(info Building with the build container: $(IMG).)
@ -67,24 +68,35 @@ $(info Building with the build container: $(IMG).)
# the path of the file.
TIMEZONE=`readlink $(READLINK_FLAGS) /etc/localtime | sed -e 's/^.*zoneinfo\///'`
RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID):docker --rm \
# Determine the docker.push credential bind mounts.
# Docker and GCR are supported credentials. At this time docker.push may
# not work well on Docker-For-Mac. This will be handled in a follow-up PR.
DOCKER_CREDS_MOUNT:=
ifneq (,$(wildcard $(HOME)/.docker))
$(info Using docker credential directory $(HOME)/.docker.)
DOCKER_CREDS_MOUNT+=--mount type=bind,source="$(HOME)/.docker",destination="/config/.docker",readonly
endif
ifneq (,$(wildcard $(HOME)/.config/gcloud))
$(info Using gcr credential directory $(HOME)/.config/gcloud.)
DOCKER_CREDS_MOUNT+=--mount type=bind,source="$(HOME)/.config/gcloud",destination="/config/.config/gcloud",readonly
endif
RUN = $(CONTAINER_CLI) run -t -i --sig-proxy=true -u $(UID):$(GID) --rm \
-e IN_BUILD_CONTAINER="$(BUILD_WITH_CONTAINER)" \
-e TZ="$(TIMEZONE)" \
-e TARGET_ARCH="$(TARGET_ARCH)" \
-e TARGET_OS="$(TARGET_OS)" \
-e TARGET_OUT="$(TARGET_OUT)" \
-e HUB="$(HUB)" \
-e TAG="$(TAG)" \
-v /etc/passwd:/etc/passwd:ro \
$(DOCKER_SOCKET_MOUNT) \
$(CONTAINER_OPTIONS) \
--mount type=bind,source="$(PWD)",destination="/work" \
--mount type=volume,source=go,destination="/go" \
--mount type=volume,source=gocache,destination="/gocache" \
$(DOCKER_CREDS_MOUNT) \
-w /work $(IMG)
else
$(info Building with your local toolchain.)
RUN =
GOBIN ?= $(GOPATH)/bin
endif
MAKE = $(RUN) make --no-print-directory -e -f Makefile.core.mk
@ -95,3 +107,11 @@ default:
@$(MAKE)
.PHONY: default
else
$(info Building with your local toolchain.)
GOBIN ?= $(GOPATH)/bin
include Makefile.core.mk
endif

View File

@ -1 +1 @@
50fbd5fbfa030d322d47102458787e1ccb7c50bc
67d128794b458a726fd9efff85e21854ab091d4a

View File

@ -80,19 +80,28 @@ dump-licenses-csv:
@go mod download
@license-lint --config common/config/license-lint.yml --csv
mirror-licenses:
@go mod download
@license-lint --mirror
TMP := $(shell mktemp -d -u)
UPDATE_BRANCH ?= "master"
update-common:
@git clone -q --depth 1 --single-branch --branch master https://github.com/istio/common-files
@cd common-files ; git rev-parse HEAD >files/common/.commonfiles.sha
@mkdir -p $(TMP)
@git clone -q --depth 1 --single-branch --branch $(UPDATE_BRANCH) https://github.com/istio/common-files $(TMP)/common-files
@cd $(TMP)/common-files ; git rev-parse HEAD >files/common/.commonfiles.sha
@rm -fr common
@cp -rT common-files/files .
@rm -fr common-files
@cp -rT $(TMP)/common-files/files $(shell pwd)
@rm -fr $(TMP)/common-files
update-common-protos:
@git clone -q --depth 1 --single-branch --branch master https://github.com/istio/common-files
@cd common-files ; git rev-parse HEAD > common-protos/.commonfiles.sha
@mkdir -p $(TMP)
@git clone -q --depth 1 --single-branch --branch $(UPDATE_BRANCH) https://github.com/istio/common-files $(TMP)/common-files
@cd $(TMP)/common-files ; git rev-parse HEAD > common-protos/.commonfiles.sha
@rm -fr common-protos
@cp -ar common-files/common-protos common-protos
@rm -fr common-files
@cp -ar $(TMP)/common-files/common-protos $(shell pwd)/common-protos
@rm -fr $(TMP)/common-files
check-clean-repo:
@common/scripts/check_clean_repo.sh