forked from rstudio/helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
121 lines (103 loc) · 4.01 KB
/
Justfile
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
114
115
116
117
118
119
120
121
DIFF := "diff"
HELM_DOCS_VERSION := env_var_or_default("HELM_DOCS_VERSION", "1.13.1")
OS := if os() == "macos" {"Darwin"} else if os() == "linux" {"Linux"} else if os() == "windows" {"Windows"} else {""}
ARCH := if arch() == "aarch64" {"arm64"} else if arch() == "x86_64" {"x86_64"} else {""}
setup:
#!/bin/bash
set -xe
if [ -f ./bin/helm-docs ]; then
echo "Helm-docs is already installed"
exit 0
fi
echo "Installing helm-docs version {{HELM_DOCS_VERSION}}"
mkdir -p bin
curl -L -s https://github.com/norwoodj/helm-docs/releases/download/v{{HELM_DOCS_VERSION}}/helm-docs_{{HELM_DOCS_VERSION}}_{{OS}}_{{ARCH}}.tar.gz -o bin/helm-docs.tar.gz
tar -C ./bin -xz -f bin/helm-docs.tar.gz helm-docs
rm -rf bin/helm-docs.tar.gz
update-lock:
#!/bin/bash
set -xe
orig_dir=$(pwd)
for dir in `ls charts`; do
echo " --> Updating Chart.lock for $dir"
cd "charts/$dir" && helm dependency update
cd $orig_dir
done
echo " --> Done!"
all-docs:
just docs rbac
docs:
#!/bin/bash
./bin/helm-docs --chart-search-root=charts --template-files=README.md.gotmpl --template-files=./_templates.gotmpl
./bin/helm-docs --chart-search-root=other-charts --template-files=README.md.gotmpl --template-files=./_templates.gotmpl
rbac:
#!/bin/bash
set -xe
cd ./charts/rstudio-launcher-rbac && helm dependency update && helm dependency build && cd -
helm template -n rstudio rstudio-launcher-rbac ./charts/rstudio-launcher-rbac --set removeNamespaceReferences=true > examples/rbac/rstudio-launcher-rbac.yaml
CHART_VERSION=$(helm show chart ./charts/rstudio-launcher-rbac | grep '^version' | cut -d ' ' -f 2)
cp examples/rbac/rstudio-launcher-rbac.yaml examples/rbac/rstudio-launcher-rbac-${CHART_VERSION}.yaml
lint:
#!/bin/bash
ct lint ./charts --target-branch main
snapshot-rsw:
#!/bin/bash
set -xe
helm template -n rstudio ./charts/rstudio-workbench --set global.secureCookieKey="abc" --set launcherPem="abc" | sed -e 's|\(helm\.sh/chart\:\ [a-zA-Z\-]*\).*|\1VERSION|g' > charts/rstudio-workbench/snapshot/default.yaml
for file in `ls ./charts/rstudio-workbench/ci/*.yaml`; do
filename=$(basename $file)
helm template -n rstudio ./charts/rstudio-workbench --set global.secureCookieKey="abc" --set launcherPem="abc" -f $file | sed -e 's|\(helm\.sh/chart\:\ [a-zA-Z\-]*\).*|\1VERSION|g' > charts/rstudio-workbench/snapshot/$filename
done
snapshot-rsw-lock:
#!/bin/bash
set -xe
for file in `ls ./charts/rstudio-workbench/snapshot/*.yaml`; do
cp $file $file.lock
done
snapshot-rsw-diff:
#!/bin/bash
set -x
for file in `ls ./charts/rstudio-workbench/snapshot/*.yaml`; do
echo Diffing $file
if [[ `diff -q $file $file.lock` ]]; then
{{ DIFF }} $file $file.lock
fi
done
test-connect-interpreter-versions:
#!/usr/bin/env bash
set -xe
cd ./charts/rstudio-connect && helm dependency build && cd -
# find the default image
image=$(
helm template ./charts/rstudio-connect \
--show-only templates/deployment.yaml | \
grep "image\:.*rstudio-connect.*" | \
awk -F": " '{print $2}' | \
xargs)
for lang in "Python" "Quarto" "R"
do
# print the default connect config file for local execution in ini format
# print the section and grep for the Executables to find each interpreter
executables=$(
helm template ./charts/rstudio-connect \
--set config.Launcher.Enabled=false \
--show-only templates/configmap.yaml | \
sed -n -e "/\[$lang\]/,/\[*\]/ p" | \
grep Executable | awk -F= '{print $2}' | \
xargs)
for ex in $executables
do
docker run --rm $image /bin/bash -c "command -v $ex"
done
done
push-docs:
#!/usr/bin/env bash
set -euxo pipefail
s3_args=(--dryrun)
if [[ "${GITHUB_REF:-}" == "refs/heads/main" ]] || [[ "${GITHUB_REF:-}" =~ ^refs/tags/v[0-9]{4}\.[0-9]{2}\.[0-9]+$ ]]; then
s3_args=("")
fi
# The s3 bucket is s3://docs.rstudio.com/, which is available as https://docs.posit.co/
aws s3 sync ${s3_args[*]:-} \
_site \
"s3://docs.rstudio.com/helm/"