Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: no registry oci_image #481

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
build --incompatible_strict_action_env
build --nolegacy_external_runfiles
test --test_env=DOCKER_HOST
startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,15 @@ jobs:
bazelversion: ${{ fromJSON(needs.matrix-prep-bazelversion.outputs.bazelversions) }}
folder:
- .
- e2e/custom_registry
- e2e/wasm
- e2e/smoke
- e2e/crane_as_registry
- e2e/pull

bzlmodEnabled: [true, false]
exclude:
# macos is expensive (billed at 10X) so don't test these
- os: macos-latest
folder: e2e/custom_registry
- os: macos-latest
folder: e2e/wasm
- os: macos-latest
folder: e2e/crane_as_registry
- os: macos-latest
folder: e2e/pull
- os: macos-latest
Expand All @@ -85,9 +79,6 @@ jobs:
- bazelversion: 5.3.2
bzlmodEnabled: true
# TODO: fix
- folder: e2e/custom_registry
bzlmodEnabled: true
# TODO: fix
- folder: e2e/wasm
bzlmodEnabled: true
# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ bazel_dep(name = "platforms", version = "0.0.5")

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

register_toolchains("@oci_crane_toolchains//:all", "@oci_crane_registry_toolchains//:all")
register_toolchains("@oci_crane_toolchains//:all")

bazel_dep(name = "rules_pkg", version = "0.7.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.29.0", dev_dependency = True, repo_name = "bazel_gazelle")
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ rules_oci does not contain language-specific rules, but we do have limited docum
There are some generic examples of usage in the [examples](https://github.com/bazel-contrib/rules_oci/tree/main/examples) folder.
Note that these examples rely on the setup code in the `/WORKSPACE` file in the root of this repo.

### Choosing between zot or crane as the local registry

rules_oci supports two different registry implementation for the temporary storage within actions spawned by bazel.

1. By default we recommend using `zot` as it stores blobs on disk, however it doesn't support `Docker`-format images.
2. `crane` is a better alternative as it supports both `OCI` and `Docker` formats which is required to make images with `Docker` media types work. However, it might not support everything that zot does.

## Public API Docs

### Build Base images
Expand Down
5 changes: 2 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ stardoc_repositories()
load("//oci:dependencies.bzl", "rules_oci_dependencies")
rules_oci_dependencies()

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

oci_register_toolchains(
name = "oci",
crane_version = LATEST_CRANE_VERSION,
zot_version = LATEST_ZOT_VERSION,
crane_version = LATEST_CRANE_VERSION
)

load("//cosign:repositories.bzl", "cosign_register_toolchains")
Expand Down
2 changes: 1 addition & 1 deletion docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rules_oci ought to be tested against runtimes such as podman to diversify the co
Just copy-paste this command into the terminal to run the tests

```bash
for dir in "." "e2e/smoke" "e2e/custom_registry" "e2e/crane_as_registry"; do
for dir in "." "e2e/smoke"; do
(cd "$dir" && bazel test //... || (echo "tests failed." && exit 1))
done
echo "ALL TESTS PASSED"
Expand Down
5 changes: 1 addition & 4 deletions docs/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_t

oci_register_toolchains(
name = "oci",
crane_version = LATEST_CRANE_VERSION,
# Uncommenting the zot toolchain will cause it to be used instead of crane for some tasks.
# Note that it does not support docker-format images.
# zot_version = LATEST_ZOT_VERSION,
crane_version = LATEST_CRANE_VERSION
)

# Pull distroless image
Expand Down
3 changes: 0 additions & 3 deletions e2e/convert_docker_tarball/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sh_binary(
name = "convert",
srcs = ["convert.bash"],
data = [
"@oci_crane_registry_toolchains//:current_toolchain",
"@oci_crane_toolchains//:current_toolchain",
],
)
Expand All @@ -20,13 +19,11 @@ run_binary(
"$@",
"$(location :image.tar)",
"$(CRANE_BIN)",
"$(LAUNCHER_WRAPPER)",
],
out_dirs = ["oci"],
tool = ":convert",
toolchains = [
"@oci_crane_toolchains//:current_toolchain",
"@oci_crane_registry_toolchains//:current_toolchain",
],
)

Expand Down
17 changes: 11 additions & 6 deletions e2e/convert_docker_tarball/convert.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@ export HOME="$TMP"
readonly OUTPUT="${1}"
readonly TARBALL="${2}"
readonly CRANE="${RUNFILES}/${3#"external/"}"
readonly REGISTRY_LAUNCHER=${RUNFILES}/${4#"external/"}


# Launch a registry instance at a random port
source "${REGISTRY_LAUNCHER}"
REGISTRY=$(start_registry $TMP $TMP/output.log)
trap "stop_registry ${TMP}" EXIT

output=$(mktemp)
$CRANE registry serve --address=localhost:0 >> $output 2>&1 &
timeout=$((SECONDS+10))
while [ "${SECONDS}" -lt "${timeout}" ]; do
port="$(cat $output | sed -nr 's/.+serving on port ([0-9]+)/\1/p')"
if [ -n "${port}" ]; then
break
fi
done
REGISTRY="localhost:$port"
echo "Registry is running at ${REGISTRY}"
readonly REPOSITORY="${REGISTRY}/local"


REF=$(mktemp)
"${CRANE}" push "${TARBALL}" "${REPOSITORY}" --image-refs="${REF}"

Expand Down
1 change: 0 additions & 1 deletion e2e/crane_as_registry/.bazelrc

This file was deleted.

37 changes: 0 additions & 37 deletions e2e/crane_as_registry/BUILD.bazel

This file was deleted.

15 changes: 0 additions & 15 deletions e2e/crane_as_registry/MODULE.bazel

This file was deleted.

42 changes: 0 additions & 42 deletions e2e/crane_as_registry/WORKSPACE.bazel

This file was deleted.

1 change: 0 additions & 1 deletion e2e/crane_as_registry/WORKSPACE.bzlmod

This file was deleted.

8 changes: 0 additions & 8 deletions e2e/crane_as_registry/test.yaml

This file was deleted.

1 change: 0 additions & 1 deletion e2e/custom_registry/.bazelrc

This file was deleted.

21 changes: 0 additions & 21 deletions e2e/custom_registry/BUILD.bazel

This file was deleted.

12 changes: 0 additions & 12 deletions e2e/custom_registry/README.md

This file was deleted.

84 changes: 0 additions & 84 deletions e2e/custom_registry/WORKSPACE

This file was deleted.

Loading
Loading