From 742bb830b7eda6c4fb67a1bee9f41509584e9251 Mon Sep 17 00:00:00 2001 From: rogerthatdev Date: Fri, 6 Oct 2023 22:14:38 -0700 Subject: [PATCH] fix: add directory prune to int build config --- build/int.cloudbuild.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index a2d941c48..1ceecb7ba 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -14,6 +14,20 @@ timeout: 14400s steps: +- id: prune unchanged directories + name: gcr.io/cloud-builders/git + entrypoint: bash + args: + - -c + - | + git fetch --unshallow + git diff origin/${_BASE_BRANCH}..origin/${_HEAD_BRANCH} --name-only > _changed_files + sed 's/\/.*/\//' _changed_files > _changed_folders + for d in */; do + if ! grep -q ^$d _changed_folders; then + rm -rf $d; + fi + done - id: prepare name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS' args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && prepare_environment']