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

fix(deployer): keep Cargo.lock between deployments #517

Merged
merged 1 commit into from
Dec 14, 2022
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
13 changes: 12 additions & 1 deletion deployer/src/deployment/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async fn extract_tar_gz_data(data: impl Read, dest: impl AsRef<Path>) -> Result<
let mut entries = fs::read_dir(&dest).await?;
while let Some(entry) = entries.next_entry().await? {
// Ignore the build cache directory
if entry.file_name() == "target" {
if ["target", "Cargo.lock"].contains(&entry.file_name().to_string_lossy().as_ref()) {
continue;
}

Expand Down Expand Up @@ -381,6 +381,11 @@ mod tests {
.await
.unwrap();

// Cargo.lock file shouldn't be deleted
fs::write(p.join("Cargo.lock"), "lock file contents shouldn't matter")
.await
.unwrap();

// Binary data for an archive in the following form:
//
// - temp
Expand Down Expand Up @@ -433,6 +438,12 @@ ff0e55bda1ff01000000000000000000e0079c01ff12a55500280000",
"build cache file should not be touched"
);

assert_eq!(
fs::read_to_string(p.join("Cargo.lock")).await.unwrap(),
"lock file contents shouldn't matter",
"Cargo lock file should not be touched"
);

// Can we extract again without error?
super::extract_tar_gz_data(test_data.as_slice(), &p)
.await
Expand Down