Do not set --iidfile flag if local and tar exporters are used

More tests for context module

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-10-19 21:17:06 +02:00
parent d90dfadeb5
commit 08566ae0e1
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
7 changed files with 435 additions and 268 deletions

View file

@ -1,12 +1,11 @@
import fs from 'fs';
import path from 'path';
import tmp from 'tmp';
import * as semver from 'semver';
import * as context from './context';
import * as exec from './exec';
export async function getImageIDFile(): Promise<string> {
return path.join(context.tmpDir, 'iidfile');
return path.join(context.tmpDir(), 'iidfile').split(path.sep).join(path.posix.sep);
}
export async function getImageID(): Promise<string | undefined> {
@ -19,8 +18,8 @@ export async function getImageID(): Promise<string | undefined> {
export async function getSecret(kvp: string): Promise<string> {
const [key, value] = kvp.split('=');
const secretFile = tmp.tmpNameSync({
tmpdir: context.tmpDir
const secretFile = context.tmpNameSync({
tmpdir: context.tmpDir()
});
await fs.writeFileSync(secretFile, value);
return `id=${key},src=${secretFile}`;