Commit Graph

15262 Commits

Author SHA1 Message Date
Fabiano Fidêncio
ec290853e9 workflows: build: Do not store unnecessary content on the tarball
Otherwise we may end up simply unpacking kata-containers specific
binaries into the same location that system ones are needed, leading to
a broken system (most likely what happened with the metrics CI, and also
what's happening with the GHA runners).

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-02-10 18:57:29 +01:00
Zvonko Kaiser
eb1cf792de
Merge pull request #10791 from kata-containers/gpu_ci_cd
gpu: Add first target and fix extratarballs
2025-02-06 15:47:27 -05:00
Zvonko Kaiser
62a975603e
Merge pull request #10806 from stevenhorsman/rust-1.80.0-bump
Rust 1.80.0 bump
2025-02-06 14:49:23 -05:00
Dan Mihai
fdf3088be0
Merge pull request #10842 from microsoft/danmihai1/disable-job-policy-test
tests: disable k8s-policy-job.bats on coco-dev
2025-02-06 09:09:49 -08:00
Hyounggyu Choi
48c5b1fb55
Merge pull request #10841 from BbolroC/make-measured-rootfs-configurable
local-build: Do not build measured rootfs on s390x
2025-02-06 16:07:15 +01:00
Hyounggyu Choi
1bdb34e880 tests: Skip trusted storage tests for IBM SE
Let's skip all tests for trusted storage until #10838 is resolved.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-02-06 12:09:14 +01:00
Hyounggyu Choi
27ce3eef12 local-build: Do not use measured rootfs on s390x
IBM SE ensures to make initrd measured by genprotimg and verified by ultravisor.
Let's not build the measured rootf on s390x.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2025-02-06 10:12:55 +01:00
stevenhorsman
fce49d4206 dragonball: Skip unsafe tests
Skip tests that use unsafe uses of file descriptor
which causes
```
fatal runtime error: IO Safety violation: owned file descriptor already closed
```

See #10821

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-06 08:54:17 +00:00
Fabiano Fidêncio
2ceb7a35fc versions: Bump rust to 1.80.0 (matching coco-guest-components)
This is needed in order to avoid agent build issues, such as:
```
error[E0658]: use of unstable library feature 'lazy_cell'
  --> /home/ansible/.cargo/git/checkouts/guest-components-1e54b222ad8d9630/514c561/ocicrypt-rs/src/lib.rs:10:5
   |
10 | use std::sync::LazyLock;
   |     ^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #109736 <https://github.com/rust-lang/rust/issues/109736> for more information
```

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-06 08:53:51 +00:00
Fabiano Fidêncio
76df852f33 packaging: agent: Add rust version to the builder image name
As we want to make sure a new builder image is generated if the rust
version is bumped.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-06 08:53:51 +00:00
stevenhorsman
d3e0ecc394 kata-ctl: Allow empty const
Due to the way that multi-arch support is done, on various platforms
we will get a clippy error:
```
error: this expression always evaluates to false
```
which might not be true on those other platforms, so
allow this code pattern to suppress the clippy error

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-06 08:53:51 +00:00
Fabiano Fidêncio
6de8e59109
Merge pull request #10824 from stevenhorsman/updates-in-prep-of-rust-1.80-bump
Updates in prep of rust 1.80 bump
2025-02-06 09:05:23 +01:00
Dan Mihai
47ce5dad9d tests: disable k8s-policy-job.bats on coco-dev
k8s-policy-job is modeled after the older k8s-job, and it appears
that both of them fail occasionally on coco-dev.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2025-02-05 23:06:16 +00:00
Zvonko Kaiser
45bd451fa0 ci: add arm64 attestation
Do the very same thing that we do on amd64 and add attestation

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-05 16:30:20 +00:00
Zvonko Kaiser
9a7dff9c40 gpu: Add arm64 targets
We want to make sure we deliver arm64 GPU targets as well

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-05 16:30:20 +00:00
Zvonko Kaiser
968318180d ci: Add extratarballs steps
We introduced extratarballs with a make target. The CI
currently only uploads tarballs that are listed in the matrix.
The NV kernel builds a headers package which needs to be uploaded
as well.

The get-artifacts has a glob to download all artifacts hence we
should be good.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-05 16:30:20 +00:00
Zvonko Kaiser
b04bdf54a5 gpu: Add rootfs target amd64/arm64
Adding the initrd build first to get the rootfs on amd64.
With that we can start to add tests.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-02-05 16:30:20 +00:00
stevenhorsman
7831caf1e7 libs/safe-path: Fix doc formatting
Clippy fails with
```
error: doc list item missing indentation
```
so indent further to avoid this.
2025-02-05 15:16:47 +00:00
stevenhorsman
17b1e94f1a cargo: Update time crate
So it avoids us hitting
```
error[E0282]: type annotations needed for `Box<_>`
  --> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.31/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++
```

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 15:16:47 +00:00
stevenhorsman
e9393827e8 agent: Workaround ppc formatting
On powerpc64le platform the ip neigh command has
a trailing space after the state, so the test is failing e.g.
```
 assertion `left == right` failed
  left: "169.254.1.1 lladdr 6a:92:3a:59:70:aa PERMANENT \n"
 right: "169.254.1.1 lladdr 6a:92:3a:59:70:aa PERMANENT\n"
```
Trim the whitespace to make the test pass on all platforms

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 15:16:47 +00:00
stevenhorsman
1ac0e67245 kata-ctl: Add stub of missing method for ppc
`host_is_vmcontainer_capable` is required, but wasn't
implemented for powerpc64, so copy the aarch64 approach
@Amulyam24

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 15:16:47 +00:00
stevenhorsman
bd3c93713f kata-sys-util: Complete code move
In #7236 the guest protection code was moved to kata-sys-utils,
but some of it was left behind, and the adjustment to the new
location wasn't completed, so the powerpc64 code doesn't
build now we've fixed the cfg to test it.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 15:16:47 +00:00
stevenhorsman
9f865f5bad kata-ctl: Allow dead_code
Some of the Kernel structs have `#[allow(dead_code)]`
but not all and this results in the clippy error:
```
 error: fields `name` and `value` are never read
 ```
 so complete the job started before to remove the error.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
61a252094e dragonball: Fix feature typo
Replace `legacy_irq` with `legacy-irq`

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
add785f677 dragonball: Remove unused fields
`metrics` is never used, so remove this code

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
dde34bb7b8 runtime-rs: Remove un-used code
The `r#type` method is never used, so neither
are the log type constants

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
71fffb8736 runtime-rs: Allow dead code
Clippy errors with:
```
error: field `driver` is never read
  --> crates/resource/src/network/utils/link/driver_info.rs:77:9
   |
76 | pub struct DriverInfo {
   |            ---------- field in this struct
77 |     pub driver: String,
   |         ^^^^^^
```
We set this, but never read it, so clippy is correct,
but I'm not sure if it's useful for logging, or other purposes,
so I'll allow it for now.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
d75a0ccbd1 dragonball: Allow test-mock feature
Clippy fails with:
```
warning: unexpected `cfg` condition value: `test-mock`
    --> /root/go/src/github.com/kata-containers/kata-containers/src/dragonball/src/dbs_pci/src/vfio.rs:1929:17
     |
1929 | #[cfg(all(test, feature = "test-mock"))]
     |                 ^^^^^^^^^^^^^^^^^^^^^ help: remove the condition
     |
     = note: no expected values for `feature`
     = help: consider adding `test-mock` as a feature in `Cargo.toml`
```
So add it as an expected cfg in the linter to skip this

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
bddaea6df1 runtime-rs: Allow enable-vendor feature
Clippy fails with:
```
error: unexpected `cfg` condition value: `enable-vendor`
   --> crates/hypervisor/src/device/driver/vfio.rs:180:11
    |
180 |     #[cfg(feature = "enable-vendor")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `ch-config`, `cloud-hypervisor`, `default`, and `dragonball`
    = help: consider adding `enable-vendor` as a feature in `Cargo.toml`
```

So add it as an expected cfg in the linter to skip this

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
bed128164a runtime-rs: Allow unexpected config
Clippy fails with:
```
error: unexpected `cfg` condition value: `enable-vendor`
   --> crates/hypervisor/src/device/driver/vfio.rs:180:11
    |
180 |     #[cfg(feature = "enable-vendor")]
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: expected values for `feature` are: `ch-config`, `cloud-hypervisor`, `default`, and `dragonball`
    = help: consider adding `enable-vendor` as a feature in `Cargo.toml`
```
allow this until we can check this behaviour with @Apokleos

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
53bcb0b108 runtime-rs: Fix for-loops-over-fallibles
Clippy complains about:
```
error: for loop over a `&Result`. This is more readably written as an `if let` statement
  --> crates/hypervisor/src/firecracker/fc_api.rs:99:22
   |
99 |         for param in &kernel_params.to_string() {
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
c332a91ef8 runtime-rs: Fix doc list item missing indentation
Add the extra space to format the list correctly

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
fe98d49a29 runtime-rs: Remove direct implementation of ToString
Fix clippy error:
```
direct implementation of `ToString`
```
by switching to implement Display instead

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:02 +00:00
stevenhorsman
730c56af2a runtime-rs: Fix clippy::unnecessary-get-then-check
Clippy errors with:
```
error: unnecessary use of `get(&id).is_none()`
   --> crates/hypervisor/src/device/device_manager.rs:494:29
    |
494 |             if self.devices.get(&id).is_none() {
    |                -------------^^^^^^^^^^^^^^^^^^
    |                |
    |                help: replace it with: `!self.devices.contains_key(&id)`
```
so fix this as suggested

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
a9358b59b7 runtime-rs: Allow unused enum field
Clippy errors with:
```
error: field `0` is never read
   --> crates/hypervisor/src/qemu/cmdline_generator.rs:375:25
    |
375 |     DeviceAlreadyExists(String), // Error when trying to add an existing device
    |     ------------------- ^^^^^^
```
but this is used when creating the error later, so add an allow
to ignore this warning

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
1d9efeb92b runtime-rs: Remove use of legacy constants
Fix clippy error
```
error: usage of a legacy numeric constant
```
by swapping `std::u8::MAX` for `u8::MAX`

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
225c7fc026 kata-ctl: Allow unused enum field
Clippy errors with:
```
error: field `0` is never read
```
but the field is required for the `map_err`, so ignore this
error for now to avoid too much disruption

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
f1d3450d1f runtime-rs: Remove unused config
`gdb` is only activated by a feature `guest_debug` that doesn't
exist, so remove this.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
1e90fc38de dragonball: Fix incorrect reference
There were references to `config_manager::DeviceInfoGroup`
which doesn't exist, so I guess it means `DeviceConfigInfo`
instead, so update them

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
f389b05f20 dragonball: Fix doc formatting issue
Clippy errors with:
```
error: doc list item missing indentation
```
which I think is because the Return is between two list
items, so add a blank line to separate this into a separate
paragraph

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
8bea57326a dragonballl: Fix thread_local initializer error
clippy errors with:
```
error: initializer for `thread_local` value can be made `const`
```
so update as suggested

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
7257ee0397 agent: Remove implementation of ToString
Fix clippy error:
```
direct implementation of `ToString`
```
by switching to implement Display instead

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
ca87aca1a6 agent: Remove use of legacy constants
Fix clippy error
```
error: usage of a legacy numeric constant
```
by swapping `std::i32::<MIN/MAX>` for `i32::<MIN/MAX>`

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
6008fd56a1 agent: Fix clippy error
```
error: file opened with `create`, but `truncate` behavior not defined
```
`truncate(true)` ensures the file is entirely overwritten with new data
which I believe is the behaviour we want

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
a640bb86ec agent: cdh: Remove unnecessary borrows
Fix clippy error:
```
error: the borrowed expression implements the required traits
```

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
a131eec5c1 agent: config: Remove supports_seccomp
supports_seccomp is never used, so throws a clippy error

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
0bd36a63d9 agent: Fix clippy error
```
error: bound is defined in more than one place
```

Move Sized into the later definition of `R` & `W`
rather than defining them in two places

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
7709198c3b rustjail: Fix clippy error
```
error: file opened with `create`, but `truncate` behavior not defined
```
`truncate(true)` ensures the file is entirely overwritten with new data
which I believe is the behaviour we want

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
Fabiano Fidêncio
b4de302cb2 genpolicy: Adjust to build with rust 1.80.0
```
error: field `image` is never read
  --> src/registry.rs:35:9
   |
34 | pub struct Container {
   |            --------- field in this struct
35 |     pub image: String,
   |         ^^^^^
   |
   = note: `Container` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`

error: field `use_cache` is never read
   --> src/utils.rs:106:9
    |
105 | pub struct Config {
    |            ------ field in this struct
106 |     pub use_cache: bool,
    |         ^^^^^^^^^
    |
    = note: `Config` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis

error: could not compile `genpolicy` (bin "genpolicy") due to 2 previous errors
```

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00
stevenhorsman
099b241702 powerpc64: Add target_endian = "little"
Based on comments from @Amulyam24 we need to use
the `target_endian = "little"` as well as target_arch = "powerpc64"
to ensure we are working on powerpc64le.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-02-05 14:45:01 +00:00