Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 80a1b55

Browse files
smukherj1rbe-toolchains-pr-bot
authored andcommitted
Remove python resolver (#459)
1 parent 673d896 commit 80a1b55

File tree

5 files changed

+17
-476
lines changed

5 files changed

+17
-476
lines changed

k8s/BUILD

-38
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,6 @@ exports_files([
2929
"describe.sh.tpl",
3030
])
3131

32-
py_library(
33-
name = "resolver_lib",
34-
srcs = [
35-
"__init__.py",
36-
"resolver.py",
37-
"//:__init__.py",
38-
],
39-
deps = [
40-
"@com_github_yaml_pyyaml//:yaml",
41-
"@containerregistry",
42-
],
43-
)
44-
45-
py_test(
46-
name = "resolver_test",
47-
srcs = ["resolver_test.py"],
48-
data = [
49-
"//examples/hellogrpc/cc/server:server.tar",
50-
],
51-
python_version = "PY2",
52-
deps = [
53-
":resolver_lib",
54-
"@mock",
55-
],
56-
)
57-
58-
par_binary(
59-
name = "resolver",
60-
srcs = ["resolver.py"],
61-
main = "resolver.py",
62-
python_version = "PY2",
63-
visibility = ["//visibility:public"],
64-
deps = [
65-
"@com_github_yaml_pyyaml//:yaml",
66-
"@containerregistry",
67-
],
68-
)
69-
7032
par_binary(
7133
name = "stamper",
7234
srcs = ["stamper.py"],

k8s/k8s.bzl

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ py_library(
6767
if "io_bazel_rules_docker" not in excludes:
6868
http_archive(
6969
name = "io_bazel_rules_docker",
70-
sha256 = "5fcad5748a03d961c457ae15348684aa6eceb8f1cd6ae5fd7271fb5a271acdaf",
71-
strip_prefix = "rules_docker-7476c25fcf188dbfc4eb154ad309eda7df24652c",
72-
urls = ["https://github.com/bazelbuild/rules_docker/archive/7476c25fcf188dbfc4eb154ad309eda7df24652c.tar.gz"],
70+
sha256 = "14ac30773fdb393ddec90e158c9ec7ebb3f8a4fd533ec2abbfd8789ad81a284b",
71+
strip_prefix = "rules_docker-0.12.1",
72+
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.12.1/rules_docker-v0.12.1.tar.gz"],
7373
)
7474
if "bazel_skylib" not in excludes:
7575
http_archive(

k8s/object.bzl

+14-33
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,17 @@ def _impl(ctx):
7676
image_spec["digest"] = ",".join([_runfiles(ctx, f) for f in blobsums])
7777
all_inputs += blobsums
7878

79-
if not ctx.attr.use_legacy_resolver:
80-
# Add additional files about the image used by the Go resolver
81-
# to load the image more efficiently.
82-
diff_ids = image.get("diff_id", [])
83-
image_spec["diff_id"] = ",".join([_runfiles(ctx, f) for f in diff_ids])
84-
all_inputs += diff_ids
85-
86-
blobs = image.get("zipped_layer", [])
87-
image_spec["compressed_layer"] = ",".join([_runfiles(ctx, f) for f in blobs])
88-
all_inputs += blobs
89-
90-
uncompressed_blobs = image.get("unzipped_layer", [])
91-
image_spec["uncompressed_layer"] = ",".join([_runfiles(ctx, f) for f in uncompressed_blobs])
92-
all_inputs += uncompressed_blobs
93-
else:
94-
blobs = image.get("zipped_layer", [])
95-
image_spec["layer"] = ",".join([_runfiles(ctx, f) for f in blobs])
96-
all_inputs += blobs
79+
diff_ids = image.get("diff_id", [])
80+
image_spec["diff_id"] = ",".join([_runfiles(ctx, f) for f in diff_ids])
81+
all_inputs += diff_ids
82+
83+
blobs = image.get("zipped_layer", [])
84+
image_spec["compressed_layer"] = ",".join([_runfiles(ctx, f) for f in blobs])
85+
all_inputs += blobs
86+
87+
uncompressed_blobs = image.get("unzipped_layer", [])
88+
image_spec["uncompressed_layer"] = ",".join([_runfiles(ctx, f) for f in uncompressed_blobs])
89+
all_inputs += uncompressed_blobs
9790

9891
image_spec["config"] = _runfiles(ctx, image["config"])
9992
all_inputs += [image["config"]]
@@ -136,7 +129,7 @@ def _impl(ctx):
136129
for spec in image_specs
137130
]),
138131
"%{resolver_args}": " ".join(ctx.attr.resolver_args or []),
139-
"%{resolver}": _runfiles(ctx, ctx.executable.resolver if ctx.attr.use_legacy_resolver else ctx.executable.go_resolver),
132+
"%{resolver}": _runfiles(ctx, ctx.executable.resolver),
140133
"%{stamp_args}": stamp_args,
141134
"%{yaml}": _runfiles(ctx, ctx.outputs.substituted),
142135
},
@@ -148,7 +141,6 @@ def _impl(ctx):
148141
runfiles = ctx.runfiles(
149142
files = [
150143
ctx.executable.resolver,
151-
ctx.executable.go_resolver,
152144
ctx.outputs.substituted,
153145
] + all_inputs,
154146
transitive_files = ctx.attr.resolver[DefaultInfo].default_runfiles.files,
@@ -172,7 +164,7 @@ def _resolve(ctx, string, output):
172164
)
173165

174166
def _common_impl(ctx):
175-
files = [ctx.executable.resolver, ctx.executable.go_resolver]
167+
files = [ctx.executable.resolver]
176168

177169
cluster_arg = ctx.attr.cluster
178170
cluster_arg = ctx.expand_make_variables("cluster", cluster_arg, {})
@@ -272,12 +264,6 @@ _common_attrs = {
272264
# don't expose the extra actions.
273265
"cluster": attr.string(),
274266
"context": attr.string(),
275-
"go_resolver": attr.label(
276-
default = Label("//k8s/go/cmd/resolver"),
277-
cfg = "host",
278-
executable = True,
279-
allow_files = True,
280-
),
281267
"image_chroot": attr.string(),
282268
# This is only needed for describe.
283269
"kind": attr.string(),
@@ -286,18 +272,13 @@ _common_attrs = {
286272
),
287273
"namespace": attr.string(),
288274
"resolver": attr.label(
289-
default = Label("//k8s:resolver"),
275+
default = Label("//k8s/go/cmd/resolver"),
290276
cfg = "host",
291277
executable = True,
292278
allow_files = True,
293279
),
294280
# Extra arguments to pass to the resolver.
295281
"resolver_args": attr.string_list(),
296-
"use_legacy_resolver": attr.bool(
297-
default = False,
298-
doc = "Use the legacy python resolver if True. Use the experimental" +
299-
" Go resolver if false.",
300-
),
301282
"user": attr.string(),
302283
"_stamper": attr.label(
303284
default = Label("//k8s:stamper"),

k8s/resolver.py

-242
This file was deleted.

0 commit comments

Comments
 (0)