Skip to content

Commit 2947a94

Browse files
authored
Merge pull request #7 from staticfloat/sf/bind_artifact
Create transient `Artifacts.toml` to manage `gc()` better.
2 parents c88b24c + 15d7f0e commit 2947a94

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/generate_sandboxed_bash.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ if !Pkg.Artifacts.artifact_exists(rootfs_treehash)
2626
Pkg.Artifacts.download_artifact(rootfs_treehash, rootfs_url, nothing; verbose);
2727
end
2828

29+
# Create an Artifacts.toml file pointing to this rootfs treehash.
30+
# The file itself will be deleted after this pipeline finishes, but
31+
# depending on the `collect_delay` set in the pipeline, it may stay
32+
# around for a while. This works because `bind_artifact!()` internally
33+
# writes into `artifact_usage.toml` in our depot, which informs `gc()`.
34+
temp_artifact_toml = joinpath(mktempdir(prefix="sandbox-buildkite-plugin", cleanup=false), "Artifacts.toml")
35+
Pkg.Artifacts.bind_artifact!(temp_artifact_toml, "rootfs", rootfs_treehash)
36+
2937
# Helper to map in a directory that is defined within an environment variable
3038
# if that variable is set, and it's pointing to a real directory.
3139
function add_env_dir!(dict, env_var; default=nothing)

0 commit comments

Comments
 (0)