mirror of
https://github.com/docker/build-push-action.git
synced 2025-05-19 00:06:36 +00:00
PR feedback
This commit is contained in:
parent
7b9dfc5e09
commit
2257560108
29
src/main.ts
29
src/main.ts
@ -86,6 +86,9 @@ actionsToolkit.run(
|
|||||||
await core.group(`Builder info`, async () => {
|
await core.group(`Builder info`, async () => {
|
||||||
builder = await toolkit.builder.inspect(inputs.builder);
|
builder = await toolkit.builder.inspect(inputs.builder);
|
||||||
core.info(JSON.stringify(builder, null, 2));
|
core.info(JSON.stringify(builder, null, 2));
|
||||||
|
if (builder && builder.driver) {
|
||||||
|
stateHelper.setBuilderDriver(builder.driver);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const args: string[] = await context.getArgs(inputs, toolkit);
|
const args: string[] = await context.getArgs(inputs, toolkit);
|
||||||
@ -173,14 +176,11 @@ actionsToolkit.run(
|
|||||||
core.info('Build summary is not yet supported on GHES');
|
core.info('Build summary is not yet supported on GHES');
|
||||||
} 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') {
|
|
||||||
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.setSummaryType('buildx');
|
stateHelper.setSummarySupported();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ actionsToolkit.run(
|
|||||||
},
|
},
|
||||||
// post
|
// post
|
||||||
async () => {
|
async () => {
|
||||||
if (stateHelper.summaryType === 'buildx') {
|
if (stateHelper.isSummarySupported && stateHelper.builderDriver !== 'cloud') {
|
||||||
await core.group(`Generating build summary`, async () => {
|
await core.group(`Generating build summary`, async () => {
|
||||||
try {
|
try {
|
||||||
const recordUploadEnabled = buildRecordUploadEnabled();
|
const recordUploadEnabled = buildRecordUploadEnabled();
|
||||||
@ -223,19 +223,16 @@ actionsToolkit.run(
|
|||||||
core.warning(e.message);
|
core.warning(e.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (stateHelper.summaryType === 'cloud' && stateHelper.buildRef) {
|
} else if (stateHelper.isSummarySupported && stateHelper.builderDriver === 'cloud') {
|
||||||
const [, platform, refId] = stateHelper.buildRef.split('/');
|
const [, platform, refId] = stateHelper.buildRef.split('/');
|
||||||
if (platform && refId) {
|
await GitHub.writeCloudSummary([
|
||||||
const buildUrl = `https://app.docker.com/build/accounts/docker/builds/${platform}/${refId}`;
|
{
|
||||||
|
platform: platform,
|
||||||
core.info(`View build details: ${buildUrl}`);
|
refId: refId
|
||||||
|
}
|
||||||
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 () => {
|
||||||
try {
|
try {
|
||||||
|
@ -6,7 +6,8 @@ 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 summaryType = process.env['STATE_summaryType'] || undefined;
|
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
|
||||||
|
export const builderDriver = process.env['STATE_builderDriver'] || '';
|
||||||
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 +18,12 @@ export function setBuildRef(buildRef: string) {
|
|||||||
core.saveState('buildRef', buildRef);
|
core.saveState('buildRef', buildRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setSummaryType(summaryType: string) {
|
export function setSummarySupported() {
|
||||||
core.saveState('summaryType', summaryType);
|
core.saveState('isSummarySupported', 'true');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setBuilderDriver(driver: string) {
|
||||||
|
core.saveState('builderDriver', driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setSummaryInputs(inputs: Inputs) {
|
export function setSummaryInputs(inputs: Inputs) {
|
||||||
|
Loading…
Reference in New Issue
Block a user