Support downloading binaries from docker images

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2024-10-29 16:56:57 +01:00
parent 810b53a8ba
commit cd5049af64
5 changed files with 185 additions and 19 deletions

View File

@ -21,8 +21,11 @@ describe('getInputs', () => {
['set-host', 'false'],
]),
{
version: 'v24.0.8',
channel: '',
source: {
type: 'archive',
version: 'v24.0.8',
channel: 'stable'
},
context: '',
daemonConfig: '',
setHost: false
@ -38,8 +41,11 @@ describe('getInputs', () => {
['set-host', 'false'],
]),
{
version: 'v24.0.0-rc.4',
channel: 'test',
source: {
type: 'archive',
version: 'v24.0.0-rc.4',
channel: 'test'
},
context: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
setHost: false
@ -51,13 +57,100 @@ describe('getInputs', () => {
['set-host', 'true'],
]),
{
version: 'latest',
channel: '',
source: {
type: 'archive',
version: 'latest',
channel: 'stable',
},
context: '',
daemonConfig: '',
setHost: true
} as context.Inputs
]
],
[
3,
new Map<string, string>([
['version', 'type=image,tag=master'],
['context', 'foo'],
['daemon-config', `{"debug":true,"features":{"containerd-snapshotter":true}}`],
['set-host', 'false'],
]),
{
source: {
type: 'image',
tag: 'master',
},
context: 'foo',
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
setHost: false
} as context.Inputs
],
[
4,
new Map<string, string>([
['version', 'type=image'],
['set-host', 'false'],
]),
{
source: {
type: 'image',
tag: 'latest',
},
context: '',
daemonConfig: '',
setHost: false
} as context.Inputs
],
[
5,
new Map<string, string>([
['version', 'type=archive'],
['set-host', 'false'],
]),
{
source: {
type: 'archive',
version: 'latest',
channel: 'stable',
},
setHost: false,
context: '',
daemonConfig: '',
} as context.Inputs
],
[
6,
new Map<string, string>([
['version', 'version=v27.2.0,channel=test'],
['set-host', 'false'],
]),
{
source: {
type: 'archive',
version: 'v27.2.0',
channel: 'test',
},
setHost: false,
context: '',
daemonConfig: '',
} as context.Inputs
],
[
7,
new Map<string, string>([
['version', 'type=image,tag=27.2.1'],
['set-host', 'false'],
]),
{
source: {
type: 'image',
tag: '27.2.1',
},
setHost: false,
context: '',
daemonConfig: '',
} as context.Inputs
],
])(
'[%d] given %p as inputs, returns %p',
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {