Use XDG_RUNTIME_DIR if set for auth file path

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-10-20 00:13:34 +05:30
parent fc6abaf740
commit 7b5fd99fde
3 changed files with 7 additions and 3 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -48,7 +48,11 @@ async function run(): Promise<void> {
// Setting REGISTRY_AUTH_FILE environment variable as buildah needs
// this environment variable to point to registry auth file
const podmanAuthFilePath = path.join("/", "tmp", `podman-run-${process.getuid()}`,
let authFileDir = path.join("/", "tmp", `podman-run-${process.getuid()}`);
if (process.env.XDG_RUNTIME_DIR) {
authFileDir = process.env.XDG_RUNTIME_DIR;
}
const podmanAuthFilePath = path.join(authFileDir,
"containers", "auth.json");
const REGISTRY_AUTH_ENVVAR = "REGISTRY_AUTH_FILE";
core.info(`Exporting ${REGISTRY_AUTH_ENVVAR}=${podmanAuthFilePath}`);