Skip to content

Commit

Permalink
Merge pull request #7 from staticfloat/sf/bind_artifact
Browse files Browse the repository at this point in the history
Create transient `Artifacts.toml` to manage `gc()` better.
  • Loading branch information
staticfloat authored Sep 30, 2021
2 parents c88b24c + 15d7f0e commit 2947a94
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/generate_sandboxed_bash.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ if !Pkg.Artifacts.artifact_exists(rootfs_treehash)
Pkg.Artifacts.download_artifact(rootfs_treehash, rootfs_url, nothing; verbose);
end

# Create an Artifacts.toml file pointing to this rootfs treehash.
# The file itself will be deleted after this pipeline finishes, but
# depending on the `collect_delay` set in the pipeline, it may stay
# around for a while. This works because `bind_artifact!()` internally
# writes into `artifact_usage.toml` in our depot, which informs `gc()`.
temp_artifact_toml = joinpath(mktempdir(prefix="sandbox-buildkite-plugin", cleanup=false), "Artifacts.toml")
Pkg.Artifacts.bind_artifact!(temp_artifact_toml, "rootfs", rootfs_treehash)

# Helper to map in a directory that is defined within an environment variable
# if that variable is set, and it's pointing to a real directory.
function add_env_dir!(dict, env_var; default=nothing)
Expand Down

0 comments on commit 2947a94

Please sign in to comment.