From 75e96661fab66b5bac43d5d09c3d84c8f0ff8732 Mon Sep 17 00:00:00 2001 From: yylyyl Date: Thu, 19 Oct 2023 02:24:22 -0400 Subject: [PATCH] rename image archive file, and simplify code --- badges/coverage.svg | 2 +- dist/index.js | 30 ++++-------------------------- src/podman.js | 30 ++++-------------------------- 3 files changed, 9 insertions(+), 53 deletions(-) diff --git a/badges/coverage.svg b/badges/coverage.svg index ab19260..ea2368b 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 14.14%Coverage14.14% \ No newline at end of file +Coverage: 14.94%Coverage14.94% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 87d22da..df30816 100644 --- a/dist/index.js +++ b/dist/index.js @@ -59368,7 +59368,7 @@ class PodmanInPodman { return } - await this.createManifest(repoTag) + await this.podman.manifestCreate(repoTag) for (const platform of platforms) { await this.buildSinglePlatform( containerfile, @@ -59391,18 +59391,16 @@ class PodmanInPodman { } async exportAndImportToHost(repoTag, isManifest = false) { - const normalizedRepoTag = repoTag.replace('/', '_') + const normalizedRepoTag = repoTag.replace('/', '_').replace(':', '_') const archiveExport = path.join(mountPoint, `${normalizedRepoTag}.tar`) const archiveImport = path.join(await tempDir(), `${normalizedRepoTag}.tar`) - core.startGroup(`➡️ [PodmanInPodman] Copying image ${repoTag}...`) await this.export(repoTag, archiveExport) if (!isManifest) { - await this.importToHostImage(archiveImport) + await this.podman.loadImage(archiveImport) } else { - await this.importToHostManifest(repoTag, archiveImport) + await this.podman.manifestAddArchive(repoTag, archiveImport) } - core.endGroup() } async export(repoTag, archive) { @@ -59416,26 +59414,6 @@ class PodmanInPodman { core.endGroup() } - async importToHostImage(archive) { - core.startGroup(`📦 [PodmanInPodman] Importing image to host...`) - await this.podman.loadImage(archive) - core.endGroup() - } - - async createManifest(manifest) { - core.startGroup(`📦 [PodmanInPodman] Create manifest ${manifest}...`) - await this.podman.manifestCreate(manifest) - core.endGroup() - } - - async importToHostManifest(manifest, archive) { - core.startGroup( - `📦 [PodmanInPodman] Importing image to host manifest ${manifest}...` - ) - await this.podman.manifestAddArchive(manifest, archive) - core.endGroup() - } - async buildSinglePlatform( containerfile, workdir, diff --git a/src/podman.js b/src/podman.js index 1b1249e..216b5b7 100644 --- a/src/podman.js +++ b/src/podman.js @@ -182,7 +182,7 @@ class PodmanInPodman { return } - await this.createManifest(repoTag) + await this.podman.manifestCreate(repoTag) for (const platform of platforms) { await this.buildSinglePlatform( containerfile, @@ -205,18 +205,16 @@ class PodmanInPodman { } async exportAndImportToHost(repoTag, isManifest = false) { - const normalizedRepoTag = repoTag.replace('/', '_') + const normalizedRepoTag = repoTag.replace('/', '_').replace(':', '_') const archiveExport = path.join(mountPoint, `${normalizedRepoTag}.tar`) const archiveImport = path.join(await tempDir(), `${normalizedRepoTag}.tar`) - core.startGroup(`➡️ [PodmanInPodman] Copying image ${repoTag}...`) await this.export(repoTag, archiveExport) if (!isManifest) { - await this.importToHostImage(archiveImport) + await this.podman.loadImage(archiveImport) } else { - await this.importToHostManifest(repoTag, archiveImport) + await this.podman.manifestAddArchive(repoTag, archiveImport) } - core.endGroup() } async export(repoTag, archive) { @@ -230,26 +228,6 @@ class PodmanInPodman { core.endGroup() } - async importToHostImage(archive) { - core.startGroup(`📦 [PodmanInPodman] Importing image to host...`) - await this.podman.loadImage(archive) - core.endGroup() - } - - async createManifest(manifest) { - core.startGroup(`📦 [PodmanInPodman] Create manifest ${manifest}...`) - await this.podman.manifestCreate(manifest) - core.endGroup() - } - - async importToHostManifest(manifest, archive) { - core.startGroup( - `📦 [PodmanInPodman] Importing image to host manifest ${manifest}...` - ) - await this.podman.manifestAddArchive(manifest, archive) - core.endGroup() - } - async buildSinglePlatform( containerfile, workdir,