Skip to content

Commit 7e54006

Browse files
committed
bump: update SDK to v0.62.0 and fix compatibility issues
1 parent e123c61 commit 7e54006

File tree

23 files changed

+224
-149
lines changed

23 files changed

+224
-149
lines changed

Cargo.lock

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

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SHELL = /bin/bash
88
TOP := $(dir $(firstword $(MAKEFILE_LIST)))
99

1010
# Variables we update as newer versions are released
11-
BOTTLEROCKET_SDK_VERSION = v0.50.1
11+
BOTTLEROCKET_SDK_VERSION = v0.62.0
1212
BOTTLEROCKET_SDK_ARCH = $(TESTSYS_BUILD_HOST_UNAME_ARCH)
1313
BOTTLEROCKET_TOOLS_VERSION ?= v0.10.0
1414

agent/builder-derive/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(crate) fn build_struct(ast: &syn::DeriveInput) -> TokenStream {
3333
None
3434
}
3535
})
36-
.last()
36+
.next_back()
3737
.expect("`crd` is a required attribute (Test, Resource)")
3838
.value();
3939

agent/utils/src/aws.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub async fn aws_config(
3434
region
3535
);
3636

37-
let mut config_loader = aws_config::defaults(BehaviorVersion::v2025_01_17()).retry_config(
37+
let mut config_loader = aws_config::defaults(BehaviorVersion::v2025_08_07()).retry_config(
3838
RetryConfig::standard()
3939
.with_retry_mode(RetryMode::Adaptive)
4040
.with_max_attempts(15),
@@ -95,7 +95,10 @@ pub async fn aws_config(
9595
.set_duration_seconds(*assume_role_session_duration)
9696
.send()
9797
.await
98-
.context(error::AssumeRoleSnafu { role_arn })?
98+
.map_err(|source| Error::AssumeRole {
99+
role_arn: role_arn.to_string(),
100+
source: Box::new(source),
101+
})?
99102
.credentials()
100103
.context(error::CredentialsMissingSnafu { role_arn })?
101104
.clone();

agent/utils/src/error.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::string::FromUtf8Error;
1515
pub enum Error {
1616
AssumeRole {
1717
role_arn: String,
18-
source: StsSdkError<AssumeRoleError>,
18+
source: Box<StsSdkError<AssumeRoleError>>,
1919
},
2020

2121
#[snafu(display(
@@ -27,7 +27,7 @@ pub enum Error {
2727
AttachRolePolicy {
2828
role_name: String,
2929
policy_arn: String,
30-
source: IamSdkError<aws_sdk_iam::operation::attach_role_policy::AttachRolePolicyError>,
30+
source: Box<IamSdkError<aws_sdk_iam::operation::attach_role_policy::AttachRolePolicyError>>,
3131
},
3232

3333
#[snafu(display("Failed to decode base64 blob: {}", source))]
@@ -48,7 +48,7 @@ pub enum Error {
4848

4949
#[snafu(display("Failed to send create SSM command: {}", source))]
5050
CreateSsmActivation {
51-
source: aws_sdk_ssm::error::SdkError<CreateActivationError>,
51+
source: Box<aws_sdk_ssm::error::SdkError<CreateActivationError>>,
5252
},
5353

5454
#[snafu(display(
@@ -60,7 +60,7 @@ pub enum Error {
6060
CreateRole {
6161
role_name: String,
6262
role_policy: String,
63-
source: IamSdkError<CreateRoleError>,
63+
source: Box<IamSdkError<CreateRoleError>>,
6464
},
6565

6666
#[snafu(display("Credentials were missing for assumed role '{}'", role_arn))]
@@ -71,13 +71,13 @@ pub enum Error {
7171

7272
#[snafu(display("Unable to get managed instance information: {}", source))]
7373
GetManagedInstanceInfo {
74-
source: SsmSdkError<DescribeInstanceInformationError>,
74+
source: Box<SsmSdkError<DescribeInstanceInformationError>>,
7575
},
7676

7777
#[snafu(display("Unable to get SSM role '{}': {}", role_name, source))]
7878
GetSSMRole {
7979
role_name: String,
80-
source: IamSdkError<GetRoleError>,
80+
source: Box<IamSdkError<GetRoleError>>,
8181
},
8282

8383
#[snafu(display("{} was missing from {}", what, from))]

agent/utils/src/ssm.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::error::{self, Result};
1+
use crate::error::{self, Error, Result};
22
use aws_sdk_iam::error::SdkError as IamSdkError;
33
use aws_sdk_ssm::types::{InstanceInformation, InstanceInformationStringFilter, Tag};
44
use log::info;
@@ -40,15 +40,16 @@ pub async fn ensure_ssm_service_role(iam_client: &aws_sdk_iam::Client) -> Result
4040
.assume_role_policy_document(&assume_role_doc)
4141
.send()
4242
.await
43-
.context(error::CreateRoleSnafu {
44-
role_name: SSM_MANAGED_INSTANCE_SERVICE_ROLE_NAME,
43+
.map_err(|source| Error::CreateRole {
44+
source: Box::new(source),
45+
role_name: SSM_MANAGED_INSTANCE_SERVICE_ROLE_NAME.to_string(),
4546
role_policy: assume_role_doc,
4647
})?;
4748
}
4849
e => {
49-
return Err(error::Error::GetSSMRole {
50+
return Err(Error::GetSSMRole {
5051
role_name: SSM_MANAGED_INSTANCE_SERVICE_ROLE_NAME.to_string(),
51-
source: e,
52+
source: Box::new(e),
5253
});
5354
}
5455
}
@@ -61,9 +62,10 @@ pub async fn ensure_ssm_service_role(iam_client: &aws_sdk_iam::Client) -> Result
6162
.policy_arn(SSM_MANAGED_INSTANCE_POLICY_ARN)
6263
.send()
6364
.await
64-
.context(error::AttachRolePolicySnafu {
65-
role_name: SSM_MANAGED_INSTANCE_SERVICE_ROLE_NAME,
66-
policy_arn: SSM_MANAGED_INSTANCE_POLICY_ARN,
65+
.map_err(|source| Error::AttachRolePolicy {
66+
source: Box::new(source),
67+
role_name: SSM_MANAGED_INSTANCE_SERVICE_ROLE_NAME.to_string(),
68+
policy_arn: SSM_MANAGED_INSTANCE_POLICY_ARN.to_string(),
6769
})?;
6870

6971
Ok(())
@@ -87,7 +89,9 @@ pub async fn create_ssm_activation(
8789
)
8890
.send()
8991
.await
90-
.context(error::CreateSsmActivationSnafu {})?;
92+
.map_err(|source| Error::CreateSsmActivation {
93+
source: Box::new(source),
94+
})?;
9195
let activation_id = activations.activation_id.context(error::MissingSnafu {
9296
what: "activation id",
9397
from: "activations",
@@ -118,7 +122,9 @@ pub async fn wait_for_ssm_ready(
118122
)
119123
.send()
120124
.await
121-
.context(error::GetManagedInstanceInfoSnafu {})?;
125+
.map_err(|source| Error::GetManagedInstanceInfo {
126+
source: Box::new(source),
127+
})?;
122128
if let Some(info) = instance_info
123129
.instance_information_list()
124130
.iter()

bottlerocket/agents/src/bin/ecs-test-agent/main.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ where
8181
.launch_type(LaunchType::Ec2)
8282
.send()
8383
.await
84-
.context(error::TaskRunCreationSnafu)?;
84+
.map_err(|source| Error::TaskRunCreation {
85+
source: Box::new(source),
86+
})?;
8587
let task_arns: Vec<String> = run_task_output
8688
.tasks()
8789
.iter()
@@ -146,7 +148,9 @@ async fn test_results(
146148
.set_tasks(Some(task_arns.to_vec()))
147149
.send()
148150
.await
149-
.context(error::TaskDescribeSnafu)?
151+
.map_err(|source| Error::TaskDescribe {
152+
source: Box::new(source),
153+
})?
150154
.tasks()
151155
.to_owned();
152156
let running_count = tasks
@@ -184,7 +188,9 @@ async fn wait_for_registered_containers(
184188
.clusters(cluster)
185189
.send()
186190
.await
187-
.context(error::ClusterDescribeSnafu)?
191+
.map_err(|source| Error::ClusterDescribe {
192+
source: Box::new(source),
193+
})?
188194
.clusters()
189195
.first()
190196
.context(error::NoTaskSnafu)?
@@ -234,7 +240,9 @@ async fn create_task_definition(ecs_client: &aws_sdk_ecs::Client) -> Result<Stri
234240
.memory("512")
235241
.send()
236242
.await
237-
.context(error::TaskDefinitionCreationSnafu)?;
243+
.map_err(|source| Error::TaskDefinitionCreation {
244+
source: Box::new(source),
245+
})?;
238246
let revision = task_info
239247
.task_definition()
240248
.context(error::TaskDefinitionMissingSnafu)?
@@ -249,7 +257,9 @@ async fn latest_task_revision(ecs_client: &aws_sdk_ecs::Client) -> Result<String
249257
.task_definition(DEFAULT_TASK_DEFINITION)
250258
.send()
251259
.await
252-
.context(error::TaskDefinitionDescribeSnafu)?;
260+
.map_err(|source| Error::TaskDefinitionDescribe {
261+
source: Box::new(source),
262+
})?;
253263
let revision = task_info
254264
.task_definition()
255265
.context(error::TaskDefinitionMissingSnafu)?

bottlerocket/agents/src/bin/ecs-workload-agent/main.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ where
135135
.launch_type(LaunchType::Ec2)
136136
.send()
137137
.await
138-
.context(error::TaskRunCreationSnafu)?;
138+
.map_err(|source| Error::TaskRunCreation {
139+
source: Box::new(source),
140+
})?;
139141
let run_task_arns: Vec<String> = run_task_output
140142
.tasks()
141143
.iter()
@@ -243,7 +245,9 @@ async fn test_results(
243245
.set_tasks(Some(task_arns.to_vec()))
244246
.send()
245247
.await
246-
.context(error::TaskDescribeSnafu)?
248+
.map_err(|source| Error::TaskDescribe {
249+
source: Box::new(source),
250+
})?
247251
.tasks()
248252
.to_owned();
249253
let passed_count = tasks
@@ -300,7 +304,9 @@ async fn wait_for_cluster_ready(
300304
.clusters(cluster)
301305
.send()
302306
.await
303-
.context(error::ClusterDescribeSnafu)?
307+
.map_err(|source| Error::ClusterDescribe {
308+
source: Box::new(source),
309+
})?
304310
.clusters()
305311
.first()
306312
.context(error::NoTaskSnafu)?
@@ -363,7 +369,9 @@ async fn find_task_rev(
363369
.family_prefix(task_def_name)
364370
.send()
365371
.await
366-
.context(error::TaskDefinitionListSnafu)?;
372+
.map_err(|source| Error::TaskDefinitionList {
373+
source: Box::new(source),
374+
})?;
367375
let task_revisions = task_revisions.task_definition_arns();
368376

369377
for task_rev_arn in task_revisions {
@@ -454,7 +462,9 @@ async fn create_task_definition(
454462
.container_definitions(create_container_definition(test_def)?)
455463
.send()
456464
.await
457-
.context(error::TaskDefinitionCreationSnafu)?;
465+
.map_err(|source| Error::TaskDefinitionCreation {
466+
source: Box::new(source),
467+
})?;
458468
if let Some(task_arn) = task_info
459469
.task_definition()
460470
.context(error::TaskDefinitionMissingSnafu)?

0 commit comments

Comments
 (0)