Merge pull request 'Check version in visualizations.sh' (#188) from fix-visualizations into main

Reviewed-on: #188
This commit is contained in:
Reynir Björnsson 2024-03-25 15:56:04 +00:00
commit b96c3a0479
3 changed files with 14 additions and 1 deletions

View file

@ -4,7 +4,8 @@ open Caqti_request.Infix
let application_id = 1234839235l
(* Please update this when making changes! *)
(* Please update this when making changes! And also update
packaging/batch-viz.sh and packaging/visualizations.sh. *)
let current_version = 18L
type 'a id = 'a Rep.id

View file

@ -77,6 +77,8 @@ done
DB="${DATA_DIR}/builder.sqlite3"
[ ! -e "$DB" ] && die "The database doesn't exist: '$DB'"
# Let's be somewhat lenient with the database version.
# In visualizations.sh we can be more strict.
DB_VERSION="$(sqlite3 "$DB" "PRAGMA user_version;")"
[ -z "$DB_VERSION" ] && die "Couldn't read database version from '$DB'"
[ "$DB_VERSION" -lt 16 ] && die "The database version should be >= 16. It is '$DB_VERSION'"

View file

@ -74,6 +74,16 @@ info "processing UUID '${UUID}'"
DB="${DATA_DIR}/builder.sqlite3"
# A new visualizations.sh script may be installed during an upgrade while the
# old builder-web binary is running. In that case things can get out of sync.
DB_VERSION="$(sqlite3 "$DB" "PRAGMA user_version;")"
[ -z "$DB_VERSION" ] && die "Couldn't read database version from '$DB'"
[ "$DB_VERSION" -ne 18 ] && die "The database version should be 18. It is '$DB_VERSION'"
APP_ID="$(sqlite3 "$DB" "PRAGMA application_id;")"
[ -z "$APP_ID" ] && die "Couldn't read application-id from '$DB'"
[ "$APP_ID" -ne 1234839235 ] && die "The application-id should be 1234839235. It is '$APP_ID'"
get_main_binary () {
sqlite3 "${DB}" "SELECT '_artifacts/' || substr(lower(hex(ba.sha256)), 1, 2) || '/' || lower(hex(ba.sha256))
FROM build AS b