Skip to content

Commit

Permalink
deps: update rules_oci digest to v2.0.0-beta1 (#3135)
Browse files Browse the repository at this point in the history
Co-authored-by: Markus Rudy <[email protected]>
  • Loading branch information
renovate[bot] and burgerdev authored Aug 7, 2024
1 parent e41bb61 commit 59df2b7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 10 deletions.
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
module(name = "constellation")

bazel_dep(name = "aspect_bazel_lib", version = "2.7.8")

bazel_lib = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib.yq()
use_repo(bazel_lib, "yq_toolchains")

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0")
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,9 @@ load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")

rules_oci_dependencies()

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

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

load("//bazel/toolchains:container_images.bzl", "containter_image_deps")

Expand Down
75 changes: 75 additions & 0 deletions bazel/toolchains/0001-disable-Windows-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
From d10473f4ac89c23dcd8ea02488b28a649f4a9735 Mon Sep 17 00:00:00 2001
From: Markus Rudy <[email protected]>
Date: Tue, 6 Aug 2024 11:33:29 +0200
Subject: [PATCH] disable Windows support

It's broken and we don't need it, see
https://github.com/bazel-contrib/rules_oci/issues/420.
---
oci/private/image.bzl | 9 ---------
oci/private/util.bzl | 29 +----------------------------
2 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/oci/private/image.bzl b/oci/private/image.bzl
index e8a6ca5..434947c 100644
--- a/oci/private/image.bzl
+++ b/oci/private/image.bzl
@@ -226,15 +226,6 @@ def _oci_image_impl(ctx):

action_env = {}

- # Windows: Don't convert arguments like --entrypoint=/some/bin to --entrypoint=C:/msys64/some/bin
- if ctx.target_platform_has_constraint(ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]):
- # See https://www.msys2.org/wiki/Porting/:
- # > Setting MSYS2_ARG_CONV_EXCL=* prevents any path transformation.
- action_env["MSYS2_ARG_CONV_EXCL"] = "*"
-
- # This one is for Windows Git MSys
- action_env["MSYS_NO_PATHCONV"] = "1"
-
ctx.actions.run(
inputs = depset(inputs, transitive = transitive_inputs),
arguments = [args],
diff --git a/oci/private/util.bzl b/oci/private/util.bzl
index 7c2a2c2..479ca7d 100644
--- a/oci/private/util.bzl
+++ b/oci/private/util.bzl
@@ -141,34 +141,7 @@ def _maybe_wrap_launcher_for_windows(ctx, bash_launcher):
- make sure the bash_launcher is in the inputs to the action
- @bazel_tools//tools/sh:toolchain_type should appear in the rules toolchains
"""
- if not ctx.target_platform_has_constraint(ctx.attr._windows_constraint[platform_common.ConstraintValueInfo]):
- return bash_launcher
-
- win_launcher = ctx.actions.declare_file("wrap_%s.bat" % ctx.label.name)
- ctx.actions.write(
- output = win_launcher,
- content = r"""@echo off
-SETLOCAL ENABLEEXTENSIONS
-SETLOCAL ENABLEDELAYEDEXPANSION
-for %%a in ("{bash_bin}") do set "bash_bin_dir=%%~dpa"
-set PATH=%bash_bin_dir%;%PATH%
-set "parent_dir=%~dp0"
-set "parent_dir=!parent_dir:\=/!"
-set args=%*
-rem Escape \ and * in args before passing it with double quote
-if defined args (
- set args=!args:\=\\\\!
- set args=!args:"=\"!
-)
-"{bash_bin}" -c "%parent_dir%{launcher} !args!"
-""".format(
- bash_bin = ctx.toolchains["@bazel_tools//tools/sh:toolchain_type"].path,
- launcher = paths.relativize(bash_launcher.path, win_launcher.dirname),
- ),
- is_executable = True,
- )
-
- return win_launcher
+ return bash_launcher

def _file_exists(rctx, path):
result = rctx.execute(["stat", path])
--
2.46.0

10 changes: 6 additions & 4 deletions bazel/toolchains/oci_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ def oci_deps():
# Remove this override once https://github.com/bazel-contrib/rules_oci/issues/420 is fixed.
http_archive(
name = "rules_oci",
strip_prefix = "rules_oci-c622bf79d269473d3d9bc33510e16cfd9a1142bc",
strip_prefix = "rules_oci-2.0.0-beta1",
type = "tar.gz",
urls = [
"https://cdn.confidential.cloud/constellation/cas/sha256/dca0cfa2a8eb4ab79c231617964fc821f6d1a3bb9d996358975a5ceee5b8d25f",
"https://github.com/bazel-contrib/rules_oci/archive/c622bf79d269473d3d9bc33510e16cfd9a1142bc.tar.gz",
"https://cdn.confidential.cloud/constellation/cas/sha256/f70f07f9d0d6c275d7ec7d3c7f236d9b552ba3205e8f37df9c1125031cf967cc",
"https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0-beta1/rules_oci-v2.0.0-beta1.tar.gz",
],
sha256 = "dca0cfa2a8eb4ab79c231617964fc821f6d1a3bb9d996358975a5ceee5b8d25f",
sha256 = "f70f07f9d0d6c275d7ec7d3c7f236d9b552ba3205e8f37df9c1125031cf967cc",
patches = ["//bazel/toolchains:0001-disable-Windows-support.patch"],
patch_args = ["-p1"],
)

0 comments on commit 59df2b7

Please sign in to comment.