Skip to content

Commit 4d810bf

Browse files
committed
Merge remote-tracking branch 'origin/master' into feat/shared-api-auth
# Conflicts: # dstack/Cargo.lock # dstack/Cargo.toml # dstack/vmm/Cargo.toml
2 parents 4897fde + 49723e4 commit 4d810bf

15 files changed

Lines changed: 84 additions & 44 deletions

File tree

dstack/Cargo.lock

Lines changed: 12 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dstack/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ members = [
6767
"crates/dstackup",
6868
"crates/dstack-auth",
6969
"crates/api-auth",
70+
"crates/build-info",
7071
]
7172
resolver = "2"
7273

@@ -80,6 +81,7 @@ dstack-guest-agent-rpc = { path = "guest-agent/rpc" }
8081
dstack-vmm-rpc = { path = "vmm/rpc" }
8182
dstack-cli-core = { path = "crates/dstack-cli-core" }
8283
dstack-api-auth = { path = "crates/api-auth" }
84+
dstack-build-info = { path = "crates/build-info" }
8385
cc-eventlog = { path = "cc-eventlog" }
8486
supervisor = { path = "supervisor" }
8587
supervisor-client = { path = "supervisor/client" }
@@ -124,7 +126,6 @@ fs-err = "3.1.0"
124126
fuser = "0.16.0"
125127
path-absolutize = "3.1.1"
126128
futures = "0.3.31"
127-
git-version = "0.3.9"
128129
libc = "0.2.171"
129130
log = "0.4.26"
130131
moka = { version = "0.12.15", default-features = false, features = ["sync"] }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
[package]
6+
name = "dstack-build-info"
7+
version.workspace = true
8+
authors.workspace = true
9+
edition.workspace = true
10+
license.workspace = true
11+
12+
[dependencies]
13+
git-version = "0.3.9"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
//! Common compile-time build information for dstack binaries.
6+
7+
#[doc(hidden)]
8+
pub use git_version::git_version as __git_version;
9+
10+
/// Returns the current Git commit as `git:<hash>`.
11+
///
12+
/// Tags are deliberately excluded because dstack is a monorepo containing
13+
/// component-specific tags. Letting `git describe` select the nearest tag can
14+
/// therefore report an unrelated component's version.
15+
#[macro_export]
16+
macro_rules! git_revision {
17+
() => {
18+
$crate::__git_version!(
19+
args = [
20+
"--abbrev=20",
21+
"--always",
22+
"--dirty=-modified",
23+
"--exclude=*"
24+
],
25+
prefix = "git:",
26+
fallback = "unknown"
27+
)
28+
};
29+
}
30+
31+
/// Returns the calling package's version and Git revision for display.
32+
///
33+
/// The result has the form `v0.6.0 (git:0123456789abcdef0123)`. This is a
34+
/// macro so `CARGO_PKG_VERSION` is evaluated for the calling package rather
35+
/// than for `dstack-build-info` itself.
36+
#[macro_export]
37+
macro_rules! app_version {
38+
() => {
39+
format!(
40+
"v{} ({})",
41+
env!("CARGO_PKG_VERSION"),
42+
$crate::git_revision!()
43+
)
44+
};
45+
}

dstack/gateway/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ hickory-resolver.workspace = true
3030
pin-project.workspace = true
3131
serde_json.workspace = true
3232
rand.workspace = true
33-
git-version.workspace = true
33+
dstack-build-info.workspace = true
3434
ra-rpc = { workspace = true, features = ["client", "rocket"] }
3535
dstack-gateway-rpc.workspace = true
3636
certbot.workspace = true

dstack/gateway/src/main.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,7 @@ struct DebugKeyData {
5353
static ALLOCATOR: jemallocator::Jemalloc = jemallocator::Jemalloc;
5454

5555
fn app_version() -> String {
56-
const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
57-
const VERSION: &str = git_version::git_version!(
58-
args = ["--abbrev=20", "--always", "--dirty=-modified"],
59-
prefix = "git:",
60-
fallback = "unknown"
61-
);
62-
format!("v{CARGO_PKG_VERSION} ({VERSION})")
56+
dstack_build_info::app_version!()
6357
}
6458

6559
#[derive(Parser)]

dstack/guest-agent/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bollard.workspace = true
2626
chrono.workspace = true
2727
base64.workspace = true
2828
rinja.workspace = true
29-
git-version.workspace = true
29+
dstack-build-info.workspace = true
3030
ra-rpc = { workspace = true, features = ["client", "rocket"] }
3131
dstack-guest-agent-rpc.workspace = true
3232
ra-tls = { workspace = true, features = ["quote"] }

dstack/guest-agent/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
6-
pub const GIT_REV: &str = git_version::git_version!(
7-
args = ["--abbrev=20", "--always", "--dirty=-modified"],
8-
prefix = "git:",
9-
fallback = "unknown"
10-
);
6+
pub const GIT_REV: &str = dstack_build_info::git_revision!();
117

128
pub mod backend;
139
pub mod config;

dstack/guest-agent/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use tokio::sync::oneshot;
2222
use tracing::{error, info};
2323

2424
pub fn app_version() -> String {
25-
format!("v{} ({})", crate::CARGO_PKG_VERSION, crate::GIT_REV)
25+
dstack_build_info::app_version!()
2626
}
2727

2828
async fn run_internal_v0(

dstack/kms/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ anyhow.workspace = true
1414
chrono.workspace = true
1515
clap.workspace = true
1616
fs-err.workspace = true
17-
git-version.workspace = true
17+
dstack-build-info.workspace = true
1818
hex.workspace = true
1919
hex_fmt.workspace = true
2020
rocket.workspace = true

0 commit comments

Comments
 (0)