mirror of
https://github.com/docker/build-push-action.git
synced 2025-05-06 13:39:30 +02:00
Merge 7b9dfc5e09
into 14487ce63c
This commit is contained in:
commit
5e830cb41f
4 changed files with 22 additions and 9 deletions
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
21
src/main.ts
21
src/main.ts
|
@ -50,7 +50,7 @@ actionsToolkit.run(
|
||||||
let dockerConfig: ConfigFile | undefined;
|
let dockerConfig: ConfigFile | undefined;
|
||||||
let dockerConfigMalformed = false;
|
let dockerConfigMalformed = false;
|
||||||
try {
|
try {
|
||||||
dockerConfig = await Docker.configFile();
|
dockerConfig = Docker.configFile();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dockerConfigMalformed = true;
|
dockerConfigMalformed = true;
|
||||||
core.warning(`Unable to parse config file ${path.join(Docker.configDir, 'config.json')}: ${e}`);
|
core.warning(`Unable to parse config file ${path.join(Docker.configDir, 'config.json')}: ${e}`);
|
||||||
|
@ -174,12 +174,13 @@ actionsToolkit.run(
|
||||||
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
||||||
core.info('Build summary requires Buildx >= 0.13.0');
|
core.info('Build summary requires Buildx >= 0.13.0');
|
||||||
} else if (builder && builder.driver === 'cloud') {
|
} else if (builder && builder.driver === 'cloud') {
|
||||||
core.info('Build summary is not yet supported with Docker Build Cloud');
|
core.info('Build summary supported for cloud driver!');
|
||||||
|
stateHelper.setSummaryType('cloud');
|
||||||
} else if (!ref) {
|
} else if (!ref) {
|
||||||
core.info('Build summary requires a build reference');
|
core.info('Build summary requires a build reference');
|
||||||
} else {
|
} else {
|
||||||
core.info('Build summary supported!');
|
core.info('Build summary supported!');
|
||||||
stateHelper.setSummarySupported();
|
stateHelper.setSummaryType('buildx');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ actionsToolkit.run(
|
||||||
},
|
},
|
||||||
// post
|
// post
|
||||||
async () => {
|
async () => {
|
||||||
if (stateHelper.isSummarySupported) {
|
if (stateHelper.summaryType === 'buildx') {
|
||||||
await core.group(`Generating build summary`, async () => {
|
await core.group(`Generating build summary`, async () => {
|
||||||
try {
|
try {
|
||||||
const recordUploadEnabled = buildRecordUploadEnabled();
|
const recordUploadEnabled = buildRecordUploadEnabled();
|
||||||
|
@ -222,6 +223,18 @@ actionsToolkit.run(
|
||||||
core.warning(e.message);
|
core.warning(e.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (stateHelper.summaryType === 'cloud' && stateHelper.buildRef) {
|
||||||
|
const [, platform, refId] = stateHelper.buildRef.split('/');
|
||||||
|
if (platform && refId) {
|
||||||
|
const buildUrl = `https://app.docker.com/build/accounts/docker/builds/${platform}/${refId}`;
|
||||||
|
|
||||||
|
core.info(`View build details: ${buildUrl}`);
|
||||||
|
|
||||||
|
const sum = core.summary.addHeading('Docker Build Cloud summary', 2);
|
||||||
|
sum.addRaw('<p>').addRaw('Your build was executed using Docker Build Cloud. ').addRaw('You can view detailed build information, logs, and results here: ').addLink(buildUrl, buildUrl).addRaw('</p>');
|
||||||
|
sum.addRaw('<p>').addRaw('For more information about Docker Build Cloud, see ').addLink('the documentation', 'https://docs.docker.com/build/cloud/').addRaw('.').addRaw('</p>');
|
||||||
|
await sum.addSeparator().write();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (stateHelper.tmpDir.length > 0) {
|
if (stateHelper.tmpDir.length > 0) {
|
||||||
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
|
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {Inputs} from './context';
|
||||||
|
|
||||||
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
||||||
export const buildRef = process.env['STATE_buildRef'] || '';
|
export const buildRef = process.env['STATE_buildRef'] || '';
|
||||||
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
|
export const summaryType = process.env['STATE_summaryType'] || undefined;
|
||||||
export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined;
|
export const summaryInputs = process.env['STATE_summaryInputs'] ? JSON.parse(process.env['STATE_summaryInputs']) : undefined;
|
||||||
|
|
||||||
export function setTmpDir(tmpDir: string) {
|
export function setTmpDir(tmpDir: string) {
|
||||||
|
@ -17,8 +17,8 @@ export function setBuildRef(buildRef: string) {
|
||||||
core.saveState('buildRef', buildRef);
|
core.saveState('buildRef', buildRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setSummarySupported() {
|
export function setSummaryType(summaryType: string) {
|
||||||
core.saveState('isSummarySupported', 'true');
|
core.saveState('summaryType', summaryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setSummaryInputs(inputs: Inputs) {
|
export function setSummaryInputs(inputs: Inputs) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue