Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): directory specific test change pruning #669

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab977b0
chore(CI): directory specific test change pruning
apeabody May 17, 2024
c18ccc3
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
7d94e9c
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
d87e100
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
a4c757f
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
7ea008c
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
00ef701
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
afcdddb
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
d11d663
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
b074620
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
166baf2
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
e92d736
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
8416530
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
ea62ebe
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
f8c05ec
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
a1c8edd
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
71c4f4f
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
4edbf45
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
585bd27
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
e7407d2
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
539e508
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
0b8d353
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
dbab5e6
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
b0e5112
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
d569e8f
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
5f99004
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
2ce63d5
Update int.cloudbuild.yaml
apeabody Oct 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed .github/.keep
Empty file.
28 changes: 17 additions & 11 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,33 @@ steps:
fi

git fetch --unshallow
git diff origin/${_BASE_BRANCH} --name-only > _changed_files
sed 's/\/.*/\//' _changed_files > _changed_folders
git diff origin/main --name-only > _changed_files
sed 's:[^/]*$::' _changed_files > _changed_folders
apeabody marked this conversation as resolved.
Show resolved Hide resolved
sort -u -o _changed_folders{,}
echo Folders with changes:
cat _changed_folders

# Do not prune if changing tests themselves
_INFRA_FOLDERS="build test .github"
for d in _changed_folders; do
if [[ "${_INFRA_FOLDERS}" =~ "$d" ]]; then
echo "Infrastructure folders have changed; no tests will be pruned."
while read d; do
if [[ "build test .github" =~ "${d%/}" ]]; then
echo "Infrastructure folder ${d%/} has changed; no tests will be pruned."
exit 0 # do not prune
fi
done
done < _changed_folders

for d in */; do
if ! grep -q "^$d" _changed_folders && [[ "$d" != "test/" ]]; then
rm -rf $d;
# Remove leaf folders without changes or non-tf resources
for d in `find . -type d -name 'test' -prune -o -links 2 -printf '%P\n'`; do
if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -type f -print -quit)" ]; then
rm -rf $d
fi
done

# Remove any empty folders
find . -empty -type d -delete

# Report remaining folders
echo Folders in scope for tests:
for d in */; do echo $d; done
find . -type d -printf '%P\n'

- id: prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
Expand Down
Empty file removed composer/.keep
Empty file.
Empty file removed compute/.keep
Empty file.
Empty file removed dns/.keep
Empty file.
Empty file removed eventarc/.keep
Empty file.
Empty file removed functions/.keep
Empty file.
2 changes: 1 addition & 1 deletion gke/standard/regional/labels/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# [START gke_standard_regional_labels_cluster]
resource "google_container_cluster" "default" {
name = "gke-standard-regional-labels"
location = "us-west1"
location = "us-central1"
initial_node_count = 2

resource_labels = {
Expand Down
Empty file removed lb/.keep
Empty file.
Empty file removed run/.keep
Empty file.
Empty file removed storage/.keep
Empty file.
Empty file removed vpc/.keep
Empty file.