Skip to content

Commit

Permalink
fix: ensure imageNames are not empty strings
Browse files Browse the repository at this point in the history
In Typescript/Javascript an empty string split on newline is going to
produce an array with an empty string.

    => "".split('\n')
    [""]

This causes the action to produce a warning, unless `pull-images` is set
to false.

    Failed to get dockerfile path for image : Error: The process '/usr/bin/docker' failed with exit code 1

Filtering the list to remove any zero-length strings from the array
solves this issue.

Signed-off-by: Morten Linderud <[email protected]>
  • Loading branch information
Foxboron committed Feb 1, 2024
1 parent 93550c2 commit 2677e40
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utilities/dockerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export async function getDeploymentConfig(): Promise<DeploymentConfig> {
)
}

const imageNames = core.getInput('images').split('\n') || []
const imageNames =
core
.getInput('images')
.split('\n')
.filter((image) => image.length > 0) || []
const imageDockerfilePathMap: {[id: string]: string} = {}

const pullImages = !(core.getInput('pull-images').toLowerCase() === 'false')
Expand Down

0 comments on commit 2677e40

Please sign in to comment.