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..962d429c9 100755 --- a/extras/dgoss/dgoss +++ b/extras/dgoss/dgoss @@ -36,6 +36,12 @@ run(){ [[ -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"}