Skip to content

Commit 869b1e4

Browse files
committed
added support for mounting secrets
1 parent ae92718 commit 869b1e4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

icce-create.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,23 @@ if [ -f .github/workflows/icce-project-config.json ]; then
5757

5858
p_mount_configmap="--mount-configmap $path=$name"
5959
done
60+
61+
secrets=$(jq -c '.secretsfromfile[]?' .github/workflows/icce-project-config.json)
62+
for secret in $secrets; do
63+
name=$(echo ${secret} | jq -r '.name | select (.!=null)')
64+
file=$(echo ${secret} | jq -r '.file | select (.!=null)')
65+
path=$(echo ${secret} | jq -r '.path | select (.!=null)')
66+
67+
set +o errexit
68+
ibmcloud code-engine secret create --name "$name" --from-file "$file"
69+
[ $? -ne 0 ] && echo "Error during secret create" && exit 1
70+
set -o errexit
71+
72+
p_mount_secret="--mount-secret $path=$name"
73+
done
74+
6075
else
61-
echo "Failed to create configmap from icce-project-config.json, either the file failed json parsing or something else went wrong." && exit 1
76+
echo "Failed to use icce-project-config.json, either the file failed json parsing or something else went wrong." && exit 1
6277
fi
6378
fi
6479

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

0 commit comments

Comments
 (0)