MCPcopy Create free account
hub / github.com/Qovery/engine / parse_deployed_engine_version

Function parse_deployed_engine_version

app/src/utils.rs:84–102  ·  view source on GitHub ↗
(
    runtime_engine_version: Option<&str>,
    build_version_fallback: &str,
    shadow_commit_fallback: &str,
)

Source from the content-addressed store, hash-verified

82}
83
84fn parse_deployed_engine_version(
85 runtime_engine_version: Option<&str>,
86 build_version_fallback: &str,
87 shadow_commit_fallback: &str,
88) -> DeployedEngineVersion {
89 if let Some(runtime_engine_version) = runtime_engine_version.map(str::trim).filter(|value| !value.is_empty()) {
90 return runtime_engine_version
91 .parse::<DeployedEngineVersion>()
92 .expect("ENGINE_TAG_VERSION must be a valid version or commit id");
93 }
94
95 parse_candidate_deployed_engine_version(build_version_fallback)
96 .or_else(|| parse_candidate_deployed_engine_version(shadow_commit_fallback))
97 .unwrap_or_else(|| {
98 LOCAL_DEPLOYED_ENGINE_VERSION
99 .parse::<DeployedEngineVersion>()
100 .expect("local deployed engine version fallback must stay valid")
101 })
102}
103
104/// Returns the deployed engine version from `ENGINE_TAG_VERSION` when it is set to a non-empty
105/// value, otherwise falls back to the build-time version embedded in the binary, then to the