Skip to content

Commit

Permalink
Shellchecking and bash best practises
Browse files Browse the repository at this point in the history
Signed-off-by: Damien DUPORTAL <damien.duportal@gmail.com>

Cleaning

Signed-off-by: Damien DUPORTAL <damien.duportal@gmail.com>
  • Loading branch information
dduportal committed Mar 15, 2017
1 parent e3bc154 commit 49854a6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ See [Jenkins Distributed builds](https://wiki.jenkins-ci.org/display/JENKINS/Dis

To run a Docker container

docker run jenkinsci/ssh-slave "<public key>"
```bash
docker run jenkinsci/ssh-slave "<public key>"
```

You'll then be able to connect this slave using ssh-slaves-plugin as "jenkins" with the matching private key.

Expand All @@ -24,4 +26,3 @@ In _Environment_ field of the Docker Template (advanced section), just add:
JENKINS_SLAVE_SSH_PUBKEY=<YOUR PUBLIC SSH KEY HERE>

Don't put quotes around the public key. You should be all set.

5 changes: 3 additions & 2 deletions setup-sshd
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -ex

# The MIT License
#
# Copyright (c) 2015, CloudBees, Inc.
Expand Down Expand Up @@ -45,5 +47,4 @@ if [[ $# -gt 0 ]]; then
exec "$@"
fi
fi
exec /usr/sbin/sshd -D $@

exec /usr/sbin/sshd -D "${@}"
4 changes: 2 additions & 2 deletions tests/test_helpers.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#!/bin/bash
# check dependencies
(
type docker &>/dev/null || ( echo "docker is not available"; exit 1 )
Expand Down Expand Up @@ -33,7 +33,7 @@ function retry {
sleep $delay
done

echo "Command \"$@\" failed $attempts times. Status: $status. Output: $output"
echo "Command \"$@\" failed $attempts times. Status: $status. Output: $output"
false
}

Expand Down
5 changes: 2 additions & 3 deletions tests/tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ load keys
}

@test "clean test container" {
docker kill $SUT_CONTAINER &>/dev/null ||:
docker rm -fv $SUT_CONTAINER &>/dev/null ||:
docker kill "${SUT_CONTAINER}" &>/dev/null ||:
docker rm -fv "${SUT_CONTAINER}" &>/dev/null ||:
}

@test "create slave container" {
Expand Down Expand Up @@ -100,4 +100,3 @@ function run_through_ssh {
false \
)
}

0 comments on commit 49854a6

Please sign in to comment.