Public release release-be8720d92b1c
Source commit: be8720d92b1c2795f3e5903d8c1a65d70adfd095 Public tree identity: sha256:9503bb4414b023fea6500688ef0931a7f6b4c940c509fdf96c8bf3a8950e207c
This commit is contained in:
commit
3a697fa132
221 changed files with 81070 additions and 0 deletions
41
scripts/podman-test-env.js
Normal file
41
scripts/podman-test-env.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
|
||||
function configurePodmanTestEnvironment(repo) {
|
||||
const originalHome = os.homedir();
|
||||
if (
|
||||
fs.existsSync(path.join(originalHome, ".config/containers/policy.json")) ||
|
||||
fs.existsSync("/etc/containers/policy.json")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isolatedHome = path.join(repo, "scripts/containers-home");
|
||||
const policy = path.join(isolatedHome, ".config/containers/policy.json");
|
||||
fs.mkdirSync(path.dirname(policy), { recursive: true });
|
||||
if (!fs.existsSync(policy)) {
|
||||
fs.writeFileSync(
|
||||
policy,
|
||||
`${JSON.stringify(
|
||||
{ default: [{ type: "insecureAcceptAnything" }] },
|
||||
null,
|
||||
2
|
||||
)}\n`
|
||||
);
|
||||
}
|
||||
|
||||
process.env.CARGO_HOME ||= path.join(originalHome, ".cargo");
|
||||
process.env.RUSTUP_HOME ||= path.join(originalHome, ".rustup");
|
||||
process.env.HOME = isolatedHome;
|
||||
process.env.XDG_DATA_HOME = path.join(
|
||||
os.tmpdir(),
|
||||
`clusterflux-containers-data-${process.getuid?.() ?? "user"}`
|
||||
);
|
||||
process.env.XDG_CACHE_HOME = path.join(
|
||||
os.tmpdir(),
|
||||
`clusterflux-containers-cache-${process.getuid?.() ?? "user"}`
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = { configurePodmanTestEnvironment };
|
||||
Loading…
Add table
Add a link
Reference in a new issue