Path: blob/main/components/image-builder-bob/hot-deploy.sh
2492 views
#!/bin/bash1# Copyright (c) 2024 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 image-builder-bob, patches the image-builder-mk3 configmap to use the new bob, and restarts image-builder-mk31415version="dev-$(date +%F_T"%H-%M-%S")"16echo "Image Version: $version"1718bldfn="/tmp/build-$version.tar.gz"1920docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)21leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build .:docker --save "$bldfn"22dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"23echo "Dev Image: $dev_image"242526cf_patch=$(kubectl get cm image-builder-mk3-config -o=json | jq '.data."image-builder.json"' |jq -r)27cf_patch=$(echo "$cf_patch" |jq ".orchestrator.builderImage = \"$dev_image\"")28cf_patch=$(echo "$cf_patch" |jq tostring)29cf_patch="{\"data\": {\"image-builder.json\": $cf_patch}}"3031kubectl patch cm image-builder-mk3-config --type=merge -p "$cf_patch"3233kubectl rollout restart deployment image-builder-mk3343536