From 274f717302c3ecf6004088a26c77a376a491b454 Mon Sep 17 00:00:00 2001 From: "C.J. Collier" Date: Tue, 24 Dec 2024 09:20:05 -0800 Subject: [PATCH 1/2] updated to allow pinning of bazel version * now using environment variables more * using gpg --import instead of gpg --dearmor * must set default bazel using update-alternatives or bazel is not in PATH, only bazel-7.4.0 * Although this could possibly be solved by replacing all calls to bazel in our code with bazel-7.4.0 this does not hold true for others' code which does not know to change the abi --- cloudbuild/Dockerfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/cloudbuild/Dockerfile b/cloudbuild/Dockerfile index 94e6e6cb3..94293e584 100644 --- a/cloudbuild/Dockerfile +++ b/cloudbuild/Dockerfile @@ -9,16 +9,24 @@ COPY --chown=ia-tests:ia-tests . /init-actions # Install Bazel: # https://docs.bazel.build/versions/master/install-ubuntu.html -ENV bazel_kr_path=/usr/share/keyrings/bazel-keyring.gpg +ENV bazel_kr_path=/usr/share/keyrings/bazel-keyring.gpg \ + bazel_version=7.4.0 \ + bazel_repo_data="http://storage.googleapis.com/bazel-apt stable jdk1.8" \ + bazel_repo_file="/etc/apt/sources.list.d/bazel.list" + DEBIAN_FRONTEND=noninteractive RUN apt-get install -y -qq curl >/dev/null 2>&1 && \ apt-get clean -RUN /usr/bin/curl https://bazel.build/bazel-release.pub.gpg | \ - gpg --dearmor -o "${bazel_kr_path}" -RUN echo "deb [arch=amd64 signed-by=${bazel_kr_path}] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \ - dd of=/etc/apt/sources.list.d/bazel.list status=none && \ +RUN /usr/bin/curl -s https://bazel.build/bazel-release.pub.gpg | \ + gpg --import --no-default-keyring --keyring "${bazel_kr_path}" && \ + echo "deb [arch=amd64 signed-by=${bazel_kr_path}] ${bazel_repo_data}" | \ + dd of="${bazel_repo_file}" status=none && \ apt-get update -qq -RUN apt-get autoremove -y -qq && \ - apt-get install -y -qq openjdk-8-jdk python3-setuptools bazel >/dev/null 2>&1 && \ +RUN apt-get autoremove -y -qq > /dev/null 2>&1 && \ + apt-get install -y -qq default-jdk python3-setuptools bazel-${bazel_version} > /dev/null 2>&1 && \ apt-get clean +# Set bazel-${bazel_version} as the default bazel alternative in this container +RUN update-alternatives --install /usr/bin/bazel bazel /usr/bin/bazel-${bazel_version} 1 && \ + update-alternatives --set bazel /usr/bin/bazel-${bazel_version} + USER ia-tests From fc8f7b4365e6848b8733cf99216e213cde7fe110 Mon Sep 17 00:00:00 2001 From: "C.J. Collier" Date: Tue, 24 Dec 2024 09:27:31 -0800 Subject: [PATCH 2/2] always run your tests --- cloudbuild/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudbuild/Dockerfile b/cloudbuild/Dockerfile index 94293e584..aebaffd84 100644 --- a/cloudbuild/Dockerfile +++ b/cloudbuild/Dockerfile @@ -12,7 +12,7 @@ COPY --chown=ia-tests:ia-tests . /init-actions ENV bazel_kr_path=/usr/share/keyrings/bazel-keyring.gpg \ bazel_version=7.4.0 \ bazel_repo_data="http://storage.googleapis.com/bazel-apt stable jdk1.8" \ - bazel_repo_file="/etc/apt/sources.list.d/bazel.list" + bazel_repo_file="/etc/apt/sources.list.d/bazel.list" \ DEBIAN_FRONTEND=noninteractive RUN apt-get install -y -qq curl >/dev/null 2>&1 && \ apt-get clean