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

getGradleCommandLine should not use sh #4630

Closed
isker opened this issue Oct 10, 2019 · 0 comments · Fixed by #4671
Closed

getGradleCommandLine should not use sh #4630

isker opened this issue Oct 10, 2019 · 0 comments · Fixed by #4671
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@isker
Copy link
Contributor

isker commented Oct 10, 2019

What Renovate type are you using?
Self-hosted, renovate/renovate:latest.

Describe the bug

} else if (gradlewExists) {
cmd = 'sh gradlew';
} else {

Renovate invokes sh but inside of the docker image, sh is symlinked to /bin/dash, which finds invalid syntax in gradlew:

$ sh gradlew
gradlew: 158: gradlew: Syntax error: "(" unexpected
$ cat -n gradlew | grep -C3 158
   155	fi
   156
   157	# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
   158	function splitJvmOpts() {
   159	    JVM_OPTS=("$@")
   160	}
   161	eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS

This bash syntax is not valid in dash. gradlew ought to be treated as executable and executed directly, I think.

Did you see anything helpful in debug logs?

 WARN: Gradle command sh gradlew --init-script renovate-plugin.gradle renovate failed. Exit code: 2. (repository=foo/bar)
       "err": {
         "killed": false,
         "code": 2,
         "signal": null,
         "cmd": "sh gradlew --init-script renovate-plugin.gradle renovate",
         "stdout": "",
         "stderr": "gradlew: 158: gradlew: Syntax error: \"(\" unexpected\n",
         "message": "Command failed: sh gradlew --init-script renovate-plugin.gradle renovate\ngradlew: 158: gradlew: Syntax error: \"(\" unexpected\n",
         "stack": "Error: Command failed: sh gradlew --init-script renovate-plugin.gradle renovate\ngradlew: 158: gradlew: Syntax error: \"(\" unexpected\n\n    at ChildProcess.exithandler (child_process.js:294:12)\n    at ChildProcess.emit (events.js:198:13)\n    at ChildProcess.EventEmitter.emit (domain.js:448:20)\n    at maybeClose (internal/child_process.js:982:16)\n    at Socket.stream.socket.on (internal/child_process.js:389:11)\n    at Socket.emit (events.js:198:13)\n    at Socket.EventEmitter.emit (domain.js:448:20)\n    at Pipe._handle.close (net.js:606:12)"
       }

To Reproduce
Steps to reproduce the behavior:

  1. Generate a Gradle project with Gradle 3.4.1 (I don't know that a version this old is necessary but it's the version that generated this project's gradlew).
  2. Try to use renovate/renovate:latest on the resulting project.
@rarkins rarkins added type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others ready labels Oct 11, 2019
isker pushed a commit to isker/renovate that referenced this issue Oct 16, 2019
isker added a commit to isker/renovate that referenced this issue Oct 16, 2019
isker added a commit to isker/renovate that referenced this issue Oct 16, 2019
rarkins pushed a commit that referenced this issue Oct 18, 2019
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 19.62.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants