Path: blob/main/components/ide/jetbrains/image/hot-deploy.sh
2499 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# Login in GCloud to reuse remote caches8ROOT_DIR="$(dirname "$0")/../../../.."910source "$ROOT_DIR/dev/preview/workflow/lib/ensure-gcloud-auth.sh"11ensure_gcloud_auth1213# This script builds the backend JB ide image and updates the IDE config map.1415product=${1:-intellij}16echo "Product: $product"1718qualifier=${2:-latest}19echo "Qualifier: $qualifier"2021product_code=${3}22echo "Product Code: $product_code"2324if [ "$qualifier" == "stable" ]; then25component=$product26else27component=$product-$qualifier28fi2930version="dev-$component-image-$(date +%F_T"%H-%M-%S")"31echo "Image Version: $version"3233bldfn="/tmp/build-$version.tar.gz"3435docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)36IDE_VERSIONS_JSON=$(bash "$ROOT_DIR/components/ide/jetbrains/image/resolve-latest-ide-version.sh" "$product_code")37IDE_BUILD_VERSION=$(echo "$IDE_VERSIONS_JSON" | jq -r .IDE_BUILD_VERSION)38IDE_VERSION=$(echo "$IDE_VERSIONS_JSON" | jq -r .IDE_VERSION)39leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-dev-artifact/build -DbuildNumber="$IDE_BUILD_VERSION" -DjbBackendVersion="$IDE_VERSION" ".:$component" --save "$bldfn"40dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"41echo "Dev Image: $dev_image"4243if [ "$qualifier" == "stable" ]; then44prop="image"45else46prop="latestImage"47fi4849cf_patch=$(kubectl get cm ide-config -o=json | jq '.data."config.json"' |jq -r)50cf_patch=$(echo "$cf_patch" |jq ".ideOptions.options.$product.$prop = \"$dev_image\"")51cf_patch=$(echo "$cf_patch" |jq tostring)52cf_patch="{\"data\": {\"config.json\": $cf_patch}}"5354kubectl patch cm ide-config --type=merge -p "$cf_patch"5556kubectl rollout restart deployment ide-service575859