Path: blob/main/components/ide/jetbrains/backend-plugin/hot-deploy.sh
2500 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 the backend plugin and updates the IDE config map.89qualifier=${1:-latest}10echo "Plugin Qualifier: $qualifier"1112# TODO(AK) optimize to produce a new version only if plugin was rebuilt13version="dev-jb-backend-plugin-$(date +%F_T"%H-%M-%S")"14echo "Image Version: $version"1516bldfn="/tmp/build-$version.tar.gz"1718docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)19leeway build -DnoVerifyJBPlugin=true -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-dev-artifact/build .:"$qualifier" --save "$bldfn"20dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"21echo "Dev Image: $dev_image"2223ide_list=("intellij" "goland" "pycharm" "phpstorm" "rubymine" "webstorm" "rider" "clion" "rustrover")2425if [ "$qualifier" == "stable" ]; then26prop_list=("pluginImage" "imageLayers[0]")27else28prop_list=("pluginLatestImage" "latestImageLayers[0]")29fi3031cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)3233for ide in "${ide_list[@]}"; do34for prop in "${prop_list[@]}"; do35cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"$dev_image\"")36done37done3839cf_patch=$(echo "$cf_patch" |jq tostring)40cf_patch="{\"data\": {\"config.json\": $cf_patch}}"4142kubectl patch cm ide-config --type=merge -p "$cf_patch"4344kubectl rollout restart deployment ide-service45kubectl rollout restart deployment server464748