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

Setup Java does not ensure that sbt is installed on Ubuntu 24 #712

Open
2 of 5 tasks
jsoref opened this issue Dec 18, 2024 · 9 comments
Open
2 of 5 tasks

Setup Java does not ensure that sbt is installed on Ubuntu 24 #712

jsoref opened this issue Dec 18, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@jsoref
Copy link

jsoref commented Dec 18, 2024

Description:
Notice of breaking changes for GitHub Actions warned that certain packages would not be present in Ubuntu 24.04, this included sbt.

This was tripped on by this repository and worked around by pinning backwards (from ubuntu-latest to ubuntu-22.04):

Unfortunately, anyone who legitimately expected "setup-java" to set up java for use with sbt which is listed as a supported feature of the actions/setup-java repository:

- Caching dependencies managed by sbt.

... doesn't get a working sbt environment.

Task version:
Specify the task version actions/setup-java@v4, as in:
https://github.com/GarnerCorp/build-actions/blob/f3a79ac52d53e8b2218381ae5dd240619ed9eacf/scala/action.yml#L129-L134

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:

  1. Create a workflow that runs-on: ubuntu-latest or runs-on: ubuntu-24.04
  2. Add a step that either uses: actions/setup-java@v4 or uses: GarnerCorp/build-actions/scala@0cc885d8117f6bb9c89dc99a34f5edebeac115cf
  3. If you aren't using the build-actions/scala action which automatically uses sbt, run sbt

Expected behavior:
sbt should work

Actual behavior:
sbt: not found

@jsoref jsoref added bug Something isn't working needs triage labels Dec 18, 2024
@gowridurgad
Copy link

Hello @jsoref,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

@mahabaleshwars mahabaleshwars self-assigned this Dec 19, 2024
@boydsa92
Copy link

boydsa92 commented Dec 19, 2024

We are facing the same issue
/home/runner/work/_temp/ff2d4e86-705c-42c5-98eb-92311951ff46.sh: line 2: sbt: command not found

@mahabaleshwars
Copy link
Contributor

Hi @jsoref,

You're absolutely right that sbt is currently not included in Ubuntu 24.04. The Runner Image team has made cuts to the list of included packages in order to maintain our SLA for free disk space. More details here: actions/runner-images#10636.

Since sbt is not part of the runner image, CI workflows were failing, which is why the workflows have been updated.

The setup-java action provides the environment for sbt, and including sbt by default depends on the runner image configuration.

You can still install sbt manually using sudo apt-get install sbt, but currently, it isn't working with Ubuntu 24.04. Below is a workaround for the issue.

     run: |
       echo ""deb https://repo.scala-sbt.org/scalasbt/debian all main"" | sudo tee /etc/apt/sources.list.d/sbt.list
       echo ""deb https://repo.scala-sbt.org/scalasbt/debian /"" | sudo tee /etc/apt/sources.list.d/sbt_old.list
       curl -sL ""https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823"" | sudo apt-key add
       sudo apt-get update
       sudo apt-get install sbt

Let me know if it helps resolve your problem.

@jsoref
Copy link
Author

jsoref commented Dec 20, 2024

first, your sample code is buggy and you really shouldn't suggest it -- the "" evaluate to empty.
second, apt-key is deprecated and has been since at least ubuntu 22.04 -- suggesting it anywhere is a horrible idea.

third, this action is designed to support sbt -- each consumer of this action shouldn't have to try to avoid making the mistakes that you included in your sample code (or the various other mistakes that may be present or properly maintain it for when the key for ubuntu changes). Or the various other problems entailed here.

@SethTisue
Copy link

SethTisue commented Dec 20, 2024

The maintainers of sbt have made this action available: https://github.com/sbt/setup-sbt cc @eed3si9n

So all that users need to do is add uses: sbt/setup-sbt@v1 and you're good again.

mpollmeier added a commit to joernio/joern that referenced this issue Dec 23, 2024
sbt is no longer included by default in the ubuntu 24 runner
https://github.com/sbt/setup-sbt
actions/setup-java#712 (comment)
mpollmeier added a commit to joernio/joern that referenced this issue Dec 24, 2024
* fix github actions runner

sbt is no longer included by default in the ubuntu 24 runner
https://github.com/sbt/setup-sbt
actions/setup-java#712 (comment)

* forgot a few places

* temporarily disable citation action

Error: Rscript: command not found
#4069

* try to reenable citation action and configure to install R
@mahabaleshwars
Copy link
Contributor

Hi @jsoref ,

The double quotes "" I used in the original sample code were indeed incorrect, as they would evaluate to empty strings. I appreciate you pointing that out. Here’s the corrected command:

run:|
      sudo apt-get update
      sudo apt-get install apt-transport-https curl gnupg -yqq
      echo ""deb https://repo.scala-sbt.org/scalasbt/debian all main"" | sudo tee /etc/apt/sources.list.d/sbt.list
      echo ""deb https://repo.scala-sbt.org/scalasbt/debian /"" | sudo tee /etc/apt/sources.list.d/sbt_old.list
      curl -sL ""https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823"" | sudo -H gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/scalasbt-release.gpg --import
      sudo chmod 644 /etc/apt/trusted.gpg.d/scalasbt-release.gpg
      sudo apt-get update
      sudo apt-get install sbt

Reference Link

You're right that the setup-java action is designed to support sbt out of the box, and consumers shouldn't have to manually manage dependencies like sbt for typical use cases. The issue here is that sbt is not included in the default Ubuntu 24.04 runner image, and because of this, CI workflows are failing. The Runner Image team made this change to reduce disk usage. The workaround I provided was meant to help in cases where users are facing this problem, but I do agree it’s not an ideal long-term solution.

@jsoref
Copy link
Author

jsoref commented Dec 27, 2024

It doesn't look like you've fixed the doubled quotes. You did fix the apt-key things, which is nice although that's not an alternative command I've seen before...

@SethTisue
Copy link

I agree it would make a lot of sense for setup-java to pick this up now that it isn't in the ubuntu-latest anymore.

@eed3si9n
Copy link

I recommend using setup-sbt, or if setup-java folks are considering to make sbt runner script available, take the similar approach that I took and use the universal .zip or .tgz file instead of apt-get install sbt:

  1. Deb / RPM packages are hosted by an Artifactory instance, which Scala Center is granted usage by JFrog for free, renewed annually, and we should operate under the assumption that it might someday go away. Thus, in general we should avoid using apt-get install sbt.
  2. For the reason above, I have reduced the file size of .deb file by not including some files .zip contains (so it would be cheaper for whoever who might have to run the Artifactory instance), and the sbt runner script would download them on the fly.
  3. Deb package works only for Linux, but GitHub Action supports macOS and Windows as well.

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

6 participants