Skip to content

Commit

Permalink
fix(tarImage): Create parent directory for tar-image if not existing
Browse files Browse the repository at this point in the history
  • Loading branch information
vehagn committed Feb 7, 2023
1 parent b12d561 commit 2e0d7ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Don't add extra trailing slash if already present in `fromRegisty` or `toRegistry`
- Clarify error message with label defined with both `--label` and `--labels`
- Create parent directory for tar-image if not existing

## [1.0.3] - 2022-02-06

Expand Down
3 changes: 3 additions & 0 deletions src/tarExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const tarDefaultConfig = {
async function saveToTar(fromdir: string, tmpdir: string, toPath: string, repoTags: string[], options: Options) {
logger.info("Creating " + toPath + " ...");

const targetFolder = path.dirname(toPath);
await fs.access(targetFolder).catch(async () => await fs.mkdir(targetFolder, {recursive: true}));

const manifestFile = path.join(fromdir, "manifest.json");
const manifest = (await fse.readJson(manifestFile)) as Manifest;
const configFile = path.join(fromdir, manifest.config.digest.split(":")[1] + ".json");
Expand Down

0 comments on commit 2e0d7ca

Please sign in to comment.