Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ide/jetbrains/backend-plugin/hot-deploy.sh
2500 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 the backend plugin and updates the IDE config map.
9
10
qualifier=${1:-latest}
11
echo "Plugin Qualifier: $qualifier"
12
13
# TODO(AK) optimize to produce a new version only if plugin was rebuilt
14
version="dev-jb-backend-plugin-$(date +%F_T"%H-%M-%S")"
15
echo "Image Version: $version"
16
17
bldfn="/tmp/build-$version.tar.gz"
18
19
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
20
leeway build -DnoVerifyJBPlugin=true -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-dev-artifact/build .:"$qualifier" --save "$bldfn"
21
dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"
22
echo "Dev Image: $dev_image"
23
24
ide_list=("intellij" "goland" "pycharm" "phpstorm" "rubymine" "webstorm" "rider" "clion" "rustrover")
25
26
if [ "$qualifier" == "stable" ]; then
27
prop_list=("pluginImage" "imageLayers[0]")
28
else
29
prop_list=("pluginLatestImage" "latestImageLayers[0]")
30
fi
31
32
cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)
33
34
for ide in "${ide_list[@]}"; do
35
for prop in "${prop_list[@]}"; do
36
cf_patch=$(echo "$cf_patch" | jq ".ideOptions.options.$ide.$prop = \"$dev_image\"")
37
done
38
done
39
40
cf_patch=$(echo "$cf_patch" |jq tostring)
41
cf_patch="{\"data\": {\"config.json\": $cf_patch}}"
42
43
kubectl patch cm ide-config --type=merge -p "$cf_patch"
44
45
kubectl rollout restart deployment ide-service
46
kubectl rollout restart deployment server
47
48