Include channel and commit info in the version of pre-release builds (#6819)
This commit is contained in:
@ -5,6 +5,24 @@
|
||||
//! command-line tools to spin up validators and a Rust library
|
||||
//!
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! version {
|
||||
() => {
|
||||
&*format!(
|
||||
"{}{}",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
if option_env!("CI_TAG").is_none() {
|
||||
format!(
|
||||
" [channel={} commit={}]",
|
||||
option_env!("CHANNEL").unwrap_or("unknown"),
|
||||
option_env!("CI_COMMIT").unwrap_or("unknown"),
|
||||
)
|
||||
} else {
|
||||
"".to_string()
|
||||
},
|
||||
)
|
||||
};
|
||||
}
|
||||
pub mod banking_stage;
|
||||
pub mod blob;
|
||||
pub mod broadcast_stage;
|
||||
@ -57,7 +75,6 @@ pub mod streamer;
|
||||
pub mod tpu;
|
||||
pub mod tvu;
|
||||
pub mod validator;
|
||||
pub(crate) mod version;
|
||||
pub mod weighted_shuffle;
|
||||
pub mod window_service;
|
||||
|
||||
|
@ -7,7 +7,6 @@ use crate::{
|
||||
packet::PACKET_DATA_SIZE,
|
||||
storage_stage::StorageState,
|
||||
validator::ValidatorExit,
|
||||
version::VERSION,
|
||||
};
|
||||
use bincode::serialize;
|
||||
use jsonrpc_core::{Error, Metadata, Result};
|
||||
@ -922,7 +921,7 @@ impl RpcSol for RpcSolImpl {
|
||||
|
||||
fn get_version(&self, _: Self::Metadata) -> Result<RpcVersionInfo> {
|
||||
Ok(RpcVersionInfo {
|
||||
solana_core: VERSION.to_string(),
|
||||
solana_core: crate::version!().to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
@ -1591,7 +1590,7 @@ pub mod tests {
|
||||
let expected = json!({
|
||||
"jsonrpc": "2.0",
|
||||
"result": {
|
||||
"solana-core": VERSION
|
||||
"solana-core": crate::version!().to_string()
|
||||
},
|
||||
"id": 1
|
||||
});
|
||||
|
@ -1 +0,0 @@
|
||||
pub(crate) const VERSION: &str = env!("CARGO_PKG_VERSION");
|
Reference in New Issue
Block a user