File tree 4 files changed +40
-2
lines changed
4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,28 @@ catch() {
30
30
exit " ${1} "
31
31
}
32
32
33
+ stop_running_workspaces () {
34
+ echo " Gitpod: shut down any running workspaces/image-builders"
35
+
36
+ # Create a context for gpctl
37
+ kubectl config set-context " ${NAMESPACE} "
38
+ kubectl config use-context " ${NAMESPACE} "
39
+ # gpctl doesn't have a namespace flag
40
+ kubectl config set-context --current --namespace=" ${NAMESPACE} "
41
+
42
+ # Get list of workspace instances from gpctl
43
+ for instance in $( /app/gpctl workspaces list -o json | jq -r ' select(. != null) | .[] | .Instance' ) ; do
44
+ echo " Gitpod: shutting down workspace ${instance} "
45
+ /app/gpctl workspaces stop " ${instance} " || eval " $( echo " Gitpod: retrying shutting down workspace" && \
46
+ sleep 10 && \
47
+ /app/gpctl workspaces stop " ${instance} " ) "
48
+ done
49
+
50
+ # Delete the context
51
+ kubectl config unset " contexts.${NAMESPACE} "
52
+ kubectl config unset current-context
53
+ }
54
+
33
55
main () {
34
56
if [ " ${INSTALLER_DRY_RUN} " != " true" ]; then
35
57
echo " Gitpod: Killing any in-progress installations"
156
178
HELM_TIMEOUT=" 1h"
157
179
fi
158
180
181
+ stop_running_workspaces
182
+
159
183
# The long timeout is to ensure the TLS cert is created (if required)
160
184
echo " Gitpod: Apply the Kubernetes objects with timeout of ${HELM_TIMEOUT} "
161
185
helm upgrade \
Original file line number Diff line number Diff line change 30
30
containers :
31
31
- name : installation-status
32
32
# This will normally be the release tag
33
- image : " eu.gcr.io/gitpod-core-dev/build/installer:tar -installer-env-refactor.2 "
33
+ image : " eu.gcr.io/gitpod-core-dev/build/installer:sje -installer-kill-workspaces.14 "
34
34
envFrom :
35
35
- configMapRef :
36
36
name : gitpod-kots-config
Original file line number Diff line number Diff line change 39
39
containers :
40
40
- name : installer
41
41
# This will normally be the release tag
42
- image : " eu.gcr.io/gitpod-core-dev/build/installer:tar -installer-env-refactor.2 "
42
+ image : " eu.gcr.io/gitpod-core-dev/build/installer:sje -installer-kill-workspaces.14 "
43
43
volumeMounts :
44
44
- mountPath : /mnt/node0
45
45
name : node-fs0
Original file line number Diff line number Diff line change 13
13
namespace : ' {{repl Namespace }}'
14
14
podSpec :
15
15
containers : []
16
+ - clusterResources :
17
+ namespaces :
18
+ - ' {{repl Namespace }}'
16
19
- run :
17
20
collectorName : database
18
21
image : eu.gcr.io/gitpod-core-dev/build/kots-config-check/database:sje-kots-config-check.9
@@ -429,3 +432,14 @@ spec:
429
432
message : Registry is accessible
430
433
- fail :
431
434
message : Registry is inaccessible. Please check your network and firewall settings
435
+ - textAnalyze :
436
+ checkName : Check running workspaces
437
+ fileName : cluster-resources/pods/{{repl Namespace }}.json
438
+ regex : ' "component": "workspace"'
439
+ outcomes :
440
+ - pass :
441
+ when : " false"
442
+ message : No running workspaces. Any workspaces started during the deployment process will be stopped.
443
+ - fail :
444
+ when : " true"
445
+ message : There are running workspaces. These will be stopped during the deployment process.
You can’t perform that action at this time.
0 commit comments