Skip to content

Commit

Permalink
added support for mounting secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
dprosper committed Apr 16, 2022
1 parent ae92718 commit 869b1e4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion icce-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,23 @@ if [ -f .github/workflows/icce-project-config.json ]; then

p_mount_configmap="--mount-configmap $path=$name"
done

secrets=$(jq -c '.secretsfromfile[]?' .github/workflows/icce-project-config.json)
for secret in $secrets; do
name=$(echo ${secret} | jq -r '.name | select (.!=null)')
file=$(echo ${secret} | jq -r '.file | select (.!=null)')
path=$(echo ${secret} | jq -r '.path | select (.!=null)')

set +o errexit
ibmcloud code-engine secret create --name "$name" --from-file "$file"
[ $? -ne 0 ] && echo "Error during secret create" && exit 1
set -o errexit

p_mount_secret="--mount-secret $path=$name"
done

else
echo "Failed to create configmap from icce-project-config.json, either the file failed json parsing or something else went wrong." && exit 1
echo "Failed to use icce-project-config.json, either the file failed json parsing or something else went wrong." && exit 1
fi
fi

Expand All @@ -69,6 +84,7 @@ ibmcloud code-engine app create \
--port "$APP_PORT" \
${p_registry_secret} \
${p_mount_configmap} \
${p_mount_secret} \
--wait \
--wait-timeout 120
[ $? -ne 0 ] && echo "Error encountered during app create, printing events and logs from deployment." \
Expand Down

0 comments on commit 869b1e4

Please sign in to comment.