mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-04-23 16:36:37 +02:00
make cloud prefix optional to download buildx if driver is cloud
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
db63cee3de
commit
7199e57b35
4 changed files with 155 additions and 5 deletions
|
@ -323,6 +323,140 @@ describe('getAppendArgs', () => {
|
|||
);
|
||||
});
|
||||
|
||||
describe('getVersion', () => {
|
||||
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([
|
||||
[
|
||||
0,
|
||||
new Map<string, string>([
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
''
|
||||
],
|
||||
[
|
||||
1,
|
||||
new Map<string, string>([
|
||||
['version', 'latest'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true']
|
||||
]),
|
||||
'latest'
|
||||
],
|
||||
[
|
||||
2,
|
||||
new Map<string, string>([
|
||||
['version', 'edge'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true']
|
||||
]),
|
||||
'edge'
|
||||
],
|
||||
[
|
||||
3,
|
||||
new Map<string, string>([
|
||||
['version', 'v0.19.2'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true']
|
||||
]),
|
||||
'v0.19.2'
|
||||
],
|
||||
[
|
||||
4,
|
||||
new Map<string, string>([
|
||||
['version', 'latest'],
|
||||
['driver', 'cloud'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true']
|
||||
]),
|
||||
'cloud:latest'
|
||||
],
|
||||
[
|
||||
5,
|
||||
new Map<string, string>([
|
||||
['version', 'edge'],
|
||||
['driver', 'cloud'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true']
|
||||
]),
|
||||
'cloud:edge'
|
||||
],
|
||||
[
|
||||
6,
|
||||
new Map<string, string>([
|
||||
['driver', 'cloud'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
'cloud:latest'
|
||||
],
|
||||
[
|
||||
7,
|
||||
new Map<string, string>([
|
||||
['version', 'cloud:v0.11.2-desktop.2'],
|
||||
['driver', 'cloud'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
'cloud:v0.11.2-desktop.2'
|
||||
],
|
||||
[
|
||||
8,
|
||||
new Map<string, string>([
|
||||
['version', 'cloud:v0.11.2-desktop.2'],
|
||||
// defaults
|
||||
['install', 'false'],
|
||||
['use', 'true'],
|
||||
['cache-binary', 'true'],
|
||||
['cleanup', 'true'],
|
||||
]),
|
||||
'cloud:v0.11.2-desktop.2'
|
||||
],
|
||||
])(
|
||||
'[%d] given %p as inputs, returns version %p',
|
||||
async (num: number, inputs: Map<string, string>, expected: string) => {
|
||||
inputs.forEach((value: string, name: string) => {
|
||||
setInput(name, value);
|
||||
});
|
||||
const inp = await context.getInputs();
|
||||
expect(context.getVersion(inp)).toEqual(expected);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
||||
function getInputName(name: string): string {
|
||||
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue