Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/image-builder-bob/hot-deploy.sh
2492 views
1
#!/bin/bash
2
# Copyright (c) 2024 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
# Login in GCloud to reuse remote caches
9
ROOT_DIR="$(dirname "$0")/../.."
10
11
source "$ROOT_DIR/dev/preview/workflow/lib/ensure-gcloud-auth.sh"
12
ensure_gcloud_auth
13
14
# This script builds the image-builder-bob, patches the image-builder-mk3 configmap to use the new bob, and restarts image-builder-mk3
15
16
version="dev-$(date +%F_T"%H-%M-%S")"
17
echo "Image Version: $version"
18
19
bldfn="/tmp/build-$version.tar.gz"
20
21
docker ps &> /dev/null || (echo "You need a working Docker daemon. Maybe set DOCKER_HOST?"; exit 1)
22
leeway build -Dversion="$version" -DimageRepoBase=eu.gcr.io/gitpod-core-dev/build .:docker --save "$bldfn"
23
dev_image="$(tar xfO "$bldfn" ./imgnames.txt | head -n1)"
24
echo "Dev Image: $dev_image"
25
26
27
cf_patch=$(kubectl get cm image-builder-mk3-config -o=json | jq '.data."image-builder.json"' |jq -r)
28
cf_patch=$(echo "$cf_patch" |jq ".orchestrator.builderImage = \"$dev_image\"")
29
cf_patch=$(echo "$cf_patch" |jq tostring)
30
cf_patch="{\"data\": {\"image-builder.json\": $cf_patch}}"
31
32
kubectl patch cm image-builder-mk3-config --type=merge -p "$cf_patch"
33
34
kubectl rollout restart deployment image-builder-mk3
35
36