Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d926d8b7b | ||
|
|
293c3cdcfe | ||
|
|
17071615a7 | ||
|
|
0cc9e68b03 |
@@ -117,6 +117,43 @@ describe('create', () => {
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it('passes annotations to imagetools create', async () => {
|
||||
const getCommand = vi.fn().mockResolvedValue({
|
||||
command: 'docker',
|
||||
args: ['buildx', 'imagetools', 'create']
|
||||
});
|
||||
const buildx = {getCommand} as unknown as Buildx;
|
||||
|
||||
const execSpy = vi.spyOn(Exec, 'getExecOutput').mockResolvedValue({
|
||||
exitCode: 0,
|
||||
stdout: '',
|
||||
stderr: ''
|
||||
});
|
||||
|
||||
const result = await new ImageTools({buildx}).create({
|
||||
sources: ['docker.io/library/alpine:latest'],
|
||||
annotations: ['index:org.opencontainers.image.title=Alpine', 'manifest-descriptor:org.opencontainers.image.description=Base image'],
|
||||
silent: true
|
||||
});
|
||||
|
||||
expect(getCommand).toHaveBeenCalledWith([
|
||||
'imagetools',
|
||||
'create',
|
||||
'--annotation',
|
||||
'index:org.opencontainers.image.title=Alpine',
|
||||
'--annotation',
|
||||
'manifest-descriptor:org.opencontainers.image.description=Base image',
|
||||
'--metadata-file',
|
||||
metadataFile,
|
||||
'docker.io/library/alpine:latest'
|
||||
]);
|
||||
expect(execSpy).toHaveBeenCalledWith('docker', ['buildx', 'imagetools', 'create'], {
|
||||
ignoreReturnCode: true,
|
||||
silent: true
|
||||
});
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it('skips command execution when skipExec is enabled', async () => {
|
||||
const getCommand = vi.fn().mockResolvedValue({
|
||||
command: 'docker',
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^6.2.0",
|
||||
"@actions/artifact": "^6.2.1",
|
||||
"@actions/cache": "^6.0.0",
|
||||
"@actions/core": "^3.0.0",
|
||||
"@actions/exec": "^3.0.0",
|
||||
|
||||
@@ -153,6 +153,11 @@ export class ImageTools {
|
||||
args.push('--platform', platform);
|
||||
}
|
||||
}
|
||||
if (opts.annotations) {
|
||||
for (const annotation of opts.annotations) {
|
||||
args.push('--annotation', annotation);
|
||||
}
|
||||
}
|
||||
if (opts.dryRun) {
|
||||
args.push('--dry-run');
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface CreateOpts {
|
||||
sources: Array<string>;
|
||||
tags?: Array<string>;
|
||||
platforms?: Array<string>;
|
||||
annotations?: Array<string>;
|
||||
dryRun?: boolean;
|
||||
silent?: boolean;
|
||||
skipExec?: boolean;
|
||||
|
||||
10
yarn.lock
10
yarn.lock
@@ -12,9 +12,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@actions/artifact@npm:^6.2.0":
|
||||
version: 6.2.0
|
||||
resolution: "@actions/artifact@npm:6.2.0"
|
||||
"@actions/artifact@npm:^6.2.1":
|
||||
version: 6.2.1
|
||||
resolution: "@actions/artifact@npm:6.2.1"
|
||||
dependencies:
|
||||
"@actions/core": "npm:^3.0.0"
|
||||
"@actions/github": "npm:^9.0.0"
|
||||
@@ -30,7 +30,7 @@ __metadata:
|
||||
archiver: "npm:^7.0.1"
|
||||
jwt-decode: "npm:^4.0.0"
|
||||
unzip-stream: "npm:^0.3.1"
|
||||
checksum: 10/fa931b1222c0e08bca85d3cb18c2cd5ae912cce3f09ab3acd4ec3486e864337d65177089a14aef124d9696b9dd5309b273a9251e230172c79c2444af2c43443e
|
||||
checksum: 10/1fad9b079ee2ab07f964b93bf7b4fc594d115199219baed74ac3bf2a8675e0b7ea57252eccbcdaaaa8fc8375742d23585cbd054f3b2d029c091817e0f257ce93
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -370,7 +370,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@docker/actions-toolkit@workspace:."
|
||||
dependencies:
|
||||
"@actions/artifact": "npm:^6.2.0"
|
||||
"@actions/artifact": "npm:^6.2.1"
|
||||
"@actions/cache": "npm:^6.0.0"
|
||||
"@actions/core": "npm:^3.0.0"
|
||||
"@actions/exec": "npm:^3.0.0"
|
||||
|
||||
Reference in New Issue
Block a user