mirror of
https://github.com/docker/setup-buildx-action
synced 2024-11-24 03:31:40 +00:00
Merge pull request #369 from crazy-max/revert-crypto
switch back to uuid package
This commit is contained in:
commit
c47758b77c
7 changed files with 33 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
||||||
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as uuid from 'uuid';
|
||||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
||||||
import {Context} from '@docker/actions-toolkit/lib/context';
|
import {Context} from '@docker/actions-toolkit/lib/context';
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
@ -25,7 +26,8 @@ jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
||||||
return tmpName;
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.spyOn(crypto, 'randomUUID').mockReturnValue('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d');
|
jest.mock('uuid');
|
||||||
|
jest.spyOn(uuid, 'v4').mockReturnValue('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d');
|
||||||
|
|
||||||
jest.spyOn(Docker, 'context').mockImplementation((): Promise<string> => {
|
jest.spyOn(Docker, 'context').mockImplementation((): Promise<string> => {
|
||||||
return Promise.resolve('default');
|
return Promise.resolve('default');
|
||||||
|
|
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -27,11 +27,13 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@docker/actions-toolkit": "^0.39.0",
|
"@docker/actions-toolkit": "^0.39.0",
|
||||||
"js-yaml": "^4.1.0"
|
"js-yaml": "^4.1.0",
|
||||||
|
"uuid": "^10.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/node": "^20.12.12",
|
"@types/node": "^20.12.12",
|
||||||
|
"@types/uuid": "^10.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
||||||
"@typescript-eslint/parser": "^7.9.0",
|
"@typescript-eslint/parser": "^7.9.0",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as uuid from 'uuid';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
@ -46,7 +47,7 @@ export async function getInputs(): Promise<Inputs> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getBuilderName(driver: string): Promise<string> {
|
export async function getBuilderName(driver: string): Promise<string> {
|
||||||
return driver == 'docker' ? await Docker.context() : `builder-${crypto.randomUUID()}`;
|
return driver == 'docker' ? await Docker.context() : `builder-${uuid.v4()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getCreateArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
|
export async function getCreateArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<string>> {
|
||||||
|
@ -83,7 +84,7 @@ export async function getAppendArgs(inputs: Inputs, node: Node, toolkit: Toolkit
|
||||||
if (node.name) {
|
if (node.name) {
|
||||||
args.push('--node', node.name);
|
args.push('--node', node.name);
|
||||||
} else if (inputs.driver == 'kubernetes' && (await toolkit.buildx.versionSatisfies('<0.11.0'))) {
|
} else if (inputs.driver == 'kubernetes' && (await toolkit.buildx.versionSatisfies('<0.11.0'))) {
|
||||||
args.push('--node', `node-${crypto.randomUUID()}`);
|
args.push('--node', `node-${uuid.v4()}`);
|
||||||
}
|
}
|
||||||
if (node['driver-opts'] && (await toolkit.buildx.versionSatisfies('>=0.3.0'))) {
|
if (node['driver-opts'] && (await toolkit.buildx.versionSatisfies('>=0.3.0'))) {
|
||||||
await Util.asyncForEach(node['driver-opts'], async (driverOpt: string) => {
|
await Util.asyncForEach(node['driver-opts'], async (driverOpt: string) => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as yaml from 'js-yaml';
|
import * as yaml from 'js-yaml';
|
||||||
|
import * as uuid from 'uuid';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ actionsToolkit.run(
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (defaultContextWithTLS) {
|
if (defaultContextWithTLS) {
|
||||||
const tmpDockerContext = `buildx-${crypto.randomUUID()}`;
|
const tmpDockerContext = `buildx-${uuid.v4()}`;
|
||||||
await core.group(`Creating temp docker context (TLS data loaded in default one)`, async () => {
|
await core.group(`Creating temp docker context (TLS data loaded in default one)`, async () => {
|
||||||
await Docker.getExecOutput(['context', 'create', tmpDockerContext], {
|
await Docker.getExecOutput(['context', 'create', tmpDockerContext], {
|
||||||
ignoreReturnCode: true
|
ignoreReturnCode: true
|
||||||
|
|
18
yarn.lock
18
yarn.lock
|
@ -2134,6 +2134,13 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/uuid@npm:^10.0.0":
|
||||||
|
version: 10.0.0
|
||||||
|
resolution: "@types/uuid@npm:10.0.0"
|
||||||
|
checksum: e3958f8b0fe551c86c14431f5940c3470127293280830684154b91dc7eb3514aeb79fe3216968833cf79d4d1c67f580f054b5be2cd562bebf4f728913e73e944
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/yargs-parser@npm:*":
|
"@types/yargs-parser@npm:*":
|
||||||
version: 20.2.0
|
version: 20.2.0
|
||||||
resolution: "@types/yargs-parser@npm:20.2.0"
|
resolution: "@types/yargs-parser@npm:20.2.0"
|
||||||
|
@ -3174,6 +3181,7 @@ __metadata:
|
||||||
"@docker/actions-toolkit": ^0.39.0
|
"@docker/actions-toolkit": ^0.39.0
|
||||||
"@types/js-yaml": ^4.0.9
|
"@types/js-yaml": ^4.0.9
|
||||||
"@types/node": ^20.12.12
|
"@types/node": ^20.12.12
|
||||||
|
"@types/uuid": ^10.0.0
|
||||||
"@typescript-eslint/eslint-plugin": ^7.9.0
|
"@typescript-eslint/eslint-plugin": ^7.9.0
|
||||||
"@typescript-eslint/parser": ^7.9.0
|
"@typescript-eslint/parser": ^7.9.0
|
||||||
"@vercel/ncc": ^0.38.1
|
"@vercel/ncc": ^0.38.1
|
||||||
|
@ -3187,6 +3195,7 @@ __metadata:
|
||||||
ts-jest: ^29.1.2
|
ts-jest: ^29.1.2
|
||||||
ts-node: ^10.9.2
|
ts-node: ^10.9.2
|
||||||
typescript: ^5.4.5
|
typescript: ^5.4.5
|
||||||
|
uuid: ^10.0.0
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
@ -6671,6 +6680,15 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"uuid@npm:^10.0.0":
|
||||||
|
version: 10.0.0
|
||||||
|
resolution: "uuid@npm:10.0.0"
|
||||||
|
bin:
|
||||||
|
uuid: dist/bin/uuid
|
||||||
|
checksum: 4b81611ade2885d2313ddd8dc865d93d8dccc13ddf901745edca8f86d99bc46d7a330d678e7532e7ebf93ce616679fb19b2e3568873ac0c14c999032acb25869
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"uuid@npm:^3.3.2, uuid@npm:^3.3.3":
|
"uuid@npm:^3.3.2, uuid@npm:^3.3.3":
|
||||||
version: 3.4.0
|
version: 3.4.0
|
||||||
resolution: "uuid@npm:3.4.0"
|
resolution: "uuid@npm:3.4.0"
|
||||||
|
|
Loading…
Reference in a new issue