Skip to content

Commit

Permalink
rename image archive file, and simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
yylyyl committed Oct 19, 2023
1 parent 06212e9 commit 75e9666
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 53 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 4 additions & 26 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 4 additions & 26 deletions src/podman.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 75e9666

Please sign in to comment.