Build and serve signed Linux ARM64 agent releases
This commit is contained in:
@@ -42,7 +42,7 @@ fn fixture(platform: Platform, full: bool) -> serde_json::Value {
|
||||
signature: URL_SAFE_NO_PAD.encode([1_u8; 64]),
|
||||
};
|
||||
let transition = match platform {
|
||||
Platform::LinuxX64 if full => PeerPinTransition::LinuxGeneralFullV1 {
|
||||
Platform::LinuxX64 | Platform::LinuxArm64 if full => PeerPinTransition::LinuxGeneralFullV1 {
|
||||
general_pin_sha256: "10".repeat(32),
|
||||
full: LinuxFullTransition {
|
||||
schema_version: 1,
|
||||
@@ -57,7 +57,7 @@ fn fixture(platform: Platform, full: bool) -> serde_json::Value {
|
||||
effective_signing_key_id: "17".repeat(32),
|
||||
},
|
||||
},
|
||||
Platform::LinuxX64 => PeerPinTransition::UnchangedGeneralPinV1 {
|
||||
Platform::LinuxX64 | Platform::LinuxArm64 => PeerPinTransition::UnchangedGeneralPinV1 {
|
||||
general_pin_sha256: "10".repeat(32),
|
||||
},
|
||||
Platform::WindowsX64 | Platform::WindowsGnuX64 => PeerPinTransition::WindowsCodePairV1 {
|
||||
@@ -110,7 +110,7 @@ fn fixture(platform: Platform, full: bool) -> serde_json::Value {
|
||||
update: Box::new(update),
|
||||
},
|
||||
execution_identity: match platform {
|
||||
Platform::LinuxX64 => "root",
|
||||
Platform::LinuxX64 | Platform::LinuxArm64 => "root",
|
||||
Platform::WindowsX64 | Platform::WindowsGnuX64 => "system",
|
||||
}
|
||||
.into(),
|
||||
|
||||
@@ -50,11 +50,34 @@ impl UpdateKeyringFile {
|
||||
pub enum Platform {
|
||||
#[serde(rename = "x86_64-unknown-linux-gnu")]
|
||||
LinuxX64,
|
||||
#[serde(rename = "aarch64-unknown-linux-gnu")]
|
||||
LinuxArm64,
|
||||
#[serde(rename = "x86_64-pc-windows-msvc")]
|
||||
WindowsX64,
|
||||
#[serde(rename = "x86_64-pc-windows-gnu")]
|
||||
WindowsGnuX64,
|
||||
}
|
||||
pub const LINUX_ARM64_RELEASE_CAPABILITY: &str = "agent.release.linux.arm64/1";
|
||||
|
||||
impl Platform {
|
||||
#[cfg(all(target_os = "linux", target_arch = "aarch64"))]
|
||||
pub const NATIVE_LINUX: Self = Self::LinuxArm64;
|
||||
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
|
||||
pub const NATIVE_LINUX: Self = Self::LinuxX64;
|
||||
|
||||
pub const fn is_linux(self) -> bool {
|
||||
matches!(self, Self::LinuxX64 | Self::LinuxArm64)
|
||||
}
|
||||
|
||||
pub const fn target_triple(self) -> &'static str {
|
||||
match self {
|
||||
Self::LinuxX64 => "x86_64-unknown-linux-gnu",
|
||||
Self::LinuxArm64 => "aarch64-unknown-linux-gnu",
|
||||
Self::WindowsX64 => "x86_64-pc-windows-msvc",
|
||||
Self::WindowsGnuX64 => "x86_64-pc-windows-gnu",
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ArtifactRole {
|
||||
@@ -708,7 +731,7 @@ impl ResolvedAgentUpdate {
|
||||
}
|
||||
pub fn execution_identity(&self) -> Option<&'static str> {
|
||||
self.manifest().ok().map(|m| match m.platform {
|
||||
Platform::LinuxX64 => "root",
|
||||
Platform::LinuxX64 | Platform::LinuxArm64 => "root",
|
||||
Platform::WindowsX64 | Platform::WindowsGnuX64 => "system",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ pub fn validate_for_scope(
|
||||
.map_err(|_| "INVALID_AGENT_UPDATE_OBSERVATION")?
|
||||
!= update
|
||||
|| !typed.agent_update.validate()
|
||||
|| (typed.agent_update.platform == crate::agent_update::Platform::LinuxX64) != (scope == "linux.base")
|
||||
|| typed.agent_update.platform.is_linux() != (scope == "linux.base")
|
||||
|| typed.agent_update.observed_at - now > chrono::Duration::seconds(45)
|
||||
|| now - typed.agent_update.observed_at > chrono::Duration::hours(72)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user