Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests-integration: Optimize rebuilds #612

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests-integration/src/runvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ fn run_bib(sh: &Shell, cimage: &str, tmpdir: &Utf8Path, diskpath: &Utf8Path) ->
println!("{cimage} digest={digest}");
if diskpath.try_exists()? {
let mut buf = [0u8; 2048];
if rustix::fs::getxattr(diskpath.as_std_path(), IMAGEID_XATTR, &mut buf)
if let Ok(n) = rustix::fs::getxattr(diskpath.as_std_path(), IMAGEID_XATTR, &mut buf)
.context("Reading xattr")
.is_ok()
{
let buf = String::from_utf8_lossy(&buf);
let buf = String::from_utf8_lossy(&buf[0..n]);
if &*buf == digest.as_str() {
println!("Existing disk {diskpath} matches container digest {digest}");
return Ok(());
Expand Down Expand Up @@ -142,9 +141,10 @@ pub(crate) fn run(opt: Opt) -> Result<()> {
let testimage = if let Some(i) = testimage.take() {
i
} else {
let source_date_epoch = cmd!(&ctx.sh, "git log -1 --pretty=%ct").read()?;
cmd!(
&ctx.sh,
"podman build --build-arg=variant=tmt -t {TEST_IMAGE} -f hack/Containerfile ."
"podman build --timestamp={source_date_epoch} --build-arg=variant=tmt -t {TEST_IMAGE} -f hack/Containerfile ."
)
.run()?;
TEST_IMAGE.to_string()
Expand Down
Loading