Skip to content

Commit

Permalink
test: Fix the Bazel integration test. (#9604)
Browse files Browse the repository at this point in the history
Bazel just released version 8.0.0 which uses a MODULE.bazel file instead
of a WORKSPACE file. See https://bazel.build/external/migration

I also updated to a new version of rules_oci that supports this new
MODULE.bazel.
  • Loading branch information
plumpy authored Dec 10, 2024
1 parent 3dbbdbe commit b199eba
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 37 deletions.
12 changes: 9 additions & 3 deletions integration/testdata/bazel-rules-oci/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
load("@rules_oci//oci:defs.bzl", "oci_tarball")
load("@rules_oci//oci:defs.bzl", "oci_load")

oci_tarball(
name = "hello.tar",
oci_load(
name = "hello",
image = "@hello//:hello",
repo_tags = ["hello:latest"],
)

filegroup(
name = "hello.tar",
srcs = [":hello"],
output_group = "tarball",
)
13 changes: 13 additions & 0 deletions integration/testdata/bazel-rules-oci/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bazel_dep(name = "rules_oci", version = "2.0.1")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")

# Declare external images you need to pull, for example:
oci.pull(
name = "hello",
digest = "sha256:b510f29de2dfd80b88f7cd569db177a514117081bc8825eb64e423bd3db0fe64",
image = "us-docker.pkg.dev/google-samples/containers/gke/hello-app",
)

# For each oci.pull call, repeat the "name" here to expose them as dependencies.
use_repo(oci, "hello")
30 changes: 0 additions & 30 deletions integration/testdata/bazel-rules-oci/WORKSPACE

This file was deleted.

14 changes: 10 additions & 4 deletions integration/testdata/bazel-rules-oci/sub-dir/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
load("@rules_oci//oci:defs.bzl", "oci_tarball")
load("@rules_oci//oci:defs.bzl", "oci_load")

oci_tarball(
name = "hello.tar",
oci_load(
name = "hello",
image = "@hello//:hello",
repo_tags = ["hello-whatever:latest"],
repo_tags = ["hello:latest"],
)

filegroup(
name = "hello.tar",
srcs = [":hello"],
output_group = "tarball",
)

0 comments on commit b199eba

Please sign in to comment.