Skip to content

Commit 8eea425

Browse files
author
michael.biriley@firstaml.com
committed
Add additional option to skip ssh-keyscan, update README
1 parent 5b6024c commit 8eea425

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Paths accepted by `git sparse-checkout set`.
2020

2121
Whether to pass `--no-cone` to `git sparse-checkout` so that the paths are considered to be a list of patterns.
2222

23+
#### `skip_ssh_keyscan` ('true' or 'false')
24+
25+
Whether to skip ssh-keyscan step. This will skip adding each ssh public key into the known-hosts file. Only use if ssh keys are already setup.
26+
2327
## Example
2428

2529
Below is an example for using sparse-checkout plugin.

hooks/checkout

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ NO_CONE_OPTION="$(plugin_read_config NO_CONE "false")"
1111
NO_CONE_PARAM=""
1212
[[ $NO_CONE_OPTION = false ]] || NO_CONE_PARAM="--no-cone"
1313

14+
SKIP_SSH_KEYSCAN_OPTION="$(plugin_read_config SKIP_SSH_KEYSCAN "false")"
15+
1416
if plugin_read_list_into_result PATHS; then
1517
CHECKOUT_PATHS=("${result[@]}")
1618
else
1719
echo "Missing 'paths' option in the plugin"
1820
exit 1
1921
fi
2022

21-
echo "Scanning SSH keys for remote git repository"
22-
[[ -d ~/.ssh ]] || mkdir -p ~/.ssh
23-
ssh-keyscan "${BUILDKITE_REPO_SSH_HOST}" >> ~/.ssh/known_hosts
23+
if [[ "$SKIP_SSH_KEYSCAN_OPTION" != "false" ]]; then
24+
echo "Scanning SSH keys for remote git repository"
25+
[[ -d ~/.ssh ]] || mkdir -p ~/.ssh
26+
ssh-keyscan "${BUILDKITE_REPO_SSH_HOST}" >> ~/.ssh/known_hosts
27+
fi
2428

2529
echo "Creating sparse-checkout with paths: ${CHECKOUT_PATHS[*]}"
2630

0 commit comments

Comments
 (0)