From ca6f4d61f4f226c7b0a6dc01774903742989138c Mon Sep 17 00:00:00 2001 From: phlax Date: Wed, 16 Oct 2024 19:33:35 +0100 Subject: [PATCH] bazel/repo: Fix version export (for apt archive) (#36644) Signed-off-by: Ryan Northey --- bazel/BUILD | 1 - bazel/generate_release_hash.sh | 10 ---------- bazel/repo.bzl | 24 +++++++++++++++++++++--- tools/code/BUILD | 1 + 4 files changed, 22 insertions(+), 14 deletions(-) delete mode 100755 bazel/generate_release_hash.sh diff --git a/bazel/BUILD b/bazel/BUILD index 011b1c88a334..e46a88f255f2 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -14,7 +14,6 @@ envoy_package() exports_files([ "gen_sh_test_runner.sh", - "generate_release_hash.sh", "sh_test_wrapper.sh", "test_for_benchmark_wrapper.sh", "repository_locations.bzl", diff --git a/bazel/generate_release_hash.sh b/bazel/generate_release_hash.sh deleted file mode 100755 index c65320e0427c..000000000000 --- a/bazel/generate_release_hash.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e -o pipefail - - -git ls-remote --tags https://github.com/envoyproxy/envoy \ - | grep -E 'refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$' \ - | sort -u \ - | sha256sum \ - | cut -d ' ' -f 1 diff --git a/bazel/repo.bzl b/bazel/repo.bzl index 9a113d5883ed..cdc3ee7bd53b 100644 --- a/bazel/repo.bzl +++ b/bazel/repo.bzl @@ -66,9 +66,27 @@ envoy_entry_point( init_data = [":__init__.py"], ) +genrule( + name = "generate_release_hash_bin", + outs = ["generate_release_hash.sh"], + cmd = """ + echo " +#!/usr/bin/env bash + +set -e -o pipefail + +git ls-remote --tags https://github.com/envoyproxy/envoy \\\\ + | grep -E 'refs/tags/v[0-9]+\\\\.[0-9]+\\\\.[0-9]+$$' \\\\ + | sort -u \\\\ + | sha256sum \\\\ + | cut -d ' ' -f 1" > $@ + chmod +x $@ + """ +) + sh_binary( name = "generate_release_hash", - srcs = ["@envoy//bazel:generate_release_hash.sh"], + srcs = [":generate_release_hash_bin"], visibility = ["//visibility:public"], ) @@ -80,11 +98,11 @@ genrule( name = "default_release_hash", outs = ["default_release_hash.txt"], cmd = """ - $(location @envoy_repo//:generate_release_hash) > $@ + $(location :generate_release_hash) > $@ """, stamp = True, tags = ["no-remote-exec"], - tools = ["@envoy_repo//:generate_release_hash"], + tools = [":generate_release_hash"], ) label_flag( diff --git a/tools/code/BUILD b/tools/code/BUILD index 9c5fd6c0e379..cbeae8f3c67b 100644 --- a/tools/code/BUILD +++ b/tools/code/BUILD @@ -61,6 +61,7 @@ genrule( -l warn \ -v warn \ -x mobile/dist/envoy-pom.xml \ + -x bazel/repo.bzl \ --codeowners=$(location //:CODEOWNERS) \ --owners=$(location //:OWNERS.md) \ --extensions_build_config=$(location :extensions_build_config) \