From 9b500afd29933d4c4076651aa223f75f0076788b Mon Sep 17 00:00:00 2001 From: Ryan Northey Date: Wed, 16 Oct 2024 15:37:02 +0100 Subject: [PATCH] bazel/repo: Fix version export (for apt archive) Signed-off-by: Ryan Northey --- bazel/BUILD | 1 - bazel/generate_release_hash.sh | 10 ---------- bazel/repo.bzl | 24 +++++++++++++++++++++--- 3 files changed, 21 insertions(+), 14 deletions(-) delete mode 100755 bazel/generate_release_hash.sh diff --git a/bazel/BUILD b/bazel/BUILD index 011b1c88a3342..e46a88f255f2c 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 c65320e0427ca..0000000000000 --- 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 9a113d5883eda..cdc3ee7bd53b5 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(