feat(cli): Get git version
Signed-off-by: rjshrjndrn <rjshrjndrn@gmail.com>
This commit is contained in:
parent
8e39a72ea0
commit
7b2e80d2a6
1 changed files with 16 additions and 1 deletions
|
|
@ -170,6 +170,7 @@ function status() {
|
||||||
log info OpenReplay Version
|
log info OpenReplay Version
|
||||||
# awk '(NR<2)' < "$OR_DIR/vars.yaml"
|
# awk '(NR<2)' < "$OR_DIR/vars.yaml"
|
||||||
awk '/fromVersion/{print $2}' <"${OR_DIR}/vars.yaml"
|
awk '/fromVersion/{print $2}' <"${OR_DIR}/vars.yaml"
|
||||||
|
yq .config.version /var/lib/openreplay/vars.yaml || true
|
||||||
log info Disk
|
log info Disk
|
||||||
df -h /var
|
df -h /var
|
||||||
log info Memory
|
log info Memory
|
||||||
|
|
@ -369,7 +370,9 @@ function upgrade() {
|
||||||
|
|
||||||
# Update the version
|
# Update the version
|
||||||
busybox sed -i "s/fromVersion.*/fromVersion: ${or_new_version}/" vars.yaml
|
busybox sed -i "s/fromVersion.*/fromVersion: ${or_new_version}/" vars.yaml
|
||||||
sudo mv ./openreplay-cli /bin/
|
patch_version
|
||||||
|
sudo mv ./openreplay-cli /bin/openreplay
|
||||||
|
sudo chmod +x /bin/openreplay
|
||||||
sudo mv ./vars.yaml "$OR_DIR"
|
sudo mv ./vars.yaml "$OR_DIR"
|
||||||
sudo cp -rf ../../../openreplay $OR_DIR/
|
sudo cp -rf ../../../openreplay $OR_DIR/
|
||||||
log info "Configuration file is saved in /var/lib/openreplay/vars.yaml"
|
log info "Configuration file is saved in /var/lib/openreplay/vars.yaml"
|
||||||
|
|
@ -379,6 +382,18 @@ function upgrade() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function patch_version() {
|
||||||
|
# Patching config version for console
|
||||||
|
version=$(/var/lib/openreplay/yq '.fromVersion' /var/lib/openreplay/vars.yaml)-$(sudo git rev-parse --short HEAD)
|
||||||
|
# Create a temporary YAML file with the generated version
|
||||||
|
cat <<EOF >/tmp/version_snippet.yaml
|
||||||
|
config:
|
||||||
|
version: $version
|
||||||
|
EOF
|
||||||
|
sudo /var/lib/openreplay/yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' vars.yaml /tmp/version_snippet.yaml -i
|
||||||
|
rm /tmp/version_snippet.yaml
|
||||||
|
}
|
||||||
|
|
||||||
function reload() {
|
function reload() {
|
||||||
err_cd $OR_DIR/openreplay/scripts/helmcharts
|
err_cd $OR_DIR/openreplay/scripts/helmcharts
|
||||||
sudo cp -f $OR_DIR/vars.yaml .
|
sudo cp -f $OR_DIR/vars.yaml .
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue