From 5b1c96aee80a905033d1821850dd330ba5696039 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 23 Apr 2021 22:08:40 +0200 Subject: [PATCH] Display BuildKit container logs Signed-off-by: CrazyMax --- .github/buildkit-container-logs.png | Bin 0 -> 13021 bytes .github/workflows/ci.yml | 28 ++++++++++++++++++ README.md | 21 ++++++++++++++ dist/index.js | 43 ++++++++++++++++++++++------ src/main.ts | 32 ++++++++++++++++----- src/state-helper.ts | 10 +++++++ 6 files changed, 119 insertions(+), 15 deletions(-) create mode 100644 .github/buildkit-container-logs.png diff --git a/.github/buildkit-container-logs.png b/.github/buildkit-container-logs.png new file mode 100644 index 0000000000000000000000000000000000000000..e2cf1ead8b4094c99fa33027607164c53465063d GIT binary patch literal 13021 zcmZX41z1#D^e0W=C3x z^IBxPsk68xWg91DM?MlKg+?YlJ_>d7)p1J-)hT*#OLCxpq`_su z#+4C<5Gq<^^IC+0SO`He4~l|1it3@*kValyaneV6mQ*(jaUC}YV_zMem{d1)9bQ}( zQo|)Tb#a}d#-|i8MFtihiW(06b-|Gq4o}5`iAbO6{CPB&2&L~I z&-V@pHx^=XuWJpCPF5&tEUx~l5R+T9jeA#6USRYF^yH@`EMwtL2eH$ zZcB=f7P&RLhgRsgrGg--?$BU*Tn93FHIQMWfKPC1&j_huV`5#tE;Ros6sAi7lTp-2 z^pT;*l{vCCNk>BBIFgr=(DIo7F(+m}DNfdVdj9;oiUG6RIgswh3on03Q7I($k-|jUC%|7PAKciid@G$d>9guvrvEp!f z1ZlQwuAO|9+*^;=ZTPLNl_#;aeMnJsXN2WSCOO+g$eEripQ=~&-K?1a&u&_B3n(+b zGJJoWE&6A62vRi7Kv7c0VvlXD?!fCvk+~mSc;?Ovi+B9?nf(;eiVHRo-t+c3!%;Tt zc@B+)%C+&T?la(T6V!;s0dqNZzLe9Yu93+}n=4o;d6Wx7?#4xn8F%f697uwvyU^h; zrv_+9sacX(7o$6ZH)5@e@jDsv`F-2Y0`nY)!1`o>&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|0hF2=!h~cFq_r1V@6OOvTTcdzF0$#vPtVA1Vz*YG)D(8{7l7OP(FAaV z!fP(I9A2$yj_4&;!EiRm8%j6rm^@DDy@api4Wk562oc1s{_pnHzJA1Cm-)EKz#xrd zLzLgiPh}W1@PeQxe-)j)sL-RGX!Rv*kBFmT2^#XF+cWXtv7wXvwU{JgZV`cPa{dld zmmOiCZ@*r_YiTWGa^Ko~cCz>`00^q--6$$!Uq&FAoHyCis?|sseloOc847*CWenS>Ehav42Uu zim&>)Ww~o}_85=*YC;s8j=m|t)49mokCu)-eW`W3oK!ngSWbR$*HD^R2R@yM%{*P! zGSo6uK&R!a4A4d!bU0a_ik#AUrh)bXVx%A*g)dJUgpy#whC_6beqHolX!WJtUk-Zx zLe~o9V_)_`7;`3FZs@|6NsfqwfcO<{GX6+MVP-n^zLgB^MpXTuIH1+g>kCg5vdd7Z zZ^1?GJ6O>NcabnOFdZ3m0!YYTKBPq(V^7d14wrid%TW`CBdiZbAx zCw(5=da)6nxkpe!+NTU4ThkoRT5;qlF*G6)7E^7U@Lt)?cl^niI|S6@fy#N&jYZmV yWaJ}9os{l!JfV6v#a@k-ox^Ns+3Mpm4%MyZEd+4gjr{q0r@XX^R2AfH!2bayq>;q{ literal 0 HcmV?d00001 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c75748..7b73e74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,6 +77,34 @@ jobs: echo "Flags: ${{ steps.buildx2.outputs.flags }}" echo "Platforms: ${{ steps.buildx2.outputs.platforms }}" + debug: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Create Dockerfile + run: | + cat > ./Dockerfile < 0) { + core.startGroup(`BuildKit container logs`); + yield mexec.exec('docker', ['logs', `${stateHelper.containerName}`], false).then(res => { + if (res.stderr != '' && !res.success) { + core.warning(res.stderr); + } + }); + core.endGroup(); + } + if (stateHelper.builderName.length > 0) { + core.startGroup(`Removing builder`); + yield mexec.exec('docker', ['buildx', 'rm', `${stateHelper.builderName}`], false).then(res => { + if (res.stderr != '' && !res.success) { + core.warning(res.stderr); + } + }); + core.endGroup(); } - yield mexec.exec('docker', ['buildx', 'rm', `${stateHelper.builderName}`], false).then(res => { - if (res.stderr != '' && !res.success) { - core.warning(res.stderr); - } - }); }); } if (!stateHelper.IsPost) { @@ -5623,14 +5640,24 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.setBuilderName = exports.builderName = exports.IsPost = void 0; +exports.setContainerName = exports.setBuilderName = exports.setDebug = exports.containerName = exports.builderName = exports.IsDebug = exports.IsPost = void 0; const core = __importStar(__webpack_require__(186)); exports.IsPost = !!process.env['STATE_isPost']; +exports.IsDebug = !!process.env['STATE_isDebug']; exports.builderName = process.env['STATE_builderName'] || ''; +exports.containerName = process.env['STATE_containerName'] || ''; +function setDebug(debug) { + core.saveState('isDebug', debug); +} +exports.setDebug = setDebug; function setBuilderName(builderName) { core.saveState('builderName', builderName); } exports.setBuilderName = setBuilderName; +function setContainerName(containerName) { + core.saveState('containerName', containerName); +} +exports.setContainerName = setContainerName; if (!exports.IsPost) { core.saveState('isPost', 'true'); } diff --git a/src/main.ts b/src/main.ts index 5a1e2b9..87540fd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -78,20 +78,38 @@ async function run(): Promise { context.setOutput('flags', builder.node_flags); context.setOutput('platforms', builder.node_platforms); core.endGroup(); + + if (inputs.driver == 'docker-container') { + stateHelper.setContainerName(`buildx_buildkit_${builder.node_name}`); + } + if (core.isDebug() || builder.node_flags?.includes('--debug')) { + stateHelper.setDebug('true'); + } } catch (error) { core.setFailed(error.message); } } async function cleanup(): Promise { - if (stateHelper.builderName.length == 0) { - return; + if (stateHelper.IsDebug && stateHelper.containerName.length > 0) { + core.startGroup(`BuildKit container logs`); + await mexec.exec('docker', ['logs', `${stateHelper.containerName}`], false).then(res => { + if (res.stderr != '' && !res.success) { + core.warning(res.stderr); + } + }); + core.endGroup(); + } + + if (stateHelper.builderName.length > 0) { + core.startGroup(`Removing builder`); + await mexec.exec('docker', ['buildx', 'rm', `${stateHelper.builderName}`], false).then(res => { + if (res.stderr != '' && !res.success) { + core.warning(res.stderr); + } + }); + core.endGroup(); } - await mexec.exec('docker', ['buildx', 'rm', `${stateHelper.builderName}`], false).then(res => { - if (res.stderr != '' && !res.success) { - core.warning(res.stderr); - } - }); } if (!stateHelper.IsPost) { diff --git a/src/state-helper.ts b/src/state-helper.ts index 6e675ea..bbdd05b 100644 --- a/src/state-helper.ts +++ b/src/state-helper.ts @@ -1,12 +1,22 @@ import * as core from '@actions/core'; export const IsPost = !!process.env['STATE_isPost']; +export const IsDebug = !!process.env['STATE_isDebug']; export const builderName = process.env['STATE_builderName'] || ''; +export const containerName = process.env['STATE_containerName'] || ''; + +export function setDebug(debug: string) { + core.saveState('isDebug', debug); +} export function setBuilderName(builderName: string) { core.saveState('builderName', builderName); } +export function setContainerName(containerName: string) { + core.saveState('containerName', containerName); +} + if (!IsPost) { core.saveState('isPost', 'true'); }