buildkite: don't load images if they are not touched (v2)

v2: modify pipeline.yaml to skip load-all-images tests.
PiperOrigin-RevId: 603773497
This commit is contained in:
Andrei Vagin
2024-02-02 13:33:33 -08:00
committed by gVisor bot
parent b09abbed21
commit 4c987258a3
3 changed files with 43 additions and 2 deletions
+14
View File
@@ -125,3 +125,17 @@ if test "${BUILDKITE_AGENT_META_DATA_QUEUE}" = "release"; then
fi
sudo sysctl -w kernel.print-fatal-signals=1
pipeline_add_env() {
sed -i "/^env:/a\ $1: '$2'" .buildkite/pipeline.yaml
}
# Try to skip unaffected tests on pre-submits.
# BUILDKITE_PIPELINE_ID is set only on the pipeline upload step.
if [[ -n "${BUILDKITE_PIPELINE_ID}" && "${BUILDKITE_BRANCH}" =~ ^test/ ]]; then
# Skip load-all-images tests if the change doesn't affect images.
if ./tools/builkite-check-paths.sh images/ tools/images.mk Makefile; then
echo "Skip load-all-images tests"
pipeline_add_env SKIP_LOADING_IMAGES 1
fi
fi
+2 -2
View File
@@ -213,14 +213,14 @@ steps:
# Images tests.
- <<: *common
<<: *source_test
label: ":docker: Images (x86_64)"
if: build.env("SKIP_LOADING_IMAGES") == null && build.env("STAGED_BINARIES") == null
command: make ARCH=x86_64 load-all-images
agents:
arch: "amd64"
- <<: *common
<<: *source_test
label: ":docker: Images (aarch64)"
if: build.env("SKIP_LOADING_IMAGES") == null && build.env("STAGED_BINARIES") == null
command: make ARCH=aarch64 load-all-images
agents:
arch: "arm64"
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Copyright 2019 The gVisor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Check if any changes are in specified paths. The script exits with 0 if no
# changes were detected.
set -xeo pipefail
exec 1>&2
git fetch origin master
baseid=$(git merge-base origin/master "origin/${BUILDKITE_BRANCH}")
git diff --stat "${baseid}" --exit-code "$@"