From ddc730cf351438bf623c8921b7208f25b57a83cd Mon Sep 17 00:00:00 2001 From: David Hiendl Date: Sun, 24 Dec 2023 17:13:57 +0100 Subject: [PATCH] fix missing whitespace in docker build, add debug output of docker command to be executed --- dist/index.js | 17 +++++++++-------- src/action.js | 12 +++--------- src/lib.js | 10 +++++++--- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1bf9432..3bb54e4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -61838,16 +61838,20 @@ function prepareFpmArgs() { return ''; } -function executeFpmBuild(computedFpmArgs) { +function executeFpmBuild(computedFpmArgs, debug) { const userFpmArgs = core.getInput('fpm_args'); const dockerCmd = 'docker run --rm -i' - + ' -v ' + process.cwd() + ':/workspace/source' + + ` -v "${process.cwd()}:/workspace/source"` + ' -w /workspace/source' - + 'gitea.dhswt.de/actions/fpm:master' + + ' gitea.dhswt.de/actions/fpm:master' + ' ' + computedFpmArgs + ' ' + userFpmArgs; + if (debug) { + console.log('docker command: ', dockerCmd); + } + const proc = external_child_process_default().spawnSync(dockerCmd, { shell: true, stdio: 'inherit', @@ -61887,14 +61891,11 @@ try { } const information = collect_all(true, false); - const debug = lib_isTrueString(process.env['ACTIONS_STEP_DEBUG']); + const debug = lib_isTrueString(process.env['ACTIONS_STEP_DEBUG']); const fpmArgs = prepareFpmArgs(); - if (debug) { - console.log('fpmArgs:', JSON.stringify(fpmArgs, null, 2)); - } - executeFpmBuild(fpmArgs); + executeFpmBuild(fpmArgs, debug); } catch (error) { console.log('Failed to fpm packages', error); diff --git a/src/action.js b/src/action.js index 3615d19..26db4f5 100644 --- a/src/action.js +++ b/src/action.js @@ -1,10 +1,7 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; import * as action_information from 'information'; -import { - executeFpmBuild, - isTrueString, prepareFpmArgs -} from './lib'; +import {executeFpmBuild, isTrueString, prepareFpmArgs} from './lib'; try { @@ -13,14 +10,11 @@ try { } const information = action_information.collect_all(true, false); - const debug = isTrueString(process.env['ACTIONS_STEP_DEBUG']); + const debug = isTrueString(process.env['ACTIONS_STEP_DEBUG']); const fpmArgs = prepareFpmArgs(); - if (debug) { - console.log('fpmArgs:', JSON.stringify(fpmArgs, null, 2)); - } - executeFpmBuild(fpmArgs); + executeFpmBuild(fpmArgs, debug); } catch (error) { console.log('Failed to fpm packages', error); diff --git a/src/lib.js b/src/lib.js index 275f339..752ea65 100644 --- a/src/lib.js +++ b/src/lib.js @@ -5,16 +5,20 @@ export function prepareFpmArgs() { return ''; } -export function executeFpmBuild(computedFpmArgs) { +export function executeFpmBuild(computedFpmArgs, debug) { const userFpmArgs = core.getInput('fpm_args'); const dockerCmd = 'docker run --rm -i' - + ' -v ' + process.cwd() + ':/workspace/source' + + ` -v "${process.cwd()}:/workspace/source"` + ' -w /workspace/source' - + 'gitea.dhswt.de/actions/fpm:master' + + ' gitea.dhswt.de/actions/fpm:master' + ' ' + computedFpmArgs + ' ' + userFpmArgs; + if (debug) { + console.log('docker command: ', dockerCmd); + } + const proc = child_process.spawnSync(dockerCmd, { shell: true, stdio: 'inherit',