Skip to content

Commit 3766659

Browse files
committed
Cleanup containers.bzl
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
1 parent e04dab6 commit 3766659

1 file changed

Lines changed: 29 additions & 20 deletions

File tree

bazel/repo.bzl

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ def _envoy_repo_impl(repository_ctx):
6565
6666
"""
6767

68+
repo = ""
69+
repo_gcr = ""
70+
sha = ""
71+
sha_gcc = ""
72+
sha_mobile = ""
73+
sha_worker = ""
74+
tag = ""
75+
76+
# yq via bazel doesn't work on Windows, but we don't need the real flag_values
77+
# there either. For this and other reasons, ideally we could parse YAML directly.
78+
# https://github.com/bazelbuild/bazel/issues/24766
6879
if repository_ctx.os.name.lower().find("windows") == -1:
6980
json_result = repository_ctx.execute([
7081
repository_ctx.path(repository_ctx.attr.yq),
@@ -75,26 +86,24 @@ def _envoy_repo_impl(repository_ctx):
7586
fail("yq failed: {}".format(json_result.stderr))
7687
repository_ctx.file("ci-config.json", json_result.stdout)
7788
config_data = json.decode(repository_ctx.read("ci-config.json"))
78-
repository_ctx.file("containers.bzl", CONTAINERS.format(
79-
repo = config_data["build-image"]["repo"],
80-
repo_gcr = config_data["build-image"]["repo-gcr"],
81-
sha = config_data["build-image"]["sha"],
82-
sha_gcc = config_data["build-image"]["sha-gcc"],
83-
sha_mobile = config_data["build-image"]["sha-mobile"],
84-
sha_worker = config_data["build-image"]["sha-worker"],
85-
tag = config_data["build-image"]["tag"],
86-
))
87-
else:
88-
# yq via bazel doesn't work on Windows, but we don't need the file either
89-
repository_ctx.file("containers.bzl", CONTAINERS.format(
90-
repo = "",
91-
repo_gcr = "",
92-
sha = "",
93-
sha_gcc = "",
94-
sha_mobile = "",
95-
sha_worker = "",
96-
tag = "",
97-
))
89+
repo = config_data["build-image"]["repo"]
90+
repo_gcr = config_data["build-image"]["repo-gcr"]
91+
sha = config_data["build-image"]["sha"]
92+
sha_gcc = config_data["build-image"]["sha-gcc"]
93+
sha_mobile = config_data["build-image"]["sha-mobile"]
94+
sha_worker = config_data["build-image"]["sha-worker"]
95+
tag = config_data["build-image"]["tag"]
96+
97+
repository_ctx.file("containers.bzl", CONTAINERS.format(
98+
repo = repo,
99+
repo_gcr = repo_gcr,
100+
sha = sha,
101+
sha_gcc = sha_gcc,
102+
sha_mobile = sha_mobile,
103+
sha_worker = sha_worker,
104+
tag = tag,
105+
))
106+
98107
repo_version_path = repository_ctx.path(repository_ctx.attr.envoy_version)
99108
api_version_path = repository_ctx.path(repository_ctx.attr.envoy_api_version)
100109
version = repository_ctx.read(repo_version_path).strip()

0 commit comments

Comments
 (0)