Public release release-b215a8f6e506
Source commit: b215a8f6e506fafa38755d1c14e89e5a52c82f9f Public tree identity: sha256:23ba19e9f6e902cbfb4ed34cd7f9e1aaa39945e9b61946b879d7254b3f033502
This commit is contained in:
commit
f8bf4e94cc
221 changed files with 81096 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