Introduction Link to heading
I was experimenting with some Github Actions that needed to make use of Mandrel so, I thought that I should use sdkman. I run into some issues though and I thought I should document the experience
The main issue I encountered, is that no matter how I mixed sdkamn into the mix, my steps acted like it was not
The sdkamn action Link to heading
It seems that there is a Github Action for sdkman available, which should allow you to manage any `candidate`. I used it like this:
|
|
But when I proceeded later on to make use of the `native-image` binary it was not there.
Using sdkman manually Link to heading
I decided that instead of troubleshooting the Github Action for sdkman, it might be simpler and quicker to manage https://sdkman.io/ myself.
It was not!
This is what I tried:
|
|
The effect was similar. The step seemed to work with no issue whatsoever, but when I tried to use later on `native-image` it was not there.
Trobleshooting Link to heading
When I started added debuging / troubleshooting command in my script, like:
|
|
I realized that it was not using Mandrel at all, but instead a `jdk 11` binary that was found in the `PATH`. The path? Did I say the path?
Bingo! For sdkman to properly work I should find an entry like `$HOME/.sdkman/candidates/java/current/bin` in my `PATH`.
I didn’t!
Even worse, the `sdk` binary was also not found in the path !?
There is no such thing as an sdk binary! Link to heading
In case, you don’t already know, sdkman is not a binary but an alias that gets initialized by your shell. Usually, it should be initialized by a command like:
|
|
found inside your `.bashrc` or `.zshrc`.
The weird part of the story is that after checking what’s inside those files, the sdkman initialization lines where present.
bashrc is not executed Link to heading
I searched online for `github actions bashrc not executed` The firs result that came back was pretty enlightening. According to https://github.community/t/self-hosted-not-using-bashrc/18358/2:
`In order for individual steps to make use of the .bashrc, one needs to explictly request it, by setting the default shell options:
|
|
I added this to my action and things worked like a charm.
A full exmaple Link to heading
|
|
The full project can be found at: https://github.com/iotemplates/clojure-cli. As always, I hope this was helpful. See ya!