Compare commits

..

6 Commits

Author SHA1 Message Date
CrazyMax
118e1982f9
Merge 058dae76f7 into df19a799eb 2024-05-15 09:09:13 +00:00
CrazyMax
058dae76f7
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 11:09:03 +02:00
CrazyMax
607c3f5f5a
DOCKER_BUILD_NO_SUMMARY env to disable summary
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 11:03:16 +02:00
CrazyMax
3602ada5a6
generate build summary
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 11:03:16 +02:00
CrazyMax
3d2a1b1a79
export build record and upload artifact
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 11:03:16 +02:00
CrazyMax
807c89a65a
bump to actions-toolkit dev
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-05-15 11:03:16 +02:00
8 changed files with 37 additions and 23 deletions

View File

@ -256,6 +256,12 @@ The following outputs are available:
| `digest` | String | Image digest |
| `metadata` | JSON | Build result metadata |
### environment variables
| Name | Type | Description |
|---------------------------|------|-------------------------------------------------|
| `DOCKER_BUILD_NO_SUMMARY` | Bool | If `true`, build summary generation is disabled |
## Troubleshooting
See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)

4
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

2
dist/licenses.txt generated vendored
View File

@ -2807,7 +2807,7 @@ minimatch
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above

View File

@ -79,6 +79,25 @@ export async function getInputs(): Promise<Inputs> {
};
}
export function sanitizeInputs(inputs: Inputs) {
const res = {};
for (const key of Object.keys(inputs)) {
if (key === 'github-token') {
continue;
}
const value: string | string[] | boolean = inputs[key];
if (typeof value === 'boolean' && value === false) {
continue;
} else if (Array.isArray(value) && value.length === 0) {
continue;
} else if (!value) {
continue;
}
res[key] = value;
}
return res;
}
export async function getArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
const context = handlebars.compile(inputs.context)({
defaultContext: Context.gitContext()

View File

@ -136,6 +136,10 @@ actionsToolkit.run(
async () => {
if (stateHelper.buildRef.length > 0) {
await core.group(`Generating build summary`, async () => {
if (process.env.DOCKER_BUILD_NO_SUMMARY && Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY)) {
core.info('Summary disabled');
return;
}
try {
const buildxHistory = new BuildxHistory();
const exportRes = await buildxHistory.export({

View File

@ -1,6 +1,6 @@
import * as core from '@actions/core';
import {Inputs} from './context';
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;
@ -11,22 +11,7 @@ export function setTmpDir(tmpDir: string) {
}
export function setInputs(inputs: Inputs) {
const newInputs = {};
for (const key of Object.keys(inputs)) {
if (key === 'github-token') {
continue;
}
const value: string | string[] | boolean = inputs[key];
if (typeof value === 'boolean' && value === false) {
continue;
} else if (Array.isArray(value) && value.length === 0) {
continue;
} else if (!value) {
continue;
}
newInputs[key] = value;
}
core.saveState('inputs', JSON.stringify(newInputs));
core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs)));
}
export function setBuildRef(buildRef: string) {

View File

@ -1057,7 +1057,7 @@ __metadata:
"@docker/actions-toolkit@https://github.com/crazy-max/docker-actions-toolkit#summary-test":
version: 0.0.0+unknown
resolution: "@docker/actions-toolkit@https://github.com/crazy-max/docker-actions-toolkit.git#commit=3bf4429db863cb5fc40af57778d3dc44b794d5a0"
resolution: "@docker/actions-toolkit@https://github.com/crazy-max/docker-actions-toolkit.git#commit=bb135ac93a8bf3ff63207e56e2fdcd4c1f4fe8d2"
dependencies:
"@actions/artifact": ^2.1.7
"@actions/cache": ^3.2.4
@ -1077,7 +1077,7 @@ __metadata:
jwt-decode: ^4.0.0
semver: ^7.6.2
tmp: ^0.2.3
checksum: d285217419e425f116ea85f6abf10e9cb2604f28f7760e8cf374f1b756c8529e7d098bcd224929a89b4c4b4b00c10a7f0591cfb9dc649bdb9dc9604a687e31e2
checksum: 1bdcfebcb3d7d6a16942e8418e5b9ef93270eb686b3f00de831d0f26f6dc41f6aef4314c5321616789bcfd4adf2b5640092fffa17b07528aed18ce8a9ea4b54c
languageName: node
linkType: hard