diff --git a/package-tooling-image/build-packages.sh b/package-tooling-image/build-packages.sh index 039af63..b281d0f 100755 --- a/package-tooling-image/build-packages.sh +++ b/package-tooling-image/build-packages.sh @@ -12,7 +12,11 @@ docker container stop registry && docker container rm -v registry || true echo "Starting local docker registry..." docker run -d -p 5001:5000 --name registry mirror.gcr.io/library/registry:2 -cd /workspace +cd /workspace/${SRC_PATH} + +if [ ! -z "${SRC_PATH}" ]; then + git config --global --add safe.directory /workspace/${SRC_PATH} +fi # Install needed Carvel binaries for building packages echo "Downloading carvel binaries..." diff --git a/templates/Makefile b/templates/Makefile index 0675297..c1c49f6 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -233,6 +233,7 @@ kbld-image-replace: -e KBLD_CONFIG_FILE_PATH=$(KBLD_CONFIG_FILE_PATH) \ -e DEFAULT_IMAGE=$(DEFAULT_IMAGE) \ -e NEW_IMAGE=$(IMAGE) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -247,6 +248,7 @@ package-bundle-generate: -e OCI_REGISTRY=$(OCI_REGISTRY) \ -e PACKAGE_VERSION=$(PACKAGE_VERSION) \ -e PACKAGE_SUB_VERSION=$(PACKAGE_SUB_VERSION) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -261,6 +263,7 @@ package-bundle-generate-all: -e OCI_REGISTRY=$(OCI_REGISTRY) \ -e PACKAGE_VERSION=$(PACKAGE_VERSION) \ -e PACKAGE_SUB_VERSION=$(PACKAGE_SUB_VERSION) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -277,6 +280,7 @@ package-bundle-push: -e REGISTRY_USERNAME=$(REGISTRY_USERNAME) \ -e REGISTRY_PASSWORD=$(REGISTRY_PASSWORD) \ -e REGISTRY_SERVER=$(REGISTRY_SERVER) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -293,6 +297,7 @@ package-bundle-push-all: -e REGISTRY_USERNAME=$(REGISTRY_USERNAME) \ -e REGISTRY_PASSWORD=$(REGISTRY_PASSWORD) \ -e REGISTRY_SERVER=$(REGISTRY_SERVER) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -307,6 +312,7 @@ repo-bundle-generate: -e REPO_BUNDLE_VERSION=$(REPO_BUNDLE_VERSION) \ -e REPO_BUNDLE_SUB_VERSION=$(REPO_BUNDLE_SUB_VERSION) \ -e PACKAGE_VALUES_FILE=$(PACKAGE_VALUES_FILE) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -323,6 +329,7 @@ repo-bundle-push: -e REGISTRY_USERNAME=$(REGISTRY_USERNAME) \ -e REGISTRY_PASSWORD=$(REGISTRY_PASSWORD) \ -e REGISTRY_SERVER=$(REGISTRY_SERVER) \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION) @@ -332,6 +339,7 @@ repo-bundle-push: package-vendir-sync: @$(DOCKER) run \ -e OPERATIONS=vendir_sync \ + -e SRC_PATH=$(SRC_PATH) \ -v /var/run/docker.sock:/var/run/docker.sock \ -v $(PWD):/workspace \ $(PACKAGING_CONTAINER_IMAGE):$(VERSION)