Skip to content

Commit

Permalink
chore: remove contrib_ prefix from ruleset name (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored Mar 8, 2023
1 parent b506732 commit 6cd583d
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WORKSPACE snippet:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "contrib_rules_oci",
name = "rules_oci",
sha256 = "${SHA}",
strip_prefix = "${PREFIX}",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/${TAG}/${ARCHIVE}",
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ artifact or a version fetched from the internet, run this from this
directory:

```sh
OVERRIDE="--override_repository=contrib_rules_oci=$(pwd)/rules_oci"
OVERRIDE="--override_repository=rules_oci=$(pwd)/rules_oci"
echo "build $OVERRIDE" >> ~/.bazelrc
echo "query $OVERRIDE" >> ~/.bazelrc
```

This means that any usage of `@contrib_rules_oci` on your system will point to this folder.
This means that any usage of `@rules_oci` on your system will point to this folder.

## Releasing

Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"bazel-contrib/rules_oci"

module(
name = "contrib_rules_oci",
name = "rules_oci",
compatibility_level = 1,
version = "0.0.0",
)
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Declare the local Bazel workspace.
# This is *not* included in the published distribution.
workspace(name = "contrib_rules_oci")
workspace(name = "rules_oci")

load(":internal_deps.bzl", "rules_oci_internal_deps")

Expand Down Expand Up @@ -67,7 +67,7 @@ nodejs_register_toolchains(
node_version = DEFAULT_NODE_VERSION,
)

load("@contrib_rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:pull.bzl", "oci_pull")

# A single-arch base image
oci_pull(
Expand Down
4 changes: 2 additions & 2 deletions cosign/private/attest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ _attrs = {
}

def _cosign_attest_impl(ctx):
cosign = ctx.toolchains["@contrib_rules_oci//cosign:toolchain_type"]
cosign = ctx.toolchains["@rules_oci//cosign:toolchain_type"]
yq = ctx.toolchains["@aspect_bazel_lib//lib:yq_toolchain_type"]

if ctx.attr.repository.find(":") != -1 or ctx.attr.repository.find("@") != -1:
Expand Down Expand Up @@ -86,7 +86,7 @@ cosign_attest = rule(
doc = _DOC,
executable = True,
toolchains = [
"@contrib_rules_oci//cosign:toolchain_type",
"@rules_oci//cosign:toolchain_type",
"@aspect_bazel_lib//lib:yq_toolchain_type",
],
)
4 changes: 2 additions & 2 deletions cosign/private/sign.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _attrs = {
}

def _cosign_sign_impl(ctx):
cosign = ctx.toolchains["@contrib_rules_oci//cosign:toolchain_type"]
cosign = ctx.toolchains["@rules_oci//cosign:toolchain_type"]
yq = ctx.toolchains["@aspect_bazel_lib//lib:yq_toolchain_type"]

if ctx.attr.repository.find(":") != -1 or ctx.attr.repository.find("@") != -1:
Expand Down Expand Up @@ -74,7 +74,7 @@ cosign_sign = rule(
doc = _DOC,
executable = True,
toolchains = [
"@contrib_rules_oci//cosign:toolchain_type",
"@rules_oci//cosign:toolchain_type",
"@aspect_bazel_lib//lib:yq_toolchain_type",
],
)
4 changes: 2 additions & 2 deletions cosign/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load("//oci/private:toolchains_repo.bzl", "PLATFORMS", "toolchains_repo")

COSIGN_BUILD_TMPL = """\
# Generated by container/repositories.bzl
load("@contrib_rules_oci//cosign:toolchain.bzl", "cosign_toolchain")
load("@rules_oci//cosign:toolchain.bzl", "cosign_toolchain")
cosign_toolchain(
name = "cosign_toolchain",
cosign = "cosign"
Expand Down Expand Up @@ -61,7 +61,7 @@ def cosign_register_toolchains(name):

toolchains_repo(
name = toolchain_name,
toolchain_type = "@contrib_rules_oci//cosign:toolchain_type",
toolchain_type = "@rules_oci//cosign:toolchain_type",
# avoiding use of .format since {platform} is formatted by toolchains_repo for each platform.
toolchain = "@%s_{platform}//:cosign_toolchain" % name,
)
4 changes: 2 additions & 2 deletions docs/go.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ container_import(
Now that we know it's `gcr.io/distroless/base` we can pull the same base image by adding to WORKSPACE:

```
load("@contrib_rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:pull.bzl", "oci_pull")
oci_pull(
name = "distroless_base",
Expand Down Expand Up @@ -74,7 +74,7 @@ pkg_tar(
Finally, add your layer to the base image:

```
load("@contrib_rules_oci//oci:defs.bzl", "oci_image")
load("@rules_oci//oci:defs.bzl", "oci_image")
oci_image(
name = "image",
Expand Down
2 changes: 1 addition & 1 deletion docs/pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A repository rule to pull image layers using Bazel's downloader.
Typical usage in `WORKSPACE.bazel`:

```starlark
load("@contrib_rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:pull.bzl", "oci_pull")

# A single-arch base image
oci_pull(
Expand Down
8 changes: 4 additions & 4 deletions e2e/custom_registry/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ workspace(name = "custom_registry_example")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "contrib_rules_oci",
name = "rules_oci",
path = "../../",
)

load("@contrib_rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")

# Fetch our "runtime" dependencies which users need as well
rules_oci_dependencies()

load("@contrib_rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")

# A registry that accepts both Docker and OCI media types.
register_toolchains("//registry:registry_toolchain")
Expand Down Expand Up @@ -72,7 +72,7 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

load("@contrib_rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:pull.bzl", "oci_pull")

oci_pull(
name = "distroless_base",
Expand Down
2 changes: 1 addition & 1 deletion e2e/custom_registry/app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@contrib_rules_oci//oci:defs.bzl", "oci_image", "oci_tarball", "structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball", "structure_test")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

go_library(
Expand Down
4 changes: 2 additions & 2 deletions e2e/custom_registry/registry/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@contrib_rules_oci//oci:toolchain.bzl", "registry_toolchain")
load("@rules_oci//oci:toolchain.bzl", "registry_toolchain")
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")

copy_file(
Expand All @@ -17,7 +17,7 @@ registry_toolchain(
toolchain(
name = "registry_toolchain",
toolchain = ":toolchain",
toolchain_type = "@contrib_rules_oci//oci:registry_toolchain_type",
toolchain_type = "@rules_oci//oci:registry_toolchain_type",
)

go_library(
Expand Down
2 changes: 1 addition & 1 deletion e2e/smoke/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@contrib_rules_oci//oci:defs.bzl", "oci_image", "structure_test")
load("@rules_oci//oci:defs.bzl", "oci_image", "structure_test")

oci_image(
name = "image",
Expand Down
4 changes: 2 additions & 2 deletions e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"Bazel dependencies"
bazel_dep(name = "contrib_rules_oci", dev_dependency = True, version = "0.0.0")
bazel_dep(name = "rules_oci", dev_dependency = True, version = "0.0.0")
bazel_dep(name = "platforms", version = "0.0.5")

local_path_override(
module_name = "contrib_rules_oci",
module_name = "rules_oci",
path = "../..",
)
6 changes: 3 additions & 3 deletions e2e/smoke/WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
workspace(name = "workspace")

local_repository(
name = "contrib_rules_oci",
name = "rules_oci",
path = "../../",
)

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

load("@contrib_rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")

rules_oci_dependencies()

load("@contrib_rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")

oci_register_toolchains(
name = "oci",
Expand Down
2 changes: 1 addition & 1 deletion e2e/wasm/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@contrib_rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

Expand Down
6 changes: 3 additions & 3 deletions e2e/wasm/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ workspace(name = "custom_registry_example")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

local_repository(
name = "contrib_rules_oci",
name = "rules_oci",
path = "../../",
)

load("@contrib_rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")

# Fetch our "runtime" dependencies which users need as well
rules_oci_dependencies()

load("@contrib_rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "LATEST_ZOT_VERSION", "oci_register_toolchains")

oci_register_toolchains(
name = "oci",
Expand Down
2 changes: 1 addition & 1 deletion examples/sign_external/BUILD.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@contrib_rules_oci//oci:defs.bzl", "oci_image")
load("@rules_oci//oci:defs.bzl", "oci_image")

oci_image(
name = "empty_image",
Expand Down
8 changes: 4 additions & 4 deletions oci/private/image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def _oci_image_impl(ctx):
if not ctx.attr.os or not ctx.attr.architecture:
fail("os and architecture is mandatory when base in unspecified.")

crane = ctx.toolchains["@contrib_rules_oci//oci:crane_toolchain_type"]
registry = ctx.toolchains["@contrib_rules_oci//oci:registry_toolchain_type"]
crane = ctx.toolchains["@rules_oci//oci:crane_toolchain_type"]
registry = ctx.toolchains["@rules_oci//oci:registry_toolchain_type"]
jq = ctx.toolchains["@aspect_bazel_lib//lib:jq_toolchain_type"]

launcher = ctx.actions.declare_file("image_%s.sh" % ctx.label.name)
Expand Down Expand Up @@ -171,8 +171,8 @@ oci_image = rule(
attrs = _attrs,
doc = _DOC,
toolchains = [
"@contrib_rules_oci//oci:crane_toolchain_type",
"@contrib_rules_oci//oci:registry_toolchain_type",
"@rules_oci//oci:crane_toolchain_type",
"@rules_oci//oci:registry_toolchain_type",
"@aspect_bazel_lib//lib:jq_toolchain_type",
],
)
4 changes: 2 additions & 2 deletions oci/private/push.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _quote_args(args):
return ["\"{}\"".format(arg) for arg in args]

def _impl(ctx):
crane = ctx.toolchains["@contrib_rules_oci//oci:crane_toolchain_type"]
crane = ctx.toolchains["@rules_oci//oci:crane_toolchain_type"]
jq = ctx.toolchains["@aspect_bazel_lib//lib:yq_toolchain_type"]

if not ctx.file.image.is_directory:
Expand Down Expand Up @@ -107,7 +107,7 @@ oci_push = rule(
doc = _DOC,
executable = True,
toolchains = [
"@contrib_rules_oci//oci:crane_toolchain_type",
"@rules_oci//oci:crane_toolchain_type",
"@aspect_bazel_lib//lib:yq_toolchain_type",
],
)
4 changes: 2 additions & 2 deletions oci/private/structure_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exec "{st_path}" test {fixed_args} --default-image-tag "registry.structure_test.
"""

def _structure_test_impl(ctx):
st_info = ctx.toolchains["@contrib_rules_oci//oci:st_toolchain_type"].st_info
st_info = ctx.toolchains["@rules_oci//oci:st_toolchain_type"].st_info
yq_info = ctx.toolchains["@aspect_bazel_lib//lib:yq_toolchain_type"].yqinfo

fixed_args = [
Expand Down Expand Up @@ -58,7 +58,7 @@ structure_test = rule(
doc = _DOC,
test = True,
toolchains = [
"@contrib_rules_oci//oci:st_toolchain_type",
"@rules_oci//oci:st_toolchain_type",
"@aspect_bazel_lib//lib:yq_toolchain_type",
],
)
2 changes: 1 addition & 1 deletion oci/pull.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Typical usage in `WORKSPACE.bazel`:
```starlark
load("@contrib_rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:pull.bzl", "oci_pull")
# A single-arch base image
oci_pull(
Expand Down
12 changes: 6 additions & 6 deletions oci/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LATEST_ZOT_VERSION = ZOT_VERSIONS.keys()[0]

CRANE_BUILD_TMPL = """\
# Generated by container/repositories.bzl
load("@contrib_rules_oci//oci:toolchain.bzl", "crane_toolchain")
load("@rules_oci//oci:toolchain.bzl", "crane_toolchain")
crane_toolchain(
name = "crane_toolchain",
crane = select({
Expand Down Expand Up @@ -41,7 +41,7 @@ crane_repositories = repository_rule(

ZOT_BUILD_TMPL = """\
# Generated by container/repositories.bzl
load("@contrib_rules_oci//oci:toolchain.bzl", "registry_toolchain")
load("@rules_oci//oci:toolchain.bzl", "registry_toolchain")
registry_toolchain(
name = "zot_toolchain",
registry = "zot",
Expand Down Expand Up @@ -76,7 +76,7 @@ zot_repositories = repository_rule(

STRUCTURE_TEST_BUILD_TMPL = """\
# Generated by container/repositories.bzl
load("@contrib_rules_oci//oci:toolchain.bzl", "structure_test_toolchain")
load("@rules_oci//oci:toolchain.bzl", "structure_test_toolchain")
structure_test_toolchain(
name = "structure_test_toolchain",
structure_test = "structure_test"
Expand Down Expand Up @@ -164,21 +164,21 @@ def oci_register_toolchains(name, crane_version, zot_version, register = True):

toolchains_repo(
name = crane_toolchain_name,
toolchain_type = "@contrib_rules_oci//oci:crane_toolchain_type",
toolchain_type = "@rules_oci//oci:crane_toolchain_type",
# avoiding use of .format since {platform} is formatted by toolchains_repo for each platform.
toolchain = "@%s_crane_{platform}//:crane_toolchain" % name,
)

toolchains_repo(
name = zot_toolchain_name,
toolchain_type = "@contrib_rules_oci//oci:registry_toolchain_type",
toolchain_type = "@rules_oci//oci:registry_toolchain_type",
# avoiding use of .format since {platform} is formatted by toolchains_repo for each platform.
toolchain = "@%s_zot_{platform}//:zot_toolchain" % name,
)

toolchains_repo(
name = st_toolchain_name,
toolchain_type = "@contrib_rules_oci//oci:st_toolchain_type",
toolchain_type = "@rules_oci//oci:st_toolchain_type",
# avoiding use of .format since {platform} is formatted by toolchains_repo for each platform.
toolchain = "@%s_st_{platform}//:structure_test_toolchain" % name,
)

0 comments on commit 6cd583d

Please sign in to comment.