forked from okteto/build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·113 lines (90 loc) · 2.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
set -e
tag=$1
file=$2
path=$3
buildargs=$4
nocache=$5
cachefrom=$6
exportcache=$7
secrets=$8
platform=$9
if [ -n "$OKTETO_CA_CERT" ]; then
echo "Custom certificate is provided"
echo "$OKTETO_CA_CERT" > /usr/local/share/ca-certificates/okteto_ca_cert.crt
update-ca-certificates
fi
# if path is ".", override value to empty
# Okteto CLI will run on root
if [ "$path" = "." ]; then
path=""
fi
command="build"
if [ -n "$path" ]; then
command=$(eval echo "$command" "$path")
fi
params=$(eval echo --progress plain)
if [ -n "$tag" ]; then
params=$(eval echo "$params" -t "$tag")
fi
if [ -n "$file" ]; then
params=$(eval echo "$params" -f "$file")
fi
if [ -n "$buildargs" ]; then
IFS=','
# shellcheck disable=SC2086
set -- $buildargs
unset IFS
while [ $# -gt 0 ]; do
params=$(eval echo "$params" --build-arg "$1")
shift
done
fi
if [ "$nocache" = "true" ]; then
params=$(eval echo "$params" --no-cache)
fi
if [ -n "$cachefrom" ]; then
IFS=','
# shellcheck disable=SC2086
set -- $cachefrom
unset IFS
while [ $# -gt 0 ]; do
params=$(eval echo "$params" --cache-from "$1")
shift
done
fi
if [ -n "$exportcache" ]; then
IFS=','
# shellcheck disable=SC2086
set -- $exportcache
unset IFS
while [ $# -gt 0 ]; do
params=$(eval echo "$params" --export-cache "$1")
shift
done
fi
if [ -n "$secrets" ]; then
IFS=';'
# shellcheck disable=SC2086
set -- $secrets
unset IFS
while [ $# -gt 0 ]; do
params=$(eval echo "$params" --secret "$1")
shift
done
fi
if [ -n "$platform" ]; then
params=$(eval echo "$params" --platform "$platform")
fi
log_level=${10}
if [ ! -z "$log_level" ]; then
log_level="--log-level ${log_level}"
fi
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
if [ "${RUNNER_DEBUG}" = "1" ]; then
log_level="--log-level debug"
fi
echo running: okteto "$command" "$params" $log_level
# shellcheck disable=SC2086
okteto $command $params $log_level