Skip to content

Commit

Permalink
refactor: rename x86_64 to amd64 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn authored Mar 23, 2023
1 parent b30fcaf commit e7894a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions oci/private/toolchains_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with only the toolchain attribute pointing into the platform-specific repositori
# Add more platforms as needed to mirror all the binaries
# published by the upstream project.
PLATFORMS = {
"darwin_x86_64": struct(
"darwin_amd64": struct(
compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
Expand Down Expand Up @@ -56,7 +56,7 @@ PLATFORMS = {
"@platforms//cpu:s390x",
],
),
"linux_x86_64": struct(
"linux_amd64": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
Expand All @@ -68,7 +68,7 @@ PLATFORMS = {
"@platforms//cpu:arm64",
],
),
"windows_x86_64": struct(
"windows_amd64": struct(
compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
Expand Down
11 changes: 6 additions & 5 deletions oci/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ registry_toolchain(
"""

def _crane_repo_impl(repository_ctx):
platform = repository_ctx.attr.platform.replace("amd64", "x86_64")
url = "https://github.com/google/go-containerregistry/releases/download/{version}/go-containerregistry_{platform}.tar.gz".format(
version = repository_ctx.attr.crane_version,
platform = repository_ctx.attr.platform[:1].upper() + repository_ctx.attr.platform[1:],
platform = platform[:1].upper() + platform[1:],
)
repository_ctx.download_and_extract(
url = url,
integrity = CRANE_VERSIONS[repository_ctx.attr.crane_version][repository_ctx.attr.platform],
integrity = CRANE_VERSIONS[repository_ctx.attr.crane_version][platform],
)
binary = "crane.exe" if repository_ctx.attr.platform.startswith("windows_") else "crane"
binary = "crane.exe" if platform.startswith("windows_") else "crane"
repository_ctx.template(
"launcher.sh",
repository_ctx.attr._launcher_tpl,
Expand Down Expand Up @@ -67,7 +68,7 @@ registry_toolchain(
"""

def _zot_repo_impl(repository_ctx):
platform = repository_ctx.attr.platform.replace("x86_64", "amd64").replace("_", "-")
platform = repository_ctx.attr.platform.replace("_", "-")
url = "https://github.com/project-zot/zot/releases/download/{version}/zot-{platform}".format(
version = repository_ctx.attr.zot_version,
platform = platform,
Expand Down Expand Up @@ -101,7 +102,7 @@ structure_test_toolchain(
"""

def _stucture_test_repo_impl(repository_ctx):
platform = repository_ctx.attr.platform.replace("x86_64", "amd64").replace("_", "-")
platform = repository_ctx.attr.platform.replace("_", "-")

# There is no arm64 version of structure test binary.
# TODO: fix this upstream asking distroless people
Expand Down
4 changes: 0 additions & 4 deletions oci/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ diff_test(
file1 = "java17",
# This one is declared with an oci_pull rule in /WORKSPACE
file2 = "@distroless_java",
# TODO: https://github.com/bazel-contrib/rules_oci/issues/108
tags = ["manual"],
)

diff_test(
name = "test_static",
file1 = "static",
file2 = "@distroless_static",
# TODO: https://github.com/bazel-contrib/rules_oci/issues/108
tags = ["manual"],
)

0 comments on commit e7894a2

Please sign in to comment.