Path: blob/main/components/ide/jetbrains/launcher/hot-deploy.sh
2501 views
#!/bin/bash1# Copyright (c) 2022 Gitpod GmbH. All rights reserved.2# Licensed under the GNU Affero General Public License (AGPL).3# See License.AGPL.txt in the project root for license information.45set -Eeuo pipefail67# This script builds jb-launcher and updates the IDE config map.89# TODO(AK) optimize to produce a new version only if launcher was rebuilt10version="dev-jb-launcher-$(date +%F_T"%H-%M-%S")"11echo "Image Version: $version"1213bldfn="/tmp/build-$version.tar.gz"1415docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)16leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-dev-artifact/build .:docker --save "$bldfn"17dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"18echo "Dev Image: $dev_image"1920cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)21ides=$(echo "$cf_patch" |jq '.ideOptions.clients."jetbrains-gateway".desktopIDEs')22for ide in $(echo "$ides" | jq -r '.[]'); do23# second image is always jb-launcher, if position is changed then this script should be updated as well24cf_patch=$(echo "$cf_patch" |jq ".ideOptions.options.${ide}.imageLayers[1] = \"$dev_image\"")25cf_patch=$(echo "$cf_patch" |jq ".ideOptions.options.${ide}.latestImageLayers[1] = \"$dev_image\"")26done2728cf_patch=$(echo "$cf_patch" |jq tostring)29cf_patch="{\"data\": {\"config.json\": $cf_patch}}"3031kubectl patch cm ide-config --type=merge -p "$cf_patch"3233kubectl rollout restart deployment ide-service343536