Skip to content

Commit

Permalink
Use rctx.os.environ for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszwawrzyk committed Jun 17, 2024
1 parent a28a952 commit 5fb2b16
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions oci/private/authn.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

load("@aspect_bazel_lib//lib:base64.bzl", "base64")
load("@aspect_bazel_lib//lib:repo_utils.bzl", "repo_utils")
load("@bazel_skylib//lib:versions.bzl", "versions")
load(":util.bzl", "util")


Expand Down Expand Up @@ -285,12 +284,8 @@ def _get_token(rctx, state, registry, repository):

auth = None
if pattern["login"] == "<token>":
if versions.is_at_least("7.0.0", versions.get() or "0.0.0"):
if not rctx.getenv("OCI_ENABLE_OAUTH2_SUPPORT"):
fail(IDENTITY_TOKEN_WARNING)
else:
if not rctx.os.environ.get("OCI_ENABLE_OAUTH2_SUPPORT"):
fail(IDENTITY_TOKEN_WARNING)
if not rctx.os.environ.get("OCI_ENABLE_OAUTH2_SUPPORT"):
fail(IDENTITY_TOKEN_WARNING)

response = _oauth2(
rctx = rctx,
Expand Down Expand Up @@ -369,5 +364,6 @@ authn = struct(
"REGISTRY_AUTH_FILE",
"XDG_RUNTIME_DIR",
"HOME",
"OCI_ENABLE_OAUTH2_SUPPORT",
]
)

0 comments on commit 5fb2b16

Please sign in to comment.