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: rename x86_64 to amd64 #114

Merged
merged 1 commit into from
Mar 23, 2023
Merged
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
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"],
thesayyn marked this conversation as resolved.
Show resolved Hide resolved
)

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