bazel: update bazel container version on //:tidy

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-07-25 15:00:01 +02:00
parent 1d5a8283e0
commit 0ab76a2f95
4 changed files with 55 additions and 2 deletions

View File

@ -434,6 +434,13 @@ repo_command(
command = ":com_github_katexochen_ghh",
)
sh_template(
name = "bazel_container",
data = [],
substitutions = {},
template = "bazel_container.sh.in",
)
multirun(
name = "tidy",
commands = [
@ -446,6 +453,7 @@ multirun(
":terraform_fmt",
":buf_fmt",
":deps_mirror_fix",
":bazel_container",
],
jobs = 1, # execute sequentially
visibility = ["//visibility:public"],

45
bazel/ci/bazel_container.sh.in Executable file
View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
###### script header ######
lib=$(realpath @@BASE_LIB@@) || exit 1
stat "${lib}" >> /dev/null || exit 1
# shellcheck source=../sh/lib.bash
if ! source "${lib}"; then
echo "Error: could not find import"
exit 1
fi
cd "${BUILD_WORKSPACE_DIRECTORY}"
###### script body ######
bazelVer=$(cat .bazelversion) # has no v prefix
bazelVerContainerfileRegex='(ARG BAZEL_VERSION=)([0-9]+\.[0-9]+\.[0-9]+)'
if [[ ! "$(cat bazel/container/Containerfile)" =~ ${bazelVerContainerfileRegex} ]]; then
echo "Error: no match found in Containerfile"
exit 1
fi
bazelVerContainerfile="${BASH_REMATCH[2]}"
if [[ ${bazelVer} != "${bazelVerContainerfile}" ]]; then
sed -r -i "s/${bazelVerContainerfileRegex}/\\1${bazelVer}/" bazel/container/Containerfile
echo "Containerfile updated, was previously at ${bazelVerContainerfile}"
fi
bazelVerScriptRegex='(containerImage="ghcr.io/edgelesssys/bazel-container:v)([0-9]+\.[0-9]+\.[0-9]+)'
if [[ ! "$(cat bazel/container/container.sh)" =~ ${bazelVerScriptRegex} ]]; then
echo "Error: no match found in container.sh"
exit 1
fi
bazelVerScript="${BASH_REMATCH[2]}"
if [[ ${bazelVer} != "${bazelVerScript}" ]]; then
# bazelVerScriptRegex contains slashes, so use % as delimiter
sed -r -i "s%${bazelVerScriptRegex}%\\1${bazelVer}%" bazel/container/container.sh
echo "container.sh updated, was previously at ${bazelVerScript}"
fi

View File

@ -3,7 +3,7 @@ FROM fedora:38
ARG TARGETOS
ARG TARGETARCH
ARG BAZEL_VERSION=6.1.2
ARG BAZEL_VERSION=6.2.1
ARG BAZELISK_VERSION=v1.16.0
ARG BAZELISK_SHA256=168851e70cf5f95c0e215e7f3aaca5132ffc3c8dd8f585a4157b0be2b53cfe32

View File

@ -15,7 +15,7 @@ function setup {
}
function startBazelServer {
local containerImage="ghcr.io/edgelesssys/bazel-container:v6.1.2-0"
local containerImage="ghcr.io/edgelesssys/bazel-container:v6.2.1-0"
local containerName="bazeld"
setup