The commit that runs: in the footer and at /version
Every page's footer names the commit the binary is built from, with a link to it on the forge, and /version answers with the full hash, open without a login like /healthz, so a script can tell which release is live. build.rs writes COMMIT: from VISA_COMMIT, which the flake sets to its source's revision (a Nix build has no .git), else from git in a checkout, else empty. The flake sets it on the package alone, not on the dependencies' build, which so stays cached from commit to commit.
This commit is contained in:
1 parent
a2cedcdd7e
commit
17426dba12
9 files changed
+140
-4
No files matched your search
@@ -34,6 +34,7 @@ async fn the_gate_sends_people_to_the_login(pool: PgPool) {
|
||||
assert_eq!(r.headers["hx-redirect"], "/login?next=/people");
|
||||
// open without a session
|
||||
assert_eq!(app.get("/healthz").await.status, StatusCode::OK);
|
||||
assert_eq!(app.get("/version").await.status, StatusCode::OK);
|
||||
assert_eq!(app.get("/static/app.css").await.status, StatusCode::OK);
|
||||
assert_eq!(app.get("/signed-out").await.status, StatusCode::OK);
|
||||
// the provider has not answered yet
|
||||
|
||||
@@ -216,6 +216,24 @@ async fn open_paths_headers_and_not_found(pool: PgPool) {
|
||||
let app = local(pool);
|
||||
let r = app.get("/healthz").await;
|
||||
assert_eq!((r.status, r.body.as_str()), (StatusCode::OK, "ok"));
|
||||
// the commit that runs, in full; the footer shows its first digits
|
||||
let r = app.get("/version").await;
|
||||
let commit = visa::embedded::COMMIT;
|
||||
let want = if commit.is_empty() { "unknown" } else { commit };
|
||||
assert_eq!(
|
||||
(r.status, r.body.as_str()),
|
||||
(StatusCode::OK, format!("{want}\n").as_str())
|
||||
);
|
||||
assert_eq!(r.headers["cache-control"], "no-store");
|
||||
let short = visa::embedded::short(commit);
|
||||
if !short.is_empty() {
|
||||
let t = app.get("/people").await.text();
|
||||
assert!(
|
||||
t.contains(", commit <a href=\"https://git.b4l.co.th/B4L/visa/commit/"),
|
||||
"{t}"
|
||||
);
|
||||
assert!(t.contains(&format!(">{short}</a>. Every view")), "{t}");
|
||||
}
|
||||
let css = app.get("/static/app.css").await;
|
||||
assert_eq!(css.status, StatusCode::OK);
|
||||
assert_eq!(css.headers["content-type"], "text/css; charset=utf-8");
|
||||
|
||||
Reference in new issue
Block a user