File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,28 @@ catch() {
3030 exit " ${1} "
3131}
3232
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+
3355main () {
3456 if [ " ${INSTALLER_DRY_RUN} " != " true" ]; then
3557 echo " Gitpod: Killing any in-progress installations"
156178 HELM_TIMEOUT=" 1h"
157179 fi
158180
181+ stop_running_workspaces
182+
159183 # The long timeout is to ensure the TLS cert is created (if required)
160184 echo " Gitpod: Apply the Kubernetes objects with timeout of ${HELM_TIMEOUT} "
161185 helm upgrade \
Original file line number Diff line number Diff line change 3030 containers :
3131 - name : installation-status
3232 # 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 "
3434 envFrom :
3535 - configMapRef :
3636 name : gitpod-kots-config
Original file line number Diff line number Diff line change 3939 containers :
4040 - name : installer
4141 # 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 "
4343 volumeMounts :
4444 - mountPath : /mnt/node0
4545 name : node-fs0
Original file line number Diff line number Diff line change 1313 namespace : ' {{repl Namespace }}'
1414 podSpec :
1515 containers : []
16+ - clusterResources :
17+ namespaces :
18+ - ' {{repl Namespace }}'
1619 - run :
1720 collectorName : database
1821 image : eu.gcr.io/gitpod-core-dev/build/kots-config-check/database:sje-kots-config-check.9
@@ -429,3 +432,14 @@ spec:
429432 message : Registry is accessible
430433 - fail :
431434 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