-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[antlir2][gc] go back to delete-on-next-build scheme
Summary: Go back to just asking buck2 to not clean up outputs from previous actions and use that symlink to delete newly-unnecessary subvols. This might leak some subvolumes over time, but a shift to fully-rootless image builds will almost definitely require a large rework of how image contents are stored on disk anyway, so we can resolve it then. In the meantime, this should make it extremely unlikely that we'll see subvolumes getting deleted when they should not be, which we are seeing today. Test Plan: Images build ``` ❯ buck2 build --show-output fbcode//antlir/antlir2/facebook/images/build_appliance/centos9:build-appliance Buck UI: https://www.internalfb.com/buck2/1101b21e-d4e1-467f-b1fd-8fd9a0c10638 Network: Up: 522B Down: 0B (reSessionID-36bafe8f-f7e2-4919-9a1a-744061ac3cc1) Jobs completed: 14. Time elapsed: 10.3s. Cache hits: 0%. Commands: 9 (cached: 0, remote: 0, local: 9). Fallback: 3/9 BUILD SUCCEEDED fbcode//antlir/antlir2/facebook/images/build_appliance/centos9:build-appliance buck-out/v2/gen/fbcode/de11e7c77e0a6d35/antlir/antlir2/facebook/images/build_appliance/centos9/__build-appliance__/subvol-compile_compile [email protected] in fbsource ❯ ls buck-out/v2/gen/fbcode/de11e7c77e0a6d35/antlir/antlir2/facebook/images/build_appliance/centos9/__build-appliance__/subvol-compile_compile afs __antlir2__ bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var ``` Reviewed By: sergeyfd Differential Revision: D52259387 fbshipit-source-id: 9cfdce8eb753fd29409b552a24add60a248c508f
- Loading branch information
1 parent
9a04e3a
commit f71ace4
Showing
10 changed files
with
89 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,14 @@ | ||
load("//antlir/antlir2/bzl/feature:defs.bzl", "feature") | ||
load("//antlir/antlir2/bzl/image:defs.bzl", "image") | ||
load("//antlir/antlir2/testing:image_test.bzl", "image_rust_test") | ||
load("//antlir/bzl:build_defs.bzl", "rust_binary", "rust_library", "third_party") | ||
load("//antlir/bzl:build_defs.bzl", "rust_library") | ||
|
||
oncall("antlir") | ||
|
||
rust_library( | ||
name = "antlir2_working_volume", | ||
srcs = glob(["src/**/*.rs"]), | ||
deps = [ | ||
"anyhow", | ||
"nix", | ||
"serde", | ||
"serde_json", | ||
"thiserror", | ||
"tracing", | ||
"uuid", | ||
"//antlir/antlir2/antlir2_btrfs:antlir2_btrfs", | ||
], | ||
) | ||
|
||
rust_binary( | ||
name = "garbage-collect", | ||
srcs = ["bin/garbage_collect.rs"], | ||
deps = [ | ||
"anyhow", | ||
"clap", | ||
"tracing", | ||
"tracing-subscriber", | ||
":antlir2_working_volume", | ||
], | ||
) | ||
|
||
image.layer( | ||
name = "test-layer", | ||
features = [ | ||
feature.ensure_dirs_exist(dirs = "/sbin"), | ||
feature.install( | ||
src = "//antlir:empty", | ||
dst = "/sbin/nologin", | ||
mode = "a+rx", | ||
), | ||
feature.user_add( | ||
home_dir = "/", | ||
primary_group = "antlir", | ||
uid = 1000, | ||
username = "antlir", | ||
), | ||
feature.group_add( | ||
gid = 1000, | ||
groupname = "antlir", | ||
), | ||
feature.rpms_install(rpms = ["basesystem"]), | ||
feature.ensure_dirs_exist( | ||
dirs = "/empty_repo", | ||
group = "antlir", | ||
user = "antlir", | ||
), | ||
feature.ensure_dirs_exist( | ||
dirs = "/repo/antlir2-out", | ||
group = "antlir", | ||
user = "antlir", | ||
), | ||
feature.ensure_dirs_exist( | ||
dirs = "/links/", | ||
group = "antlir", | ||
user = "antlir", | ||
), | ||
], | ||
flavor = "//antlir/antlir2/test_images:test-image-flavor", | ||
) | ||
|
||
image_rust_test( | ||
name = "tests", | ||
srcs = ["tests.rs"], | ||
crate_root = "tests.rs", | ||
layer = ":test-layer", | ||
run_as_user = "antlir", | ||
deps = [ | ||
":antlir2_working_volume", | ||
third_party.library( | ||
"nix", | ||
platform = "rust", | ||
), | ||
], | ||
) |
30 changes: 0 additions & 30 deletions
30
antlir/antlir2/antlir2_working_volume/bin/garbage_collect.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.