Add config to build impacted frontends

This commit is contained in:
Mustafa Gezen 2022-10-30 09:44:59 +01:00
parent 5d5970f797
commit dc18624323
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1
3 changed files with 60 additions and 0 deletions

View File

@ -50,6 +50,24 @@ presubmits:
command:
- hack/non_manual_build.sh
- name: pull-peridot-build-impacted-frontend
branches:
- main
always_run: true
decorate: true
spec:
tolerations:
- key: peridot.rockylinux.org/workflow-tolerates-arch
operator: Equal
value: amd64
effect: NoSchedule
nodeSelector:
peridot.rockylinux.org/workflow-tolerates-arch: amd64
containers:
- image: quay.io/peridot/ci:v0.3.16
command:
- hack/frontend_build.sh
- name: pull-peridot-gofmt-check
branches:
- main

16
hack/build_impacted_frontend.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -o errexit
source hack/bazel_setup.sh
starting_query="attr(tags, 'resf_frontend_bundle',"
for t in `cat impacted_targets`; do
starting_query="$starting_query $t union"
done
starting_query=${starting_query%" union"}
starting_query="$starting_query)"
$BAZEL_B $($BAZEL_QR "$starting_query")

26
hack/frontend_build.sh Normal file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -o errexit
source hack/bazel_setup.sh
bazel_bin="$(which bazel)"
workspace_dir="$(pwd)"
$BAZEL_B //:bazel-diff
# Generate starting hashes
git checkout "$PULL_BASE_SHA" --quiet
bazel-bin/bazel-diff generate-hashes -w "$workspace_dir" -b "$bazel_bin" starting_hashes_json
# Generate ending hashes
git checkout "$PULL_PULL_SHA" --quiet
bazel-bin/bazel-diff generate-hashes -w "$workspace_dir" -b "$bazel_bin" ending_hashes_json
# Get impacted targets
bazel-bin/bazel-diff get-impacted-targets -sh starting_hashes_json -fh ending_hashes_json impacted_targets
# Build impacted targets
hack/build_impacted_frontend.sh