Skip to content

Commit 794ae12

Browse files
authored
Add new runtime environment variable to dgoss to copy additional files (#898)
* Add an option to dgoss to copy additional directories. * remove new line
1 parent 1b523c0 commit 794ae12

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

extras/dgoss/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ Time to sleep after running container (and optionally `goss_wait.yaml`) and befo
9696

9797
Location of the goss yaml files. (Default: `.`)
9898

99+
#### GOSS_ADDITIONAL_COPY_PATH
100+
101+
Colon-seperated list of additional directories to copy to container.
102+
103+
By default dgoss copies `goss.yaml` from the current working directory and
104+
nothing else. You may need other files like scripts and configurations copied
105+
as well. Specify `GOSS_ADDITIONAL_COPY_PATH` similar to `$PATH` as colon seperated
106+
list of directories for each additional directory you'd like to recursively copy.
107+
These will be copied as directories next to `goss.yaml` in the temporary
108+
directory `DGOSS_TEMP_DIR`. (Default: `''`)
109+
99110
#### GOSS_VARS
100111

101112
The name of the variables file relative to `GOSS_FILES_PATH` to copy into the

extras/dgoss/dgoss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ run(){
3636
[[ -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"
3737
[[ -e "${GOSS_FILES_PATH}/goss_wait.yaml" ]] && cp "${GOSS_FILES_PATH}/goss_wait.yaml" "$tmp_dir" && chmod 644 "$tmp_dir/goss_wait.yaml"
3838
[[ -n "${GOSS_VARS}" ]] && [[ -e "${GOSS_FILES_PATH}/${GOSS_VARS}" ]] && cp "${GOSS_FILES_PATH}/${GOSS_VARS}" "$tmp_dir" && chmod 644 "$tmp_dir/${GOSS_VARS}"
39+
if [ -n "$GOSS_ADDITIONAL_COPY_PATH" ]; then
40+
for dir in "$(echo "$GOSS_ADDITIONAL_COPY_PATH" | sed 's/:/ /g')"; do
41+
cp -r ${dir} "${tmp_dir}/"
42+
chmod -R 755 "$tmp_dir/$(basename ${dir})"
43+
done
44+
fi
3945

4046
# Switch between mount or cp files strategy
4147
GOSS_FILES_STRATEGY=${GOSS_FILES_STRATEGY:="mount"}

0 commit comments

Comments
 (0)