2023-02-20 18:11:15 +08:00
|
|
|
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
2020-10-20 03:17:06 +08:00
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as path from 'path';
|
2024-05-14 20:11:32 +08:00
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
import {Builder} from '@docker/actions-toolkit/lib/buildx/builder';
|
|
|
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
2024-05-14 20:11:32 +08:00
|
|
|
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
|
2023-02-20 18:11:15 +08:00
|
|
|
import {Context} from '@docker/actions-toolkit/lib/context';
|
2023-03-13 06:34:24 +08:00
|
|
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
2023-02-20 18:11:15 +08:00
|
|
|
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
|
|
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
2024-05-14 20:11:32 +08:00
|
|
|
|
2024-05-27 18:45:25 +08:00
|
|
|
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder';
|
2023-02-20 18:11:15 +08:00
|
|
|
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
|
2020-11-18 04:38:45 +08:00
|
|
|
|
2020-10-22 03:07:52 +08:00
|
|
|
import * as context from '../src/context';
|
2020-10-20 03:17:06 +08:00
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
const tmpDir = path.join('/tmp', '.docker-build-push-jest');
|
|
|
|
const tmpName = path.join(tmpDir, '.tmpname-jest');
|
2020-11-18 04:38:45 +08:00
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
import repoFixture from './fixtures/github-repo.json';
|
|
|
|
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
|
|
|
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
2020-10-20 03:17:06 +08:00
|
|
|
});
|
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
jest.spyOn(Context, 'tmpDir').mockImplementation((): string => {
|
2020-10-20 03:17:06 +08:00
|
|
|
if (!fs.existsSync(tmpDir)) {
|
|
|
|
fs.mkdirSync(tmpDir, {recursive: true});
|
|
|
|
}
|
|
|
|
return tmpDir;
|
|
|
|
});
|
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
|
|
|
return tmpName;
|
|
|
|
});
|
|
|
|
|
|
|
|
jest.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean> => {
|
|
|
|
return true;
|
2020-10-20 03:17:06 +08:00
|
|
|
});
|
|
|
|
|
2024-05-14 20:11:32 +08:00
|
|
|
const metadataJson = path.join(tmpDir, 'metadata.json');
|
|
|
|
jest.spyOn(Build.prototype, 'getMetadataFilePath').mockImplementation((): string => {
|
|
|
|
return metadataJson;
|
|
|
|
});
|
|
|
|
|
|
|
|
const imageIDFilePath = path.join(tmpDir, 'iidfile.txt');
|
|
|
|
jest.spyOn(Build.prototype, 'getImageIDFilePath').mockImplementation((): string => {
|
|
|
|
return imageIDFilePath;
|
|
|
|
});
|
|
|
|
|
2023-02-20 18:11:15 +08:00
|
|
|
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
|
|
|
return {
|
|
|
|
name: 'builder2',
|
|
|
|
driver: 'docker-container',
|
|
|
|
lastActivity: new Date('2023-01-16 09:45:23 +0000 UTC'),
|
|
|
|
nodes: [
|
|
|
|
{
|
2023-03-13 06:34:24 +08:00
|
|
|
buildkit: 'v0.11.0',
|
|
|
|
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
|
|
|
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
|
2023-02-20 18:11:15 +08:00
|
|
|
endpoint: 'unix:///var/run/docker.sock',
|
|
|
|
name: 'builder20',
|
|
|
|
platforms: 'linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6',
|
|
|
|
status: 'running'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
});
|
2023-01-13 19:57:15 +08:00
|
|
|
|
2020-10-20 03:17:06 +08:00
|
|
|
describe('getArgs', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
process.env = Object.keys(process.env).reduce((object, key) => {
|
|
|
|
if (!key.startsWith('INPUT_')) {
|
|
|
|
object[key] = process.env[key];
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}, {});
|
|
|
|
});
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
test.each([
|
2020-10-21 15:51:06 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
0,
|
2020-10-21 15:51:06 +08:00
|
|
|
'0.4.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-21 15:51:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2020-10-21 15:51:06 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2020-10-20 03:17:06 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
1,
|
2020-10-20 03:17:06 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
2023-01-13 19:57:15 +08:00
|
|
|
['build-args', `MY_ARG=val1,val2,val3
|
|
|
|
ARG=val
|
|
|
|
"MULTILINE=aaaa
|
|
|
|
bbbb
|
|
|
|
ccc"`],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-20 03:17:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2020-10-21 01:04:54 +08:00
|
|
|
'--build-arg', 'MY_ARG=val1,val2,val3',
|
|
|
|
'--build-arg', 'ARG=val',
|
2023-01-13 19:57:15 +08:00
|
|
|
'--build-arg', `MULTILINE=aaaa\nbbbb\nccc`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-02-20 18:11:15 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-10-20 03:17:06 +08:00
|
|
|
]
|
|
|
|
],
|
2020-12-05 10:40:39 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
2,
|
2020-12-05 10:40:39 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['tags', 'name/app:7.4, name/app:latest'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-12-05 10:40:39 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2020-12-05 10:40:39 +08:00
|
|
|
'--tag', 'name/app:7.4',
|
|
|
|
'--tag', 'name/app:latest',
|
2023-02-20 18:11:15 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-12-05 10:40:39 +08:00
|
|
|
]
|
|
|
|
],
|
2020-10-20 03:17:06 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
3,
|
2020-10-20 03:17:06 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
2020-10-21 01:04:54 +08:00
|
|
|
['labels', 'org.opencontainers.image.title=buildkit\norg.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['outputs', 'type=local,dest=./release-out'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-20 03:17:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2020-10-21 01:04:54 +08:00
|
|
|
'--label', 'org.opencontainers.image.title=buildkit',
|
|
|
|
'--label', 'org.opencontainers.image.description=concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit',
|
2020-10-20 03:17:06 +08:00
|
|
|
'--output', 'type=local,dest=./release-out',
|
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2020-10-21 15:51:06 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
4,
|
2020-10-21 15:51:06 +08:00
|
|
|
'0.4.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['platforms', 'linux/amd64,linux/arm64'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-21 15:51:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--platform', 'linux/amd64,linux/arm64',
|
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2020-10-20 03:17:06 +08:00
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
5,
|
2020-10-20 03:17:06 +08:00
|
|
|
'0.4.1',
|
|
|
|
new Map<string, string>([
|
2021-06-22 23:25:52 +08:00
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-20 03:17:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2020-10-20 03:17:06 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
6,
|
2020-10-20 03:17:06 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
2020-10-24 00:21:44 +08:00
|
|
|
['secrets', 'GIT_AUTH_TOKEN=abcdefghijklmno=0123456789'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-20 03:17:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
2020-10-20 03:17:06 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
7,
|
2020-10-20 03:17:06 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
2020-10-20 21:18:02 +08:00
|
|
|
['github-token', 'abcdefghijklmno0123456789'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['outputs', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-20 03:17:06 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2020-10-20 21:18:02 +08:00
|
|
|
'--output', '.',
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-10-20 03:17:06 +08:00
|
|
|
]
|
2020-10-21 08:46:41 +08:00
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
8,
|
2020-10-21 08:46:41 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
2021-04-26 17:02:09 +08:00
|
|
|
['context', 'https://github.com/docker/build-push-action.git#refs/heads/master'],
|
2020-10-21 08:46:41 +08:00
|
|
|
['tag', 'localhost:5000/name/app:latest'],
|
|
|
|
['platforms', 'linux/amd64,linux/arm64'],
|
2020-10-24 00:21:44 +08:00
|
|
|
['secrets', 'GIT_AUTH_TOKEN=abcdefghijklmno=0123456789'],
|
2020-10-21 08:46:41 +08:00
|
|
|
['file', './test/Dockerfile'],
|
|
|
|
['builder', 'builder-git-context-2'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'true'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-10-21 08:46:41 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2021-11-16 12:19:44 +08:00
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2021-11-16 12:19:44 +08:00
|
|
|
'--platform', 'linux/amd64,linux/arm64',
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
2020-10-21 08:46:41 +08:00
|
|
|
'--builder', 'builder-git-context-2',
|
|
|
|
'--push',
|
2021-04-26 17:02:09 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-10-21 08:46:41 +08:00
|
|
|
]
|
2020-11-18 04:38:45 +08:00
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
9,
|
2020-11-18 04:38:45 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
2021-04-26 17:02:09 +08:00
|
|
|
['context', 'https://github.com/docker/build-push-action.git#refs/heads/master'],
|
2020-11-18 04:38:45 +08:00
|
|
|
['tag', 'localhost:5000/name/app:latest'],
|
|
|
|
['platforms', 'linux/amd64,linux/arm64'],
|
|
|
|
['secrets', `GIT_AUTH_TOKEN=abcdefghi,jklmno=0123456789
|
|
|
|
"MYSECRET=aaaaaaaa
|
|
|
|
bbbbbbb
|
|
|
|
ccccccccc"
|
|
|
|
FOO=bar
|
|
|
|
"EMPTYLINE=aaaa
|
|
|
|
|
|
|
|
bbbb
|
|
|
|
ccc"`],
|
|
|
|
['file', './test/Dockerfile'],
|
|
|
|
['builder', 'builder-git-context-2'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'true'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-11-18 04:38:45 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2021-11-16 12:19:44 +08:00
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2021-11-16 12:19:44 +08:00
|
|
|
'--platform', 'linux/amd64,linux/arm64',
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
|
|
|
'--secret', `id=MYSECRET,src=${tmpName}`,
|
|
|
|
'--secret', `id=FOO,src=${tmpName}`,
|
|
|
|
'--secret', `id=EMPTYLINE,src=${tmpName}`,
|
2020-11-18 04:38:45 +08:00
|
|
|
'--builder', 'builder-git-context-2',
|
|
|
|
'--push',
|
2021-04-26 17:02:09 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-11-18 04:38:45 +08:00
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
10,
|
2020-11-18 04:38:45 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
2021-04-26 17:02:09 +08:00
|
|
|
['context', 'https://github.com/docker/build-push-action.git#refs/heads/master'],
|
2020-11-18 04:38:45 +08:00
|
|
|
['tag', 'localhost:5000/name/app:latest'],
|
|
|
|
['platforms', 'linux/amd64,linux/arm64'],
|
|
|
|
['secrets', `GIT_AUTH_TOKEN=abcdefghi,jklmno=0123456789
|
|
|
|
MYSECRET=aaaaaaaa
|
|
|
|
bbbbbbb
|
|
|
|
ccccccccc
|
|
|
|
FOO=bar
|
|
|
|
EMPTYLINE=aaaa
|
|
|
|
|
|
|
|
bbbb
|
|
|
|
ccc`],
|
|
|
|
['file', './test/Dockerfile'],
|
|
|
|
['builder', 'builder-git-context-2'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'true'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2020-11-18 04:38:45 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2021-11-16 12:19:44 +08:00
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2021-11-16 12:19:44 +08:00
|
|
|
'--platform', 'linux/amd64,linux/arm64',
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
|
|
|
'--secret', `id=MYSECRET,src=${tmpName}`,
|
|
|
|
'--secret', `id=FOO,src=${tmpName}`,
|
|
|
|
'--secret', `id=EMPTYLINE,src=${tmpName}`,
|
2020-11-18 04:38:45 +08:00
|
|
|
'--builder', 'builder-git-context-2',
|
|
|
|
'--push',
|
2021-04-26 17:02:09 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2020-11-18 04:38:45 +08:00
|
|
|
]
|
2021-02-15 17:08:19 +08:00
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
11,
|
2021-02-15 17:08:19 +08:00
|
|
|
'0.5.1',
|
|
|
|
new Map<string, string>([
|
2021-04-26 17:02:09 +08:00
|
|
|
['context', 'https://github.com/docker/build-push-action.git#refs/heads/master'],
|
2021-02-15 17:08:19 +08:00
|
|
|
['tag', 'localhost:5000/name/app:latest'],
|
2023-02-20 18:11:15 +08:00
|
|
|
['secret-files', `MY_SECRET=${path.join(__dirname, 'fixtures', 'secret.txt')}`],
|
2021-02-15 17:08:19 +08:00
|
|
|
['file', './test/Dockerfile'],
|
|
|
|
['builder', 'builder-git-context-2'],
|
2021-04-06 20:49:15 +08:00
|
|
|
['network', 'host'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'true'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2021-02-15 17:08:19 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2021-11-16 12:19:44 +08:00
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=MY_SECRET,src=${tmpName}`,
|
2021-02-15 17:08:19 +08:00
|
|
|
'--builder', 'builder-git-context-2',
|
2021-04-06 20:49:15 +08:00
|
|
|
'--network', 'host',
|
2021-02-15 17:08:19 +08:00
|
|
|
'--push',
|
2021-04-26 17:02:09 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master'
|
2021-02-15 17:08:19 +08:00
|
|
|
]
|
2021-05-23 08:41:02 +08:00
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
12,
|
2021-05-23 08:41:02 +08:00
|
|
|
'0.4.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['labels', 'org.opencontainers.image.title=filter_results_top_n\norg.opencontainers.image.description=Reference implementation of operation "filter results (top-n)"'],
|
2021-06-22 23:25:52 +08:00
|
|
|
['outputs', 'type=local,dest=./release-out'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2021-05-23 08:41:02 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--label', 'org.opencontainers.image.title=filter_results_top_n',
|
|
|
|
'--label', 'org.opencontainers.image.description=Reference implementation of operation "filter results (top-n)"',
|
|
|
|
'--output', 'type=local,dest=./release-out',
|
|
|
|
'.'
|
|
|
|
]
|
2021-08-17 05:44:13 +08:00
|
|
|
],
|
|
|
|
[
|
2021-11-16 12:19:44 +08:00
|
|
|
13,
|
2021-08-17 05:44:13 +08:00
|
|
|
'0.6.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['tag', 'localhost:5000/name/app:latest'],
|
|
|
|
['file', './test/Dockerfile'],
|
2022-01-31 18:47:45 +08:00
|
|
|
['add-hosts', 'docker:10.180.0.1,foo:10.0.0.1'],
|
2021-08-17 05:44:13 +08:00
|
|
|
['network', 'host'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'true'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['pull', 'false'],
|
2021-08-17 05:44:13 +08:00
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2022-01-31 18:47:45 +08:00
|
|
|
'--add-host', 'docker:10.180.0.1',
|
|
|
|
'--add-host', 'foo:10.0.0.1',
|
2021-11-16 12:19:44 +08:00
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
|
|
|
'--metadata-file', metadataJson,
|
2021-08-17 05:44:13 +08:00
|
|
|
'--network', 'host',
|
|
|
|
'--push',
|
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2021-11-16 14:19:27 +08:00
|
|
|
[
|
|
|
|
14,
|
|
|
|
'0.7.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['file', './test/Dockerfile'],
|
2022-01-31 18:47:45 +08:00
|
|
|
['add-hosts', 'docker:10.180.0.1\nfoo:10.0.0.1'],
|
2021-11-16 14:19:27 +08:00
|
|
|
['cgroup-parent', 'foo'],
|
|
|
|
['shm-size', '2g'],
|
|
|
|
['ulimit', `nofile=1024:1024
|
|
|
|
nproc=3`],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2022-01-31 01:33:31 +08:00
|
|
|
'--add-host', 'docker:10.180.0.1',
|
2022-01-31 18:47:45 +08:00
|
|
|
'--add-host', 'foo:10.0.0.1',
|
2021-11-16 14:19:27 +08:00
|
|
|
'--cgroup-parent', 'foo',
|
|
|
|
'--file', './test/Dockerfile',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2021-11-16 14:19:27 +08:00
|
|
|
'--shm-size', '2g',
|
|
|
|
'--ulimit', 'nofile=1024:1024',
|
|
|
|
'--ulimit', 'nproc=3',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2021-11-16 14:19:27 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2021-12-28 07:49:32 +08:00
|
|
|
[
|
|
|
|
15,
|
|
|
|
'0.7.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '{{defaultContext}}:docker'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
|
|
|
'--metadata-file', metadataJson,
|
2023-02-20 18:11:15 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master:docker'
|
2021-12-28 07:49:32 +08:00
|
|
|
]
|
|
|
|
],
|
2022-08-03 20:38:56 +08:00
|
|
|
[
|
|
|
|
16,
|
|
|
|
'0.8.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['github-token', 'abcdefghijklmno0123456789'],
|
|
|
|
['context', '{{defaultContext}}:subdir'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-02-20 18:11:15 +08:00
|
|
|
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-02-20 18:11:15 +08:00
|
|
|
'https://github.com/docker/build-push-action.git#refs/heads/master:subdir'
|
2022-08-03 20:38:56 +08:00
|
|
|
]
|
2023-01-13 19:57:15 +08:00
|
|
|
],
|
|
|
|
[
|
|
|
|
17,
|
|
|
|
'0.8.2',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'true'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
18,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
19,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'true'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
20,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'mode=max'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
21,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-03-26 22:31:37 +08:00
|
|
|
'--attest', 'type=provenance,disabled=true',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
22,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'builder-id=foo'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-03-26 22:31:37 +08:00
|
|
|
'--attest', 'type=provenance,builder-id=foo',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-13 19:57:15 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2023-01-27 21:06:06 +08:00
|
|
|
[
|
|
|
|
23,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['outputs', 'type=docker'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-01-27 21:06:06 +08:00
|
|
|
"--output", 'type=docker',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-27 21:06:06 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
24,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'true'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-06-13 16:52:03 +08:00
|
|
|
'--load',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-06-13 16:52:03 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
25,
|
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['build-args', `FOO=bar#baz`],
|
|
|
|
['load', 'true'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--build-arg', 'FOO=bar#baz',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-09-26 22:34:10 +08:00
|
|
|
'--load',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-09-26 22:34:10 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2024-03-26 22:31:37 +08:00
|
|
|
26,
|
2023-09-26 22:34:10 +08:00
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['load', 'true'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['secret-envs', `MY_SECRET=MY_SECRET_ENV
|
|
|
|
ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--secret', 'id=MY_SECRET,env=MY_SECRET_ENV',
|
|
|
|
'--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-09-26 22:34:10 +08:00
|
|
|
'--load',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-09-26 22:34:10 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2024-03-26 22:31:37 +08:00
|
|
|
27,
|
2023-09-26 22:34:10 +08:00
|
|
|
'0.10.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['load', 'true'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['secret-envs', 'MY_SECRET=MY_SECRET_ENV,ANOTHER_SECRET=ANOTHER_SECRET_ENV']
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--secret', 'id=MY_SECRET,env=MY_SECRET_ENV',
|
|
|
|
'--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2023-02-20 18:11:15 +08:00
|
|
|
'--load',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-01-27 21:06:06 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2023-10-24 13:23:44 +08:00
|
|
|
[
|
2024-03-26 22:31:37 +08:00
|
|
|
28,
|
2023-10-24 13:23:44 +08:00
|
|
|
'0.11.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'],
|
|
|
|
['outputs', 'type=local,dest=./release-out'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--output', 'type=local,dest=./release-out',
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-10-24 13:23:44 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2024-03-26 22:31:37 +08:00
|
|
|
29,
|
2023-10-24 13:23:44 +08:00
|
|
|
'0.12.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['annotations', 'example1=www\nindex:example2=xxx\nmanifest:example3=yyy\nmanifest-descriptor[linux/amd64]:example4=zzz'],
|
|
|
|
['outputs', 'type=local,dest=./release-out'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--annotation', 'example1=www',
|
|
|
|
'--annotation', 'index:example2=xxx',
|
|
|
|
'--annotation', 'manifest:example3=yyy',
|
|
|
|
'--annotation', 'manifest-descriptor[linux/amd64]:example4=zzz',
|
|
|
|
'--output', 'type=local,dest=./release-out',
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2024-03-06 22:25:57 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
2024-03-26 22:31:37 +08:00
|
|
|
30,
|
2024-03-06 22:25:57 +08:00
|
|
|
'0.12.0',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['outputs', `type=image,"name=localhost:5000/name/app:latest,localhost:5000/name/app:foo",push-by-digest=true,name-canonical=true,push=true`],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-03-06 22:25:57 +08:00
|
|
|
"--output", `type=image,"name=localhost:5000/name/app:latest,localhost:5000/name/app:foo",push-by-digest=true,name-canonical=true,push=true`,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2023-10-24 13:23:44 +08:00
|
|
|
'.'
|
|
|
|
]
|
2024-03-26 22:31:37 +08:00
|
|
|
],
|
|
|
|
[
|
|
|
|
31,
|
|
|
|
'0.13.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['provenance', 'mode=max'],
|
|
|
|
['sbom', 'true'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-03-26 22:31:37 +08:00
|
|
|
'--attest', `type=sbom,disabled=false`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2024-03-26 22:31:37 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
32,
|
|
|
|
'0.13.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['attests', 'type=provenance,mode=min'],
|
|
|
|
['provenance', 'mode=max'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2024-03-26 22:31:37 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
33,
|
|
|
|
'0.13.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['attests', 'type=provenance,mode=min'],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
2024-05-14 20:11:32 +08:00
|
|
|
'--iidfile', imageIDFilePath,
|
2024-06-10 21:05:57 +08:00
|
|
|
'--attest', `type=provenance,mode=min,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-06-10 21:26:39 +08:00
|
|
|
'--metadata-file', metadataJson,
|
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
|
|
|
[
|
|
|
|
34,
|
|
|
|
'0.14.1',
|
|
|
|
new Map<string, string>([
|
|
|
|
['context', '.'],
|
|
|
|
['load', 'false'],
|
|
|
|
['no-cache', 'false'],
|
|
|
|
['push', 'false'],
|
|
|
|
['pull', 'false'],
|
|
|
|
['cache-to', 'type=gha'],
|
|
|
|
['github-token', `abcd1234`],
|
|
|
|
]),
|
|
|
|
[
|
|
|
|
'build',
|
|
|
|
'--cache-to', 'type=gha,repository=docker/build-push-action,ghtoken=abcd1234',
|
|
|
|
'--iidfile', imageIDFilePath,
|
|
|
|
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789/attempts/1`,
|
2024-05-14 20:11:32 +08:00
|
|
|
'--metadata-file', metadataJson,
|
2024-03-26 22:31:37 +08:00
|
|
|
'.'
|
|
|
|
]
|
|
|
|
],
|
2020-10-20 03:17:06 +08:00
|
|
|
])(
|
2021-11-16 12:19:44 +08:00
|
|
|
'[%d] given %p with %p as inputs, returns %p',
|
2022-03-16 04:59:52 +08:00
|
|
|
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
|
|
|
|
inputs.forEach((value: string, name: string) => {
|
2020-10-20 03:17:06 +08:00
|
|
|
setInput(name, value);
|
|
|
|
});
|
2023-02-20 18:11:15 +08:00
|
|
|
const toolkit = new Toolkit();
|
|
|
|
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
|
|
|
return buildxVersion;
|
|
|
|
});
|
2023-04-17 07:32:21 +08:00
|
|
|
const inp = await context.getInputs();
|
2023-02-20 18:11:15 +08:00
|
|
|
const res = await context.getArgs(inp, toolkit);
|
2020-10-20 03:17:06 +08:00
|
|
|
expect(res).toEqual(expected);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
2020-08-17 08:32:27 +08:00
|
|
|
|
2021-06-22 23:25:52 +08:00
|
|
|
// See: https://github.com/actions/toolkit/blob/a1b068ec31a042ff1e10a522d8fdf0b8869d53ca/packages/core/src/core.ts#L89
|
2020-08-17 08:32:27 +08:00
|
|
|
function getInputName(name: string): string {
|
|
|
|
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setInput(name: string, value: string): void {
|
|
|
|
process.env[getInputName(name)] = value;
|
|
|
|
}
|