devzone 0.48.1 → 0.48.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -127,8 +127,13 @@ GitOps repository of devzone, written by the devzone commands (never by hand): t
|
|
|
127
127
|
gitops_blob() { git hash-object "$1" 2>/dev/null || true; }
|
|
128
128
|
|
|
129
129
|
gitops_sha() {
|
|
130
|
+
local out
|
|
130
131
|
if gitops_is_gitlab; then gitlab_gitops_sha "$@"; return; fi
|
|
131
|
-
|
|
132
|
+
# A missing file answers 404 with its error body on stdout: never taken
|
|
133
|
+
# for a sha, or a removal would DELETE what is not there (#625)
|
|
134
|
+
out="$(gh api "repos/$(gitops_slug)/contents/$1" --jq .sha 2>/dev/null)" || out=""
|
|
135
|
+
case "$out" in '' | *[!0-9a-f]*) out="" ;; esac
|
|
136
|
+
printf '%s' "$out"
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
# Writes <file> at <path> of the repository (create or update), <message>
|
|
@@ -125,7 +125,8 @@ services_application_delete() {
|
|
|
125
125
|
|
|
126
126
|
# Every service of the list applied or released: on → namespace, secret and
|
|
127
127
|
# Application; off → Application removed (namespace and volumes kept); not
|
|
128
|
-
# declared: untouched. One failing service does not stop the others
|
|
128
|
+
# declared: untouched. One failing service does not stop the others; a step
|
|
129
|
+
# prints its ✔ only when it succeeded and its ✖ names the service and the step
|
|
129
130
|
services_reconcile() {
|
|
130
131
|
local svc state code=0
|
|
131
132
|
for svc in $SERVICES_LIST; do
|
|
@@ -134,18 +135,35 @@ services_reconcile() {
|
|
|
134
135
|
on)
|
|
135
136
|
# Before the namespace and the secret: a misnamed chart applies nothing
|
|
136
137
|
chart_require "$svc" || { code=2; continue; }
|
|
137
|
-
services_namespace_prepare "$svc" ||
|
|
138
|
+
services_namespace_prepare "$svc" || {
|
|
139
|
+
echo "✖ $svc: namespace step failed" >&2
|
|
140
|
+
code=1
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
138
143
|
if command -v "services_secret_$svc" >/dev/null 2>&1; then
|
|
139
|
-
"services_secret_$svc" ||
|
|
144
|
+
"services_secret_$svc" || {
|
|
145
|
+
echo "✖ $svc: secret step failed" >&2
|
|
146
|
+
code=1
|
|
147
|
+
continue
|
|
148
|
+
}
|
|
140
149
|
else
|
|
141
150
|
echo "✖ no secret hook for $svc (services_secret_$svc): the sync will fail" >&2
|
|
142
151
|
code=1
|
|
152
|
+
continue
|
|
143
153
|
fi
|
|
144
|
-
services_application_apply "$svc" ||
|
|
154
|
+
services_application_apply "$svc" || {
|
|
155
|
+
echo "✖ $svc: declare step failed" >&2
|
|
156
|
+
code=1
|
|
157
|
+
continue
|
|
158
|
+
}
|
|
145
159
|
echo "✔ Application $(services_app_of "$svc") declared (chart charts/devzone-$svc)"
|
|
146
160
|
;;
|
|
147
161
|
off)
|
|
148
|
-
services_application_delete "$svc" ||
|
|
162
|
+
services_application_delete "$svc" || {
|
|
163
|
+
echo "✖ $svc: remove step failed" >&2
|
|
164
|
+
code=1
|
|
165
|
+
continue
|
|
166
|
+
}
|
|
149
167
|
echo "✔ Application $(services_app_of "$svc") removed (namespace and volumes kept)"
|
|
150
168
|
;;
|
|
151
169
|
esac
|
|
@@ -85,13 +85,13 @@ services_argocd_toggle() {
|
|
|
85
85
|
chart_require "$svc" || return $?
|
|
86
86
|
echo "▶ $svc as an Argo CD Application (charts/devzone-$svc at $(argocd_revision))…"
|
|
87
87
|
services_note "$svc" on
|
|
88
|
-
services_reconcile
|
|
88
|
+
services_reconcile || return $?
|
|
89
89
|
echo "✔ Application devzone-$svc declared ([services] $svc = on in $ARGOCD_CONF); status: devzone workspace argocd status; local access: devzone workspace ports"
|
|
90
90
|
;;
|
|
91
91
|
disable)
|
|
92
92
|
yes="$(yes_flag "services disable $svc [--yes]" "$@")" || return 1
|
|
93
93
|
services_note "$svc" off
|
|
94
|
-
services_reconcile
|
|
94
|
+
services_reconcile || return $?
|
|
95
95
|
if [ "$yes" = 1 ]; then
|
|
96
96
|
ak delete namespace "devzone-$svc" --wait=true --ignore-not-found >/dev/null
|
|
97
97
|
case "$svc" in
|