ncp-check-version: Add check for staged rollouts

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2023-09-27 13:02:41 +02:00
parent 27fa01299d
commit 46d33f7698
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
4 changed files with 42 additions and 0 deletions

View File

@ -15,6 +15,18 @@ git clone -b "$BRANCH" --depth 20 -q --bare https://github.com/nextcloud/nextclo
cd "$TMPDIR" || exit 1
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
[[ -f "/usr/local/etc/instance.cfg" ]] && {
cohorte_id="$(jq .cohorteId /usr/local/etc/instance.cfg)"
[[ -f "./staged_rollouts/${VER}.txt" ]] && {
grep "^${cohorte_id}$" "./staged_rollouts/${VER}.txt" || {
echo "Skipping version $VER - cohorte ${cohorte_id} not yet active"
cd / || exit 1
exit 0
}
}
}
grep -qP "v\d+\.\d+\.\d+" <<< "$VER" && { # check format
echo "$VER" > /var/run/.ncp-latest-version

View File

@ -72,4 +72,15 @@ if needs_decrypt; then
apache2ctl -k graceful
fi
[[ -f /usr/local/etc/instance.cfg ]] || {
cohorte_id=$((1 + RANDOM % 100))
cat > /usr/local/etc/instance.cfg <<EOF
{
"cohorteId": ${cohorte_id},
"canary": false
}
EOF
}
exit 0

View File

@ -84,6 +84,14 @@ rm /.ncp-image
cd -
rm -rf "${TMPDIR}"
cohorte_id=$((RANDOM % 100))
cat <<EOF > /usr/local/etc/instance.cfg
{
"cohorteId": ${cohorte_id},
"canary": false
}
EOF
IP="$(get_ip)"
echo "Done.

11
updates/1.52.5.sh Normal file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
[[ -f /usr/local/etc/instance.cfg ]] || {
cohorte_id=$((RANDOM % 100))
cat > /usr/local/etc/instance.cfg <<EOF
{
"cohorteId": ${cohorte_id},
"canary": false
}
EOF
}