From 5bbbdb2916f12f42dbc23ea9c31bb22ca265cd14 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 29 May 2024 14:48:02 +0200 Subject: [PATCH] don't generate summary for cloud driver Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/main.ts | 5 +++++ src/state-helper.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/main.ts b/src/main.ts index fb46346..ce675b8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -86,6 +86,7 @@ actionsToolkit.run( await core.group(`Builder info`, async () => { const builder = await toolkit.builder.inspect(inputs.builder); core.info(JSON.stringify(builder, null, 2)); + stateHelper.setBuilder(builder); }); let definition: BakeDefinition | undefined; @@ -170,6 +171,10 @@ actionsToolkit.run( core.info('Summary disabled'); return; } + if (stateHelper.builder && stateHelper.builder.driver === 'cloud') { + core.info('Summary is not yet supported with Docker Build Cloud'); + return; + } try { const buildxHistory = new BuildxHistory(); const exportRes = await buildxHistory.export({ diff --git a/src/state-helper.ts b/src/state-helper.ts index 736693b..66cf263 100644 --- a/src/state-helper.ts +++ b/src/state-helper.ts @@ -1,11 +1,13 @@ import * as core from '@actions/core'; import {BakeDefinition} from '@docker/actions-toolkit/lib/types/buildx/bake'; +import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder'; import {Inputs, sanitizeInputs} from './context'; export const tmpDir = process.env['STATE_tmpDir'] || ''; export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined; +export const builder = process.env['STATE_builder'] ? JSON.parse(process.env['STATE_builder']) : undefined; export const bakeDefinition = process.env['STATE_bakeDefinition'] ? JSON.parse(process.env['STATE_bakeDefinition']) : undefined; export const buildRefs = process.env['STATE_buildRefs'] ? process.env['STATE_buildRefs'].split(',') : []; @@ -17,6 +19,10 @@ export function setInputs(inputs: Inputs) { core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs))); } +export function setBuilder(builder: BuilderInfo) { + core.saveState('builder', JSON.stringify(builder)); +} + export function setBakeDefinition(bakeDefinition: BakeDefinition) { core.saveState('bakeDefinition', JSON.stringify(bakeDefinition)); }