From 509eca01f218f4e33bef4e871cb28f6d0cfefb75 Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Sun, 5 May 2024 12:11:02 +0200 Subject: [PATCH 1/2] Add an option to dgoss to copy additional directories. --- extras/dgoss/README.md | 11 +++++++++++ extras/dgoss/dgoss | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/extras/dgoss/README.md b/extras/dgoss/README.md index beedc739e..b2066d582 100644 --- a/extras/dgoss/README.md +++ b/extras/dgoss/README.md @@ -96,6 +96,17 @@ Time to sleep after running container (and optionally `goss_wait.yaml`) and befo Location of the goss yaml files. (Default: `.`) +#### GOSS_ADDITIONAL_COPY_PATH + +Colon-seperated list of additional directories to copy to container. + +By default dgoss copies `goss.yaml` from the current working directory and +nothing else. You may need other files like scripts and configurations copied +as well. Specify `GOSS_ADDITIONAL_COPY_PATH` similar to `$PATH` as colon seperated +list of directories for each additional directory you'd like to recursively copy. +These will be copied as directories next to `goss.yaml` in the temporary +directory `DGOSS_TEMP_DIR`. (Default: `''`) + #### GOSS_VARS The name of the variables file relative to `GOSS_FILES_PATH` to copy into the diff --git a/extras/dgoss/dgoss b/extras/dgoss/dgoss index deefb7a74..1b81a0be5 100755 --- a/extras/dgoss/dgoss +++ b/extras/dgoss/dgoss @@ -33,9 +33,16 @@ run(){ # Copy in goss cp "${GOSS_PATH}" "$tmp_dir/goss" chmod 755 "$tmp_dir/goss" + [[ -e "${GOSS_FILES_PATH}/${GOSS_FILE:-goss.yaml}" ]] && cp "${GOSS_FILES_PATH}/${GOSS_FILE:-goss.yaml}" "$tmp_dir/goss.yaml" && chmod 644 "$tmp_dir/goss.yaml" [[ -e "${GOSS_FILES_PATH}/goss_wait.yaml" ]] && cp "${GOSS_FILES_PATH}/goss_wait.yaml" "$tmp_dir" && chmod 644 "$tmp_dir/goss_wait.yaml" [[ -n "${GOSS_VARS}" ]] && [[ -e "${GOSS_FILES_PATH}/${GOSS_VARS}" ]] && cp "${GOSS_FILES_PATH}/${GOSS_VARS}" "$tmp_dir" && chmod 644 "$tmp_dir/${GOSS_VARS}" + if [ -n "$GOSS_ADDITIONAL_COPY_PATH" ]; then + for dir in "$(echo "$GOSS_ADDITIONAL_COPY_PATH" | sed 's/:/ /g')"; do + cp -r ${dir} "${tmp_dir}/" + chmod -R 755 "$tmp_dir/$(basename ${dir})" + done + fi # Switch between mount or cp files strategy GOSS_FILES_STRATEGY=${GOSS_FILES_STRATEGY:="mount"} From 021c270fb61ba803b5ae626014db9aeababd1743 Mon Sep 17 00:00:00 2001 From: dklimpel <5740567+dklimpel@users.noreply.github.com> Date: Sun, 5 May 2024 12:13:00 +0200 Subject: [PATCH 2/2] remove new line --- extras/dgoss/dgoss | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/dgoss/dgoss b/extras/dgoss/dgoss index 1b81a0be5..962d429c9 100755 --- a/extras/dgoss/dgoss +++ b/extras/dgoss/dgoss @@ -33,7 +33,6 @@ run(){ # Copy in goss cp "${GOSS_PATH}" "$tmp_dir/goss" chmod 755 "$tmp_dir/goss" - [[ -e "${GOSS_FILES_PATH}/${GOSS_FILE:-goss.yaml}" ]] && cp "${GOSS_FILES_PATH}/${GOSS_FILE:-goss.yaml}" "$tmp_dir/goss.yaml" && chmod 644 "$tmp_dir/goss.yaml" [[ -e "${GOSS_FILES_PATH}/goss_wait.yaml" ]] && cp "${GOSS_FILES_PATH}/goss_wait.yaml" "$tmp_dir" && chmod 644 "$tmp_dir/goss_wait.yaml" [[ -n "${GOSS_VARS}" ]] && [[ -e "${GOSS_FILES_PATH}/${GOSS_VARS}" ]] && cp "${GOSS_FILES_PATH}/${GOSS_VARS}" "$tmp_dir" && chmod 644 "$tmp_dir/${GOSS_VARS}"