Public release release-09ca780bd67a
Source commit: 09ca780bd67a00467e78139cf38466b8201b66ca Public tree identity: sha256:2f744c260b5fc2cf074ad9129f97f87f03714902e5b9fe174128afdc342ec2d0
This commit is contained in:
commit
eb1077f380
221 changed files with 81144 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