Warm tip: This article is reproduced from serverfault.com, please click

What does 'nonzero return code 128' in github actions mean?

发布于 2020-12-02 20:06:54

I'm getting the following error in my github action:

[info] welcome to sbt 1.4.2 (Oracle Corporation Java 1.8.0_222)
[info] loading settings for project workspace-build from plugins.sbt ...
[info] loading project definition from /github/workspace/project
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] loading settings for project root from build.sbt,github_action_sbt_settings.sbt ...
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
fatal: No names found, cannot describe anything.
java.lang.RuntimeException: Nonzero exit value: 128
    at scala.sys.package$.error(package.scala:30)
    at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.slurp(ProcessBuilderImpl.scala:138)
    at scala.sys.process.ProcessBuilderImpl$AbstractBuilder.$bang$bang(ProcessBuilderImpl.scala:108)
    at co.blocke.gfpack.GFPackagerPlugin$.$anonfun$projectSettings$18(GFPackagerPlugin.scala:60)
    at sbt.internal.util.Init$Value.$anonfun$apply$2(Settings.scala:922)
    at sbt.internal.util.EvaluateSettings.$anonfun$constant$1(INode.scala:211)
    at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
    at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
    at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
    at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
    at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[error] Nonzero exit value: 128
[error] Use 'last' for the full log.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)

At this point my repo has been checked out and JDK 13 has been configured (although I see here it's using Java 1.8 for some reason).

What does 128 code mean?

This builds locally fine. sbt starts locally like this:

[info] welcome to sbt 1.4.2 (Oracle Corporation Java 13.0.1)
[info] loading global plugins from /Users/wmy965/.sbt/1.0/plugins
[info] loading settings for project scalajack-build from plugins.sbt ...
[info] loading project definition from /Users/wmy965/git/ScalaJack/project
[info] loading settings for project root from build.sbt ...
[info] set current project to scalajack (in build file:/Users/wmy965/git/ScalaJack/)
[info] sbt server started at local:///Users/wmy965/.sbt/1.0/server/84b4cffb6c175e13afb2/sock
sbt:scalajack> exit

What is wrong? What "names" is it looking for? (Is there a way to run 'last', like you would on a command line, inside an action in order to see what it's complaining about?)

Here's the workflow yml it's trying to run:

name: Package Release
# This workflow is triggered on pushes to the repository.
on: 
  push: 
    branches:
      - "master"  # only release on a push to main

jobs:
  build:
    name: Release
    runs-on: ubuntu-latest

    steps:
      - name: Set up JDK 13
        uses: actions/setup-java@v1
        with:
          java-version: '13.0.1'
      - name: Checkout repo
        uses: actions/checkout@v2
      - name: Test and Release
        env:
          BINTRAY_USER: ${{ secrets.BINTRAY_UID }}
          BINTRAY_PASS: ${{ secrets.BINTRAY_PWD }}
          BUILD_VERSION: ${{ github.event.ref }}
        id: release
        uses: lokkju/github-action-sbt@master
        with:
          commands: "test; publish"
Questioner
Greg
Viewed
0
bk2204 2020-12-03 07:52:40

Your code invokes git describe, which provides a name for the current commit using the tags in the repository. If there are no tags it can use, then Git will exit with status code 128 so that users can easily detect that it failed.

In your case, you're using v2 of the actions/checkout action, which does a shallow clone. As a consequence, your repository is almost never going to contain any tags at all (or any other history) and git describe isn't going to work.

If you want git describe to work in your project, then you need to adjust the parameters like so:

- name: Checkout repo
  uses: actions/checkout@v2
  with:
    fetch-depth: 0

That will clone the entire repository, allowing you access to tags, but as a consequence, it will be much slower to clone initially. As an alternative, you can simply remove the code in your codebase that invokes git describe.