Public release release-b8454b34d38c
Source commit: b8454b34d38cc2ba0bd278e842060db45d091e1c Public tree identity: sha256:69d6c8143bf6227e1bb07852aa94e8af9c26793eca252bb46788894f728cb6d2
This commit is contained in:
commit
d2e84229c5
221 changed files with 80960 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