Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update dist folder
Browse files Browse the repository at this point in the history
bitmaskit committed Jan 31, 2025
1 parent 49bf93e commit 824191d
Showing 4 changed files with 39 additions and 65 deletions.
51 changes: 19 additions & 32 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions src/docker.ts
Original file line number Diff line number Diff line change
@@ -18,9 +18,7 @@ export async function runContainers (actionCfg: ActionConfiguration, ctxConfig:

export async function startContainer (actionCfg: ActionConfiguration, ctxConfig: any): Promise<void> {
const dockerImage = actionCfg.dockerImage !== '' ? actionCfg.dockerImage : ctxConfig.dockerImage
if (dockerImage === undefined || dockerImage === '') {
return
}
if (dockerImage === undefined || dockerImage === '') return

const piperPath = internalActionVariables.piperBinPath
const containerID = uuidv4()
@@ -30,10 +28,10 @@ export async function startContainer (actionCfg: ActionConfiguration, ctxConfig:

let dockerOptionsArray: string[] = []
const dockerOptions = actionCfg.dockerOptions !== '' ? actionCfg.dockerOptions : ctxConfig.dockerOptions
if (dockerOptions !== undefined && Array.isArray(dockerOptions)) {
dockerOptionsArray = dockerOptions.map(option => option.split(' ')).flat()
} else if (dockerOptions !== undefined) {
dockerOptionsArray = dockerOptions.split(' ')
if (dockerOptions !== undefined) {
dockerOptionsArray = Array.isArray(dockerOptions)
? dockerOptions.map(option => option.split(' ')).flat()
: dockerOptionsArray = dockerOptions.split(' ')
}

const dockerRunArgs: string[] = [
39 changes: 14 additions & 25 deletions src/execute.ts
Original file line number Diff line number Diff line change
@@ -10,11 +10,8 @@ export interface piperExecResult {
}

export async function executePiper (
stepName: string, flags?: string[], ignoreDefaults?: boolean, execOptions?: ExecOptions
stepName: string, flags: string[] = [], ignoreDefaults: boolean = false, execOptions?: ExecOptions
): Promise<piperExecResult> {
flags = flags ?? []
ignoreDefaults = ignoreDefaults ?? false

if (process.env.GITHUB_JOB !== undefined) flags.push('--stageName', process.env.GITHUB_JOB)

flags = !ignoreDefaults && process.env.defaultsFlags !== undefined
@@ -31,13 +28,9 @@ export async function executePiper (
stdout: (data: Buffer) => {
notice('about to print some data from options.listeners.stdout')
const outString = data.toString()
outString.split('\n').forEach(line => {
if (line.toLowerCase().includes('fatal')) {
error(`${line}`) // GitHub Actions highlights this in red
} else {
piperOutput += `${line}\n`
}
})
piperOutput += outString.toLowerCase().includes('fatal')
? `::error::${outString}\n`
: `${outString}\n`
notice('end printing data from options.listeners.stdout')
},
stderr: (data: Buffer) => {
@@ -64,25 +57,21 @@ export async function executePiper (

]
return await exec('docker', args, options)
.then(exitCode => {
return {
output: piperOutput,
error: piperError,
exitCode
}
})
.then(exitCode => ({
output: piperOutput.trim(),
error: piperError.trim(),
exitCode
}))
.catch(err => { throw new Error(`Piper execution error: ${err as string}: ${piperError}`) })
}

const args: string[] = [stepName, ...flags]

return await exec(piperPath, args, options)
.then(exitCode => {
return {
output: piperOutput,
error: piperError,
exitCode
}
})
.then(exitCode => ({
output: piperOutput,
error: piperError,
exitCode
}))
.catch(err => { throw new Error(`Piper execution error: ${err as string}: ${piperError}`) })
}

0 comments on commit 824191d

Please sign in to comment.