-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathentrypoint.sh
executable file
·39 lines (32 loc) · 1.12 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e
CF_API=${INPUT_CF_API:-api.fr.cloud.gov}
# Authenticate and target CF org and space.
cf api "$CF_API"
cf auth "$INPUT_CF_USERNAME" "$INPUT_CF_PASSWORD"
cf target -o "$INPUT_CF_ORG" -s "$INPUT_CF_SPACE"
# If they specified a full command, run it
if [[ -n "$INPUT_COMMAND" ]]; then
echo "Running command: $INPUT_COMMAND"
eval $INPUT_COMMAND
exit
fi
# If they specified a cf CLI subcommand, run it
if [[ -n "$INPUT_CF_COMMAND" ]]; then
echo "Running command: $INPUT_CF_COMMAND"
eval cf $INPUT_CF_COMMAND
exit
fi
# Otherwise, assume they want to do a cf push.
# If they didn't specify and don't have a default-named manifest.yml, then the
# push will fail with a pretty accurate message: "Incorrect Usage: The specified
# path 'manifest.yml' does not exist."
MANIFEST=${INPUT_CF_MANIFEST:-manifest.yml}
# If they specified a vars file, use it
if [[ -r "$INPUT_CF_VARS_FILE" ]]; then
echo "Pushing with vars file: $INPUT_CF_VARS_FILE"
cf push -f "$MANIFEST" --vars-file "$INPUT_CF_VARS_FILE" --strategy rolling
else
echo "Pushing with manifest file: $MANIFEST"
cf push -f "$MANIFEST" --strategy rolling
fi