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

Configure path to graalvm #397

Open
ayashjorden opened this issue May 30, 2024 · 2 comments
Open

Configure path to graalvm #397

ayashjorden opened this issue May 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ayashjorden
Copy link

(I'll preface with that probably I'm doing something wrong. although I did read through the docs.)

Our Bazel builds are going through a proxy to fetch artifacts and I am hitting a 404 when rules_graalvm tries to download the CE 17.0.8:

ERROR: Analysis of target '<NATIVE_IMAGE_BAZEL_TARGET_NAME>' failed; build aborted: java.io.IOException: Error downloading [https://<INTERNAL_PROXY>/mirror-bazel-build/github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.8/graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz] to /tmp/path/to/graalvm/temp15971974762323443278/graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz: GET returned 404 Not Found

It seems that graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz does not exist on mirror-bazel-build:
https://mirror.bazel.build/github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.8/graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz

Configuration

WORKSPACE.bazel:

http_archive(
    name = "rules_graalvm",
    sha256 = "3ef2f1583a4849d03209a43b0b507f172299c3045e585b6ffa7144a2bc12ae18",
    strip_prefix = "rules_graalvm-0.11.2",
    urls = [
        "https://github.com/sgammon/rules_graalvm/releases/download/v0.11.2/rules_graalvm-0.11.2.zip",
    ],
)
load("@rules_graalvm//graalvm:repositories.bzl", "graalvm_repository")
graalvm_repository(
    name = "graalvm",
    distribution = "ce",  # `oracle`, `ce`, or `community`
    java_version = "17",  # `17`, `20`, `21`, or `22` as supported by the version provided
    version = "17.0.8",  # gvm sdk version format like `24.x.x` also supported
)
load("@rules_graalvm//graalvm:workspace.bzl", "register_graalvm_toolchains", "rules_graalvm_repositories")
rules_graalvm_repositories()

register_graalvm_toolchains()

BUILD.bazel:

load(
    "@rules_graalvm//graalvm:defs.bzl",
    "native_image",
)

native_image(
    deps = [
        ":db-config-bin"
    ],
    name = "db-config-bin-native",
    main_class = "package.name.ConfigAgent",
    visibility = ["//some/visibilty/publish:__pkg__"],
    native_image_tool = "@graalvm//:native-image",
)
  1. Reading through the docs i was not able to find a way to set the path to the graalvm folder/home.
  2. What else am I doing wrong?

Thanks!

@sgammon
Copy link
Owner

sgammon commented Jun 9, 2024

@ayashjorden I'm not sure at first glance why this is failing, but I will look into it. I don't see anything wrong with what you are doing, except native_image_tool doesn't need to be provided when you are using the new-style entrypoint (you are). It should be resolving GraalVM from Bazel Toolchains.

As for the download URL, it is valid, and so is the version tag. Bazel's mirror should be pulling from here:
https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.8/graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz

I get a 404 like you do. Bazel's mirror domain isn't used directly by rules_graalvm to my knowledge or as far as I can tell. Is that happening through a proxy or perhaps some configuration on your end?

rules_graalvm maps its own download URLs, directly to GitHub; for example, for the version you've specified (17.0.8):

"ce_17.0.8_macos-x64_23.0.1": {
# GraalVM CE 17.0.8 (Java 17), macOS (amd64), Version 23.0.1
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-17.0.8/graalvm-community-jdk-17.0.8_macos-x64_bin.tar.gz",
"sha256": "cf4bb646018da8bf93f67e5cdae0f583b276d278d0b667d779a68d11d3b6873d",
"compatible_with": [
"@platforms//cpu:x86_64",
"@platforms//os:macos",
"@rules_graalvm//platform/jvm:java17",
],
},

I know Bazel's mirror maps a lot of GitHub repositories, but I am not sure if GraalVM's releases are available via their mirror.

@sgammon
Copy link
Owner

sgammon commented Jun 9, 2024

Also, thanks for reporting, and sorry for the delay. Tag me at @sgammon to get a faster response :) tags show up in my mentions which aren't polluted by Dependabot.

@sgammon sgammon added the bug Something isn't working label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants