feat: add support for Docker Build Cloud summary#1370
feat: add support for Docker Build Cloud summary#1370nico1510 wants to merge 3 commits intodocker:masterfrom
Conversation
… state - Add summaryType state to distinguish between buildx and cloud summaries. - Generate a Docker Build Cloud summary with a direct link to build details on app.docker.com when using the cloud driver. - Refactor state-helper to use summaryType instead of isSummarySupported. - Improve summary selection logic and output for both buildx and cloud drivers. - Add informative logging for cloud build summary links. Signed-off-by: Nicolas Beck <[email protected]>
Signed-off-by: Nicolas Beck <[email protected]>
fd4aebd to
7b9dfc5
Compare
src/main.ts
Outdated
| } 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'); |
There was a problem hiding this comment.
We should just remove this condition if we support cloud driver imo.
src/main.ts
Outdated
| } else { | ||
| core.info('Build summary supported!'); | ||
| stateHelper.setSummarySupported(); | ||
| stateHelper.setSummaryType('buildx'); |
There was a problem hiding this comment.
I think we should keep setSummarySupported but have a new state helper const setBuilderDriver for builder driver that we could use in post state.
src/main.ts
Outdated
| } 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(); | ||
| } |
There was a problem hiding this comment.
Related to previous comment we can remove this condition and we should move this logic to the actions-toolkit in GitHub.writeBuildSummary: https://github.com/docker/actions-toolkit/blob/ba0e8d7ed8b86856c1605c90b57f7ee543d6740b/src/github.ts#L229 so it can be used with bake-action as well.
Btw how multiple builds with bake would be handled?: https://github.com/docker/bake-action/blob/76f9fa3a758507623da19f6092dc4089a7e61592/src/main.ts#L210-L246
We need to be consistent between both build-push-action and bake-action imo. I think for multiple builds with bake we could have the list of builds filtered like https://app.docker.com/build/accounts/docker/builds?refs=foo,bar if possible?
|
fixed in #1381 |
What’s Changed
clouddriver is used, the action now generates a summary with a direct link to the build details on app.docker.com.Test:
Run the action with both drivers and check the summary output for the correct link and format.
Example output:
