-
Notifications
You must be signed in to change notification settings - Fork 27
/
earthly
executable file
·39 lines (31 loc) · 1.09 KB
/
earthly
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
#!/usr/bin/env bash
to_echo() {
if [ "$1" -eq 1 ]; then
echo "$2"
fi
}
read_tool_versions_write_to_env() {
local -r tool_versions_file="$1"
# loop over each line of the .tool-versions file
while read -r line; do
# split the line into a bash array using the default space delimeter
IFS=" " read -r -a lineArray <<<"$line"
# get the key and value from the array, set the key to all uppercase
key="${lineArray[0],,}"
value="${lineArray[1]}"
# ignore comments, comments always start with #
if [[ ${key:0:1} != "#" ]]; then
full_key="${key/-/_}_tool_version"
export "${full_key}=${value}"
fi
done <"$tool_versions_file"
}
read_tool_versions_write_to_env '.tool-versions'
set -x
earthly $* \
--CHART_RELEASER_VERSION=${helm_cr_tool_version} \
--CHART_TESTING_VERSION=${helm_ct_tool_version} \
--GITHUB_CLI_VERSION=${github_cli_tool_version} \
--GOLANG_VERSION=${golang_tool_version} \
--KUBECONFORM_VERSION=${kubeconform_tool_version} \
--STATICCHECK_VERSION=${staticcheck_tool_version}