forked from keycloak/keycloak-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset-version.sh
More file actions
executable file
·18 lines (15 loc) · 862 Bytes
/
set-version.sh
File metadata and controls
executable file
·18 lines (15 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash -ex
# Implemented to deal with patterns such Version = "x.y.z"
# An additional advantage of this approach is that it preserves formatting
# (which is desirable when working with Go)
function replace_value_in_file() {
local string_to_be_replaced=$1
local replacement=$2
local file=$3
local quote=${4:-}
sed -i "s/\($string_to_be_replaced\)\(.*\).*/\1${quote}${replacement}${quote}/" $file
}
replace_value_in_file ".*Version = " "$1" "version/version.go" "\""
replace_value_in_file ".*DefaultKeycloakImage.*= " "quay.io\/keycloak\/keycloak:$1-legacy" "pkg/model/image_manager.go" "\""
replace_value_in_file ".*image: " "quay.io\/keycloak\/keycloak-operator:$1-legacy" "deploy/operator.yaml"
replace_value_in_file ".*DefaultKeycloakInitContainer.*= " "quay.io\/keycloak\/keycloak-init-container:$1-legacy" "pkg/model/image_manager.go" "\""