Skip to content

Commit

Permalink
Merge pull request #191 from ginglis13/sdk-v0.46.0
Browse files Browse the repository at this point in the history
Update bottlerocket-sdk to v0.46.0
  • Loading branch information
ginglis13 authored Oct 12, 2024
2 parents 058f006 + 8006fe2 commit dc72afb
Show file tree
Hide file tree
Showing 32 changed files with 112 additions and 127 deletions.
6 changes: 3 additions & 3 deletions Twoliter.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kit = []

[sdk]
name = "bottlerocket-sdk"
version = "0.45.0"
version = "0.46.0"
vendor = "bottlerocket"
source = "public.ecr.aws/bottlerocket/bottlerocket-sdk:v0.45.0"
digest = "CIx/G74W+Ie4gdJ40D/N/UbyQ9JqwVOd/9IH4ru3zYk="
source = "public.ecr.aws/bottlerocket/bottlerocket-sdk:v0.46.0"
digest = "V2lUX6Rs9rZLg8POxV7P785Mr5nallfyxor0Scrvh3Y="
2 changes: 1 addition & 1 deletion Twoliter.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ registry = "public.ecr.aws/bottlerocket"

[sdk]
name = "bottlerocket-sdk"
version = "0.45.0"
version = "0.46.0"
vendor = "bottlerocket"
19 changes: 10 additions & 9 deletions packages/early-boot-config/early-boot-config.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
%global _cross_first_party 1
%undefine _debugsource_packages
%undefine cross_check_fips
%undefine cross_check_fips

Name: %{_cross_os}early-boot-config
Version: 0.1
Expand Down Expand Up @@ -70,30 +72,29 @@ Requires: %{name}-local
%endif
%{nil}

%global cargo_outdir %{getenv:HOME}/.cache/%{__cargo_target}/release
%global early_boot_config_bindir %{_cross_libexecdir}/early-boot-config/bin
%global early_boot_config_provider_dir %{_cross_libexecdir}/early-boot-config/data-providers.d

%install
install -d %{buildroot}%{_cross_bindir}
install -p -m 0755 %{cargo_outdir}/early-boot-config %{buildroot}%{_cross_bindir}
install -p -m 0755 %{__cargo_outdir}/early-boot-config %{buildroot}%{_cross_bindir}

install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 %{S:100} %{buildroot}%{_cross_unitdir}

install -d %{buildroot}%{early_boot_config_bindir}
install -p -m 0755 \
%{cargo_outdir}/ec2-identity-doc-user-data-provider \
%{cargo_outdir}/ec2-imds-user-data-provider \
%{cargo_outdir}/local-defaults-user-data-provider \
%{cargo_outdir}/local-file-user-data-provider \
%{cargo_outdir}/local-overrides-user-data-provider \
%{__cargo_outdir}/ec2-identity-doc-user-data-provider \
%{__cargo_outdir}/ec2-imds-user-data-provider \
%{__cargo_outdir}/local-defaults-user-data-provider \
%{__cargo_outdir}/local-file-user-data-provider \
%{__cargo_outdir}/local-overrides-user-data-provider \
%{buildroot}%{early_boot_config_bindir}

%ifarch x86_64
install -p -m 0755 \
%{cargo_outdir}/vmware-cd-rom-user-data-provider \
%{cargo_outdir}/vmware-guestinfo-user-data-provider \
%{__cargo_outdir}/vmware-cd-rom-user-data-provider \
%{__cargo_outdir}/vmware-guestinfo-user-data-provider \
%{buildroot}%{early_boot_config_bindir}
%endif

Expand Down
2 changes: 2 additions & 0 deletions packages/netdog/netdog.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
%global _cross_first_party 1
%undefine _debugsource_packages
%undefine cross_check_fips
%undefine cross_check_fips

Name: %{_cross_os}netdog
Version: 0.1.1
Expand Down
28 changes: 13 additions & 15 deletions packages/os/os.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
%global _cross_first_party 1
%undefine _debugsource_packages
%undefine cross_check_fips
%undefine cross_check_fips

Name: %{_cross_os}os
Version: 0.0
Expand Down Expand Up @@ -325,16 +327,12 @@ exec 1>&3 2>&4
exec 3>&1 4>&2
aws_sdk_output="$(mktemp)"
exec 1>"${aws_sdk_output}" 2>&1
RUSTFLAGS="$(echo "%{__global_rustflags_shared}" | sed -e 's,-Ccodegen-units=1,,g')" \
%{__cargo_cross_env} \
CARGO_TARGET_DIR="${HOME}/.cache/.aws-sdk" \
%{__cargo} build \
%{__cargo_cross_opts} \
--release \
--manifest-path %{_builddir}/sources/Cargo.toml \
-p pluto \
-p cfsignal \
&

%cargo_build_aws_sdk --manifest-path %{_builddir}/sources/Cargo.toml \
-p pluto \
-p cfsignal \
&

# Save the PID so we can wait for it later.
aws_sdk_pid="$!"
exec 1>&3 2>&4
Expand Down Expand Up @@ -402,24 +400,24 @@ for p in \
shibaken \
driverdog \
; do
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/${p} %{buildroot}%{_cross_bindir}
install -p -m 0755 %{__cargo_outdir}/${p} %{buildroot}%{_cross_bindir}
done

for p in \
pluto \
cfsignal \
; do
install -p -m 0755 ${HOME}/.cache/.aws-sdk/%{__cargo_target}/release/${p} %{buildroot}%{_cross_bindir}
install -p -m 0755 %{__cargo_outdir_aws_sdk}/${p} %{buildroot}%{_cross_bindir}
done

install -d %{buildroot}%{_cross_sbindir}
for p in \
xfs_admin xfs_info \
; do
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/${p} %{buildroot}%{_cross_sbindir}/
install -p -m 0755 %{__cargo_outdir}/${p} %{buildroot}%{_cross_sbindir}/
done
# Rename fsck_xfs binary to fsck.xfs
install -p -m 0755 ${HOME}/.cache/%{__cargo_target}/release/fsck_xfs %{buildroot}%{_cross_sbindir}/fsck.xfs
install -p -m 0755 %{__cargo_outdir}/fsck_xfs %{buildroot}%{_cross_sbindir}/fsck.xfs

# Add the bloodhound checker symlinks
mkdir -p %{buildroot}%{_cross_libexecdir}/cis-checks/bottlerocket
Expand Down Expand Up @@ -459,7 +457,7 @@ done
install -m 0644 %{S:13} %{buildroot}%{_cross_libexecdir}/cis-checks/kubernetes/metadata.json

for p in apiclient ; do
install -p -m 0755 ${HOME}/.cache/.static/%{__cargo_target_static}/release/${p} %{buildroot}%{_cross_bindir}
install -p -m 0755 %{__cargo_outdir_static}/${p} %{buildroot}%{_cross_bindir}
done

install -d %{buildroot}%{_cross_datadir}/bottlerocket
Expand Down
10 changes: 5 additions & 5 deletions sources/api/apiclient/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ impl ReadFromServer {
/// * read: The stream of messages from the server.
///
/// * heartbeat_setter: An atomic handle to a timestamp; this will be updated whenever we
/// receive a ping or pong from the server so we can make sure the connection isn't stale.
/// receive a ping or pong from the server so we can make sure the connection isn't stale.
///
/// * capacity: When the server sends a capacity update, we update this AtomicCapacity, so we
/// can make sure we're not sending (or even reading) data the server can't handle.
/// can make sure we're not sending (or even reading) data the server can't handle.
fn new(
read: impl Stream<Item = std::result::Result<Message, WsError>> + 'static,
heartbeat_setter: Arc<Mutex<Instant>>,
Expand Down Expand Up @@ -341,11 +341,11 @@ impl ReadFromUser {
/// * stdin_tx: The channel to which we should send messages containing user input.
///
/// * capacity_reader: We'll only read input when the server has capacity, according to this
/// parameter, so that we don't unnecessarily fill buffers or overwhelm the server.
/// parameter, so that we don't unnecessarily fill buffers or overwhelm the server.
///
/// * is_tty: whether input is coming from a TTY; think of it as whether the command is
/// interactive. If so, we read a byte at a time and send it immediately to the server so that
/// things like tab completion work.
/// interactive. If so, we read a byte at a time and send it immediately to the server so that
/// things like tab completion work.
fn new(
stdin_tx: mpsc::UnboundedSender<Message>,
capacity_reader: Arc<AtomicCapacity>,
Expand Down
4 changes: 2 additions & 2 deletions sources/api/apiclient/src/exec/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub(crate) struct Terminal {
impl Terminal {
/// Parameters:
/// * tty: Represents the user's desire for a TTY, where `Some(true)` means to use a TTY,
/// `Some(false)` means not to use a TTY, and `None` means to detect whether we think we should
/// use a TTY.
/// `Some(false)` means not to use a TTY, and `None` means to detect whether we think we should
/// use a TTY.
///
/// For the purposes of terminal settings, "use a TTY" means to set the terminal to
/// raw mode so that input is read directly, not interpreted; for example, things like ctrl-c
Expand Down
15 changes: 6 additions & 9 deletions sources/api/apiserver/src/server/exec/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pub(crate) struct ChildHandles {
impl ChildHandles {
/// Parameters:
/// * init: The initialization parameters for the process, meaning the target container, the
/// command, and any TTY settings.
/// command, and any TTY settings.
///
/// * exec_socket_path: The containerd socket we'll use to start the process in the desired
/// container's namespace.
/// container's namespace.
///
/// * ws_addr: The address of the WebSocket actor, for sending messages back.
pub(crate) fn new(
Expand Down Expand Up @@ -194,10 +194,7 @@ impl ChildHandles {
})()
// If anything went wrong when configuring the child process, kill it and return the
// original error.
.map_err(|e| {
Self::stop_impl(pid);
e
})
.inspect(|_| Self::stop_impl(pid))
}

/// Terminates the child process.
Expand Down Expand Up @@ -262,7 +259,7 @@ impl ChildFds {
/// * child: The Command for which we want read and write file descriptors.
///
/// * tty: Represents the user's desire for a TTY. If None, don't create a PTY. If Some,
/// create a PTY, and start it with the specs given in TtyInit.
/// create a PTY, and start it with the specs given in TtyInit.
fn new(child: &mut Command, tty: &Option<TtyInit>) -> Result<Self> {
if let Some(tty_init) = tty {
Self::tty_fds(child, tty_init)
Expand Down Expand Up @@ -451,8 +448,8 @@ impl WaitForChild {
/// * ws_addr: The address of the WebSocket actor, to which we'll send the return code.
///
/// * read_complete_rx: We should receive a signal on this channel when the reader thread is
/// finished. PTY I/O is buffered in the kernel, so when a process exits, it doesn't mean
/// we're done reading from the PTY; this lets us be sure.
/// finished. PTY I/O is buffered in the kernel, so when a process exits, it doesn't mean
/// we're done reading from the PTY; this lets us be sure.
fn new(pid: Pid, ws_addr: Addr<WsExec>, read_complete_rx: Receiver<()>) -> Self {
debug!("Spawning thread to wait for child exit");
thread::spawn(move || Self::wait_for_child(pid, ws_addr, read_complete_rx));
Expand Down
6 changes: 1 addition & 5 deletions sources/api/apiserver/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,7 @@ fn comma_separated<'a>(key_name: &'static str, input: &'a str) -> Result<HashSet
}

fn transaction_name(query: &web::Query<HashMap<String, String>>) -> &str {
if let Some(name_str) = query.get("tx") {
name_str
} else {
"default"
}
query.get("tx").map(String::as_str).unwrap_or("default")
}

// Helpers methods for the 'set' API
Expand Down
2 changes: 1 addition & 1 deletion sources/api/bootstrap-containers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ It queries the API for their settings, then configures the system by:
container at /.bottlerocket/bootstrap-containers/<name>/user-data)
* creating an environment file used by a bootstrap-container-specific instance of a systemd service
* creating a systemd drop-in configuration file used by a bootstrap-container-specific
instance of a systemd service
instance of a systemd service
* ensuring that the bootstrap container's systemd service is enabled/disabled for the next boot

## Examples
Expand Down
2 changes: 1 addition & 1 deletion sources/api/bootstrap-containers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It queries the API for their settings, then configures the system by:
container at /.bottlerocket/bootstrap-containers/<name>/user-data)
* creating an environment file used by a bootstrap-container-specific instance of a systemd service
* creating a systemd drop-in configuration file used by a bootstrap-container-specific
instance of a systemd service
instance of a systemd service
* ensuring that the bootstrap container's systemd service is enabled/disabled for the next boot
# Examples
Expand Down
2 changes: 1 addition & 1 deletion sources/api/host-containers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ mod test {

let temp_dir = tempfile::TempDir::new().unwrap();
let temp_config = Path::join(temp_dir.path(), "host-containers.toml");
let _ = std::fs::write(&temp_config, config_toml).unwrap();
std::fs::write(&temp_config, config_toml).unwrap();

let host_containers = get_host_containers(&temp_config).unwrap();

Expand Down
10 changes: 5 additions & 5 deletions sources/api/migration/migrator/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ async fn assert_directory_structure_with_failed_migration(
.to_str()
.unwrap()
.starts_with(&to_ver_unique_prefix)
.then(|| ())
.then_some(())
})
.collect::<Vec<()>>()
.len();
Expand Down Expand Up @@ -355,7 +355,7 @@ async fn migrate_forward() {
let contents = std::fs::read_to_string(&output_file).unwrap();
let lines: Vec<&str> = contents.split('\n').collect();
assert_eq!(lines.len(), 4);
let first_line = *lines.get(0).unwrap();
let first_line = *lines.first().unwrap();
let want = format!("{}: --forward", FIRST_MIGRATION);
let got: String = first_line.chars().take(want.len()).collect();
assert_eq!(got, want);
Expand Down Expand Up @@ -402,7 +402,7 @@ async fn migrate_backward() {
let contents = std::fs::read_to_string(&output_file).unwrap();
let lines: Vec<&str> = contents.split('\n').collect();
assert_eq!(lines.len(), 4);
let first_line = *lines.get(0).unwrap();
let first_line = *lines.first().unwrap();
let want = format!("{}: --backward", THIRD_MIGRATION);
let got: String = first_line.chars().take(want.len()).collect();
assert_eq!(got, want);
Expand Down Expand Up @@ -450,7 +450,7 @@ async fn migrate_forward_with_failed_migration() {
let contents = std::fs::read_to_string(&output_file).unwrap();
let lines: Vec<&str> = contents.split('\n').collect();
assert_eq!(lines.len(), 4);
let first_line = *lines.get(0).unwrap();
let first_line = *lines.first().unwrap();
let want = format!("{}: --forward", FIRST_MIGRATION);
let got: String = first_line.chars().take(want.len()).collect();
assert_eq!(got, want);
Expand Down Expand Up @@ -502,7 +502,7 @@ async fn migrate_backward_with_failed_migration() {
let contents = std::fs::read_to_string(&output_file).unwrap();
let lines: Vec<&str> = contents.split('\n').collect();
assert_eq!(lines.len(), 4);
let first_line = *lines.get(0).unwrap();
let first_line = *lines.first().unwrap();
let want = format!("{}: --backward", THIRD_MIGRATION);
let got: String = first_line.chars().take(want.len()).collect();
assert_eq!(got, want);
Expand Down
2 changes: 1 addition & 1 deletion sources/api/prairiedog/src/initrd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod tests {
let bootconfig = GOOD_BOOTCONFIG;
assert_eq!(
INITRD_FROM_GOOD_BOOTCONFIG,
generate_initrd(&bootconfig.as_bytes()).unwrap()
generate_initrd(bootconfig.as_bytes()).unwrap()
);
}
}
Loading

0 comments on commit dc72afb

Please sign in to comment.