Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ide/jetbrains/launcher/hot-deploy.sh
2501 views
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
# This script builds jb-launcher and updates the IDE config map.
9
10
# TODO(AK) optimize to produce a new version only if launcher was rebuilt
11
version="dev-jb-launcher-$(date +%F_T"%H-%M-%S")"
12
echo "Image Version: $version"
13
14
bldfn="/tmp/build-$version.tar.gz"
15
16
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
17
leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-dev-artifact/build .:docker --save "$bldfn"
18
dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"
19
echo "Dev Image: $dev_image"
20
21
cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)
22
ides=$(echo "$cf_patch" |jq '.ideOptions.clients."jetbrains-gateway".desktopIDEs')
23
for ide in $(echo "$ides" | jq -r '.[]'); do
24
# second image is always jb-launcher, if position is changed then this script should be updated as well
25
cf_patch=$(echo "$cf_patch" |jq ".ideOptions.options.${ide}.imageLayers[1] = \"$dev_image\"")
26
cf_patch=$(echo "$cf_patch" |jq ".ideOptions.options.${ide}.latestImageLayers[1] = \"$dev_image\"")
27
done
28
29
cf_patch=$(echo "$cf_patch" |jq tostring)
30
cf_patch="{\"data\": {\"config.json\": $cf_patch}}"
31
32
kubectl patch cm ide-config --type=merge -p "$cf_patch"
33
34
kubectl rollout restart deployment ide-service
35
36