mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-21 04:41:22 +00:00
Postsubmit: Deploy impacted targets
This commit is contained in:
parent
b9ad1adc4c
commit
8a1cabe994
@ -14,7 +14,7 @@ postsubmits:
|
||||
nodeSelector:
|
||||
peridot.rockylinux.org/workflow-tolerates-arch: amd64
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/unit_tests.sh
|
||||
|
||||
@ -32,6 +32,25 @@ postsubmits:
|
||||
nodeSelector:
|
||||
peridot.rockylinux.org/workflow-tolerates-arch: amd64
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/build_all_frontends.sh
|
||||
|
||||
- name: post-peridot-deploy-impacted
|
||||
always_run: true
|
||||
decorate: true
|
||||
branches:
|
||||
- main
|
||||
spec:
|
||||
serviceAccountName: peridot-deploy
|
||||
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.17
|
||||
command:
|
||||
- hack/deploy_impacted.sh
|
||||
|
@ -28,7 +28,7 @@ presubmits:
|
||||
nodeSelector:
|
||||
peridot.rockylinux.org/workflow-tolerates-arch: amd64
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/unit_tests.sh
|
||||
|
||||
@ -46,7 +46,7 @@ presubmits:
|
||||
nodeSelector:
|
||||
peridot.rockylinux.org/workflow-tolerates-arch: amd64
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/non_manual_build.sh
|
||||
|
||||
@ -64,7 +64,7 @@ presubmits:
|
||||
nodeSelector:
|
||||
peridot.rockylinux.org/workflow-tolerates-arch: amd64
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/frontend_build.sh
|
||||
|
||||
@ -75,6 +75,6 @@ presubmits:
|
||||
decorate: true
|
||||
spec:
|
||||
containers:
|
||||
- image: quay.io/peridot/ci:v0.3.16
|
||||
- image: quay.io/peridot/ci:v0.3.17
|
||||
command:
|
||||
- hack/gofmt_check.sh
|
||||
|
@ -16,3 +16,10 @@ BAZEL_B="bazel $SOPTIONS build $FLAGS --remote_default_exec_properties=$REMOTE_D
|
||||
BAZEL_R="bazel $SOPTIONS run $FLAGS --remote_default_exec_properties=$REMOTE_DEF"
|
||||
BAZEL_T="bazel $SOPTIONS test $FLAGS --remote_default_exec_properties=$REMOTE_DEF --test_arg=-test.v --flaky_test_attempts=3 --build_tests_only --test_output=errors"
|
||||
BAZEL_QR="bazel $SOPTIONS query $QUERY_FLAGS --keep_going --noshow_progress"
|
||||
|
||||
return_if_impacted_targets_empty() {
|
||||
if [[ -z "$(cat impacted_targets)" ]]; then
|
||||
echo "No impacted targets found"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
33
hack/deploy_impacted.sh
Executable file
33
hack/deploy_impacted.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
|
||||
source .envrc.prod.resf
|
||||
source hack/bazel_setup.sh
|
||||
|
||||
hack/get_impacted_targets.sh
|
||||
|
||||
return_if_impacted_targets_empty
|
||||
|
||||
aws eks --region us-east-2 update-kubeconfig --name peridot-T8WbrA
|
||||
|
||||
AWS_JWT="$(aws ecr get-login-password --region us-east-2)"
|
||||
B64_AWS_AUTH="$(echo -n "AWS:$AWS_JWT")"
|
||||
mkdir -p ~/.docker
|
||||
echo '{"auths":{"893168113496.dkr.ecr.us-east-2.amazonaws.com":{"auth":"'"$B64_AWS_AUTH"'"}}}' > ~/.docker/config.json
|
||||
|
||||
starting_query="attr(tags, 'push_apply',"
|
||||
|
||||
for t in `cat impacted_targets`; do
|
||||
starting_query="$starting_query $t union"
|
||||
done
|
||||
|
||||
starting_query=${starting_query%" union"}
|
||||
starting_query="$starting_query)"
|
||||
|
||||
TARGETS=$($BAZEL_QR "$starting_query")
|
||||
for target in $TARGETS; do
|
||||
$BAZEL_R "$target"
|
||||
done
|
||||
|
||||
|
@ -4,23 +4,9 @@ set -o errexit
|
||||
|
||||
source hack/bazel_setup.sh
|
||||
|
||||
bazel_bin="$(which bazel)"
|
||||
workspace_dir="$(pwd)"
|
||||
hack/get_impacted_targets.sh
|
||||
|
||||
$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 -o impacted_targets
|
||||
return_if_impacted_targets_empty
|
||||
|
||||
# Build impacted targets
|
||||
hack/build_impacted_frontend.sh
|
||||
|
||||
|
||||
|
23
hack/get_impacted_targets.sh
Executable file
23
hack/get_impacted_targets.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/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 -o impacted_targets
|
||||
|
||||
|
@ -37,6 +37,7 @@ def tag_default_update(defaults, append):
|
||||
return tdict
|
||||
|
||||
def gen_from_jsonnet(name, src, outs, tags, force_normal_tags, helm_mode, **kwargs):
|
||||
def_tag = "peridot_k8s"
|
||||
ext_str_nested = "{STABLE_OCI_REGISTRY_NO_NESTED_SUPPORT_IN_2022_SHAME_ON_YOU_AWS}"
|
||||
if force_normal_tags:
|
||||
ext_str_nested = "false"
|
||||
@ -56,13 +57,14 @@ def gen_from_jsonnet(name, src, outs, tags, force_normal_tags, helm_mode, **kwar
|
||||
}
|
||||
if helm_mode:
|
||||
ext_strs["helm_mode"] = "true"
|
||||
def_tag = "peridot_helm"
|
||||
jsonnet_to_json(
|
||||
name = name,
|
||||
src = src,
|
||||
outs = outs,
|
||||
tags = tags + [
|
||||
"manual",
|
||||
"peridot_k8s",
|
||||
def_tag,
|
||||
],
|
||||
ext_strs = select({
|
||||
"//platforms:arm64": dict(ext_strs, arch = "arm64"),
|
||||
@ -123,7 +125,7 @@ def peridot_k8s(name, src, tags = [], outs = [], static = False, prod_only = Fal
|
||||
":%s.push" % name,
|
||||
":%s.apply" % name,
|
||||
],
|
||||
tags = ["manual"],
|
||||
tags = ["manual", "push_apply"],
|
||||
)
|
||||
|
||||
def resf_frontend(name, tags = [], **kwargs):
|
||||
|
Loading…
Reference in New Issue
Block a user