Skip to content

Commit

Permalink
[PATCH] Do not prevent execution if the single argument is an option (j…
Browse files Browse the repository at this point in the history
…enkinsci#219)

This prevents such kind of error:

```sh-session
$ docker run jenkins/inbound-agent -disableHttpsCertValidation
/usr/local/bin/jenkins-agent: 42: exec: -disableHttpsCertValidation: not found
```

Co-authored-by: Tim Jacomb <timjacomb1+github@gmail.com>
  • Loading branch information
2 people authored and lemeurherve committed Nov 28, 2023
1 parent cf85fa3 commit 035f762
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jenkins-agent
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
# the agent skips connecting to an HTTP(S) port for connection info.
# * JENKINS_PROTOCOLS: Specify the remoting protocols to attempt when instanceIdentity is provided.

if [ $# -eq 1 ]; then
if [ $# -eq 1 ] && [ "${1#-}" == "$1" ] ; then

# if `docker run` only has one arguments, we assume user is running alternate command like `bash` to inspect the image
# if `docker run` only has one arguments and it is not an option as `-help`, we assume user is running alternate command like `bash` to inspect the image
exec "$@"

else
Expand Down

0 comments on commit 035f762

Please sign in to comment.