Skip to content

Commit 3914677

Browse files
Furistoroboquat
authored andcommitted
Speed up edit-compile-run loop
1 parent 8a321b5 commit 3914677

File tree

9 files changed

+81
-35
lines changed

9 files changed

+81
-35
lines changed

Diff for: components/blobserve/debug.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -Eeuo pipefail
7+
source /workspace/gitpod/scripts/ws-deploy.sh deployment blobserve

Diff for: components/content-service/debug.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
7+
set -Eeuo pipefail
8+
source /workspace/gitpod/scripts/ws-deploy.sh deployment content-service

Diff for: components/ee/agent-smith/debug.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -Eeuo pipefail
7+
source /workspace/gitpod/scripts/ws-deploy.sh daemonset agent-smith

Diff for: components/image-builder-mk3/debug.sh

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
25

3-
# This script builds the image builder and replaces the current deployment with it.
4-
5-
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
6-
gcloud auth list | grep typefox &>/dev/null || (echo "Login using 'gcloud auth login' for the docker push to work"; exit 1)
7-
8-
9-
readonly tag
10-
tag="dev-$(date +%s)"
11-
leeway build -v .:docker -Dversion="${tag}" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build
12-
devImage="eu.gcr.io/gitpod-core-dev/build/image-builder-mk3:${tag}"
13-
14-
kubectl patch deployment image-builder-mk3 --patch '{"spec": {"template": {"spec": {"containers": [{"name": "image-builder-mk3","imagePullPolicy":"Always","image": "'"$devImage"'"}]}}}}'
15-
kubectl rollout restart deployment/image-builder-mk3
16-
kubectl rollout status -w deployment/image-builder-mk3
17-
# give the old pod time to disappear
18-
sleep 20
19-
gpctl debug logs image-builder-mk3
6+
set -Eeuo pipefail
7+
source /workspace/gitpod/scripts/ws-deploy.sh deployment image-builder-mk3

Diff for: components/registry-facade/debug.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -Eeuo pipefail
7+
source /workspace/gitpod/scripts/ws-deploy.sh daemonset registry-facade

Diff for: components/ws-daemon/debug.sh

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
11
#!/bin/bash
22

3-
# ws-daemon runs as daemonset on each node which renders telepresence useless for debugging.
4-
# This script builds ws-daemon locally, puts it in a Dockerfile, builds the image, pushes it,
5-
# patches the daemonset and restarts all pods.
6-
#
7-
# This way you can test out your changes with a 30 sec turnaround.
8-
#
9-
# BEWARE: the properly built version of ws-daemon may behave differently.
10-
113
set -Eeuo pipefail
12-
13-
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
14-
15-
version=dev-0
16-
leeway build .:docker -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/dev
17-
devImage=eu.gcr.io/gitpod-core-dev/dev/ws-daemon:"$version"
18-
19-
kubectl set image daemonset ws-daemon ws-daemon="$devImage"
20-
kubectl annotate daemonset ws-daemon kubernetes.io/change-cause="$version"
21-
kubectl rollout restart daemonset ws-daemon
4+
source /workspace/gitpod/scripts/ws-deploy.sh daemonset ws-daemon

Diff for: components/ws-manager/debug.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -Eeuo pipefail
7+
8+
source /workspace/gitpod/scripts/ws-deploy.sh deployment ws-manager

Diff for: components/ws-proxy/debug.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
set -Eeuo pipefail
7+
source /workspace/gitpod/scripts/ws-deploy.sh deployment ws-proxy false

Diff for: scripts/ws-deploy.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Copyright (c) 2022 Gitpod GmbH. All rights reserved.
3+
# Licensed under the GNU Affero General Public License (AGPL).
4+
# See License-AGPL.txt in the project root for license information.
5+
6+
# This script builds a workspace component and updates the cluster
7+
8+
set -Eeuo pipefail
9+
10+
resource_type=$1
11+
resource_name=$2
12+
enable_debug=${3:-true}
13+
version="dev-$(date +%F_T"%H-%M-%S")"
14+
dev_image=eu.gcr.io/gitpod-core-dev/dev/$resource_name:"$version"
15+
16+
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
17+
leeway build .:docker -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/dev
18+
19+
kubectl set image "$resource_type" "$resource_name" "$resource_name"="$dev_image"
20+
kubectl rollout restart "$resource_type" "$resource_name"
21+
kubectl annotate "$resource_type" "$resource_name" kubernetes.io/change-cause="$version"
22+
kubectl rollout status -w "$resource_type" "$resource_name"
23+
24+
while kubectl get pods -l component="$resource_name" | grep -q Terminating;
25+
do
26+
echo "Waiting for old pods to terminate"
27+
sleep 3
28+
done
29+
if [[ "$enable_debug" = true ]]; then
30+
gpctl debug logs "$resource_name" > /dev/null
31+
fi

0 commit comments

Comments
 (0)