Fix when rendering several bundles in the same project

This commit is contained in:
Daniel Berteaud 2024-01-09 14:14:43 +01:00
parent b620231526
commit 63d8785da5
1 changed files with 3 additions and 4 deletions

7
ctctl
View File

@ -525,6 +525,8 @@ ctctl_render_templates(){
mkdir -p bundles
CONFIG=$(mktemp -t tmp.XXXXXXXXX.yml)
# First, cleanup any previously rendered files
rm -rf output ./*.nomad ./*.nomad.hcl
for BUNDLE in $(yq e -o=j -I=0 '.bundles[]' bundles.yml); do
local URL=$(echo ${BUNDLE} | jq -r .url)
@ -612,13 +614,10 @@ ctctl_render_templates(){
echo "Redering bundles with gomplate ${GOMPLATE_COMMON_ARGS[@]} ${GOMPLATE_BUNDLE_ARGS[@]} ${GOMPLATE_OUT_ARGS[@]}"
# First, cleanup any previously rendered files
rm -rf output ./*.nomad ./*.nomad.hcl
# Now render the bundle files
gomplate "${GOMPLATE_COMMON_ARGS[@]}" "${GOMPLATE_BUNDLE_ARGS[@]}" "${GOMPLATE_OUT_ARGS[@]}"
for IMGDIR in $(find . -name images -type d | grep -vE '^./bundles/.+/example'); do
for IMGDIR in $(find . -name images -type d | grep -vE '^(./output|./bundles/.+/example)'); do
for DOCKER_IMAGE in $(find ${IMGDIR} -mindepth 1 -maxdepth 1 -type d); do
echo "Redering Docker image $(basename ${DOCKER_IMAGE})"
gomplate "${GOMPLATE_COMMON_ARGS[@]}" --input-dir ${DOCKER_IMAGE} --exclude resources/** --exclude root/** --output-dir output/images/$(basename ${DOCKER_IMAGE})/