-
Notifications
You must be signed in to change notification settings - Fork 616
feat: add support for Docker Build Cloud summary #1370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With #1364 we could have both export and link to the build for cloud driver I think.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just remove this condition if we support cloud driver imo.
src/main.ts
Outdated
} else if (!ref) { | ||
core.info('Build summary requires a build reference'); | ||
} else { | ||
core.info('Build summary supported!'); | ||
stateHelper.setSummarySupported(); | ||
stateHelper.setSummaryType('buildx'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
What’s Changed
cloud
driver 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:
