github / codeql-action

Actions for running CodeQL analysis
MIT License
1.14k stars 313 forks source link

github/codeql-action/autobuild@v1 suddenly stop working #824

Closed frankfliu closed 2 years ago

frankfliu commented 2 years ago

Our build failed suddenly:

Error: 1-19 03:40:11] [ERROR] Spawned process exited abnormally (code 1; tried to run: [gradle, wrapper, --no-daemon, -b, /tmp/semmleTempDir/autobuild.gradle])
  ERROR: Failed to download Gradle wrapper
  Error: We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps.  Failure invoking /opt/hostedtoolcache/CodeQL/0.0.0-20211025/x64/codeql/java/tools/autobuild.sh with arguments .

        Exit code 1 and error was:

        Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false
  ERROR: Failed to download Gradle wrapper

See: https://github.com/deepjavalibrary/djl/runs/4260031154?check_suite_focus=true

The .yml file can be found: https://github.com/deepjavalibrary/djl/actions/runs/1478679804/workflow

Any idea why it failed to download gradle wrapper?

aeisenberg commented 2 years ago

Thank you for raising an issue. I can't tell exactly what is happening here, but I can see that the autobuilder is trying to look for a gradle file in /tmp/semmleTempDir and since it is not finding one, the build is failing. I am not sure why the autobuilder is getting confused. I'll ask the team supporting the java extractor for more info.

aeisenberg commented 2 years ago

Apologies for the delay. It looks like the problem is that about a week ago, the virtual environment updated the gradle version it uses. In gradle 7.3, the -b flag was removed, which the autobuilder relies on in this situation.

The team working on the java extractor will fix this issue, but in the meantime, there are two workarounds you can do:

  1. use Gradle 7.2 or earlier. You will need to explicitly download this earlier version and add the executable's directory to your path.
  2. Ensure gradlew, gradle/wrapper/gradle-wrapper.properties, and gradle/wrapper/gradle-wrapper.jar exist prior to starting the autobuilder.
aeisenberg commented 2 years ago

cc: @smowton

frankfliu commented 2 years ago

@aeisenberg Thanks for your update, I will just wait for the fix.

One comments about manually install gradle:

  1. Ware are currently using gradle 7.2 in our project, ideally autobuild should respect the gradle version in the project
  2. We have gradlew and gradle-rapper.properties, but we made some modification that gradlew will download gradele-wrapper.jar on the fly. I suggest that you might want to relax the check a bit to allow without gradle-wrapper.jar case.
smowton commented 2 years ago

@frankfliu should you get impatient, looks like running a simple ./gradlew --no-daemon clean ahead of the CodeQL init step suffices, as that causes Gradle to download the wrapper jar. After that everything looks normal and the autobuilder does the right thing, including respecting your chosen Gradle version.

frankfliu commented 2 years ago

@smowton Thanks a lot. adding ./gradlew --no-daemon clean solves my problem

smowton commented 2 years ago

Fix committed, will roll out with the next code scanning distribution upgrade