From 5313bb0103e9a9fc597e544bf60731a9c0d463e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Mon, 7 Apr 2025 12:41:10 +0200 Subject: [PATCH] Zitadel: Fix release tarball crawling (#3716) --- ct/zitadel.sh | 64 +++++++++++++++++++------------------- install/zitadel-install.sh | 4 +-- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/ct/zitadel.sh b/ct/zitadel.sh index 9085dd7fb..2b0b2ef6b 100644 --- a/ct/zitadel.sh +++ b/ct/zitadel.sh @@ -20,39 +20,39 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -f /etc/systemd/system/zitadel.service ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - RELEASE=$(curl -fsSL https://github.com/zitadel/zitadel/releases/latest | grep location: | cut -d '/' -f 8 | tr -d '\r') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt | grep -oP '\d+\.\d+\.\d+')" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then - msg_info "Stopping $APP" - systemctl stop zitadel - msg_ok "Stopped $APP" - - msg_info "Updating $APP to ${RELEASE}" - cd /tmp || exit - curl -fsSL https://github.com/zitadel/zitadel/releases/download/"$RELEASE"/zitadel-linux-amd64.tar.gz | tar -xz - mv zitadel-linux-amd64/zitadel /usr/local/bin - $STD zitadel setup --masterkeyFile /opt/zitadel/.masterkey --config /opt/zitadel/config.yaml --init-projections=true - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP to ${RELEASE}" - - msg_info "Starting $APP" - systemctl start zitadel - msg_ok "Started $APP" - - msg_info "Cleaning Up" - rm -rf /tmp/zitadel-linux-amd64 - msg_ok "Cleanup Completed" - msg_ok "Update Successful" - else - msg_ok "No update required. ${APP} is already at ${RELEASE}" - fi + header_info + check_container_storage + check_container_resources + if [[ ! -f /etc/systemd/system/zitadel.service ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/zitadel/zitadel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt | grep -oP '\d+\.\d+\.\d+')" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop zitadel + msg_ok "Stopped $APP" + + msg_info "Updating $APP to ${RELEASE}" + cd /tmp || exit + curl -fsSL "https://github.com/zitadel/zitadel/releases/download/v$RELEASE/zitadel-linux-amd64.tar.gz" | tar -xz + mv zitadel-linux-amd64/zitadel /usr/local/bin + $STD zitadel setup --masterkeyFile /opt/zitadel/.masterkey --config /opt/zitadel/config.yaml --init-projections=true + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to ${RELEASE}" + + msg_info "Starting $APP" + systemctl start zitadel + msg_ok "Started $APP" + + msg_info "Cleaning Up" + rm -rf /tmp/zitadel-linux-amd64 + msg_ok "Cleanup Completed" + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit } start diff --git a/install/zitadel-install.sh b/install/zitadel-install.sh index 211c43502..9fe6edd6f 100644 --- a/install/zitadel-install.sh +++ b/install/zitadel-install.sh @@ -39,8 +39,8 @@ $STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME OWNER $DB_ADMIN_USER;" msg_ok "Installed PostgreSQL" msg_info "Installing Zitadel" -RELEASE=$(curl -fsSL https://github.com/zitadel/zitadel/releases/latest | grep location: | cut -d '/' -f 8 | tr -d '\r') -curl -fsSL https://github.com/zitadel/zitadel/releases/download/$RELEASE/zitadel-linux-amd64.tar.gz | tar -xz +RELEASE=$(curl -fsSL https://api.github.com/repos/zitadel/zitadel/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +curl -fsSL "https://github.com/zitadel/zitadel/releases/download/v$RELEASE/zitadel-linux-amd64.tar.gz" | tar -xz mv zitadel-linux-amd64/zitadel /usr/local/bin msg_ok "Installed Zitadel"