Skip to content

Commit f2a1d5e

Browse files
authored
Merge pull request #838 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.1.0-beta.19
chore(deps): Bump @docker/actions-toolkit from 0.1.0-beta.14 to 0.1.0-beta.19
2 parents 35434f5 + 81f5252 commit f2a1d5e

File tree

7 files changed

+40
-74
lines changed

7 files changed

+40
-74
lines changed

__tests__/context.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as path from 'path';
44
import {Builder} from '@docker/actions-toolkit/lib/buildx/builder';
55
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
66
import {Context} from '@docker/actions-toolkit/lib/context';
7-
import {Docker} from '@docker/actions-toolkit/lib/docker';
7+
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
88
import {GitHub} from '@docker/actions-toolkit/lib/github';
99
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
1010
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/builder';
@@ -42,9 +42,9 @@ jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<Bu
4242
lastActivity: new Date('2023-01-16 09:45:23 +0000 UTC'),
4343
nodes: [
4444
{
45-
buildkitVersion: 'v0.11.0',
46-
buildkitdFlags: '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
47-
driverOpts: ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
45+
buildkit: 'v0.11.0',
46+
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
47+
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
4848
endpoint: 'unix:///var/run/docker.sock',
4949
name: 'builder20',
5050
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',
@@ -609,7 +609,7 @@ nproc=3`],
609609
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
610610
return buildxVersion;
611611
});
612-
const inp = await context.getInputs();
612+
const inp = await context.getInputs(toolkit);
613613
const res = await context.getArgs(inp, toolkit);
614614
expect(res).toEqual(expected);
615615
}

dist/index.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"license": "Apache-2.0",
3030
"dependencies": {
3131
"@actions/core": "^1.10.0",
32-
"@docker/actions-toolkit": "^0.1.0-beta.14",
33-
"csv-parse": "^5.3.5",
32+
"@docker/actions-toolkit": "^0.1.0-beta.19",
3433
"handlebars": "^4.7.7"
3534
},
3635
"devDependencies": {

src/context.ts

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as core from '@actions/core';
2-
import {parse} from 'csv-parse/sync';
32
import * as handlebars from 'handlebars';
43
import {Context} from '@docker/actions-toolkit/lib/context';
54
import {GitHub} from '@docker/actions-toolkit/lib/github';
@@ -40,7 +39,7 @@ export interface Inputs {
4039
githubToken: string;
4140
}
4241

43-
export async function getInputs(): Promise<Inputs> {
42+
export async function getInputs(toolkit: Toolkit): Promise<Inputs> {
4443
return {
4544
addHosts: Util.getInputList('add-hosts'),
4645
allow: Util.getInputList('allow'),
@@ -60,7 +59,7 @@ export async function getInputs(): Promise<Inputs> {
6059
noCacheFilters: Util.getInputList('no-cache-filters'),
6160
outputs: Util.getInputList('outputs', {ignoreComma: true}),
6261
platforms: Util.getInputList('platforms'),
63-
provenance: getProvenanceInput('provenance'),
62+
provenance: toolkit.buildx.inputs.getProvenanceInput('provenance'),
6463
pull: core.getBooleanInput('pull'),
6564
push: core.getBooleanInput('push'),
6665
sbom: core.getInput('sbom'),
@@ -145,10 +144,10 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
145144
if (GitHub.context.payload.repository?.private ?? false) {
146145
// if this is a private repository, we set the default provenance
147146
// attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
148-
args.push('--provenance', getProvenanceAttrs(`mode=min,inline-only=true`));
147+
args.push('--provenance', toolkit.buildx.inputs.resolveProvenanceAttrs(`mode=min,inline-only=true`));
149148
} else {
150149
// for a public repository, we set max provenance mode.
151-
args.push('--provenance', getProvenanceAttrs(`mode=max`));
150+
args.push('--provenance', toolkit.buildx.inputs.resolveProvenanceAttrs(`mode=max`));
152151
}
153152
}
154153
if (inputs.sbom) {
@@ -215,37 +214,3 @@ async function getCommonArgs(inputs: Inputs, toolkit: Toolkit): Promise<Array<st
215214
}
216215
return args;
217216
}
218-
219-
function getProvenanceInput(name: string): string {
220-
const input = core.getInput(name);
221-
if (!input) {
222-
// if input is not set, default values will be set later.
223-
return input;
224-
}
225-
try {
226-
return core.getBooleanInput(name) ? `builder-id=${Context.provenanceBuilderID()}` : 'false';
227-
} catch (err) {
228-
// not a valid boolean, so we assume it's a string
229-
return getProvenanceAttrs(input);
230-
}
231-
}
232-
233-
function getProvenanceAttrs(input: string): string {
234-
// parse attributes from input
235-
const fields = parse(input, {
236-
relaxColumnCount: true,
237-
skipEmptyLines: true
238-
})[0];
239-
// check if builder-id attribute exists in the input
240-
for (const field of fields) {
241-
const parts = field
242-
.toString()
243-
.split(/(?<=^[^=]+?)=/)
244-
.map(item => item.trim());
245-
if (parts[0] == 'builder-id') {
246-
return input;
247-
}
248-
}
249-
// if not add builder-id attribute
250-
return `${input},builder-id=${Context.provenanceBuilderID()}`;
251-
}

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as stateHelper from './state-helper';
33
import * as core from '@actions/core';
44
import * as actionsToolkit from '@docker/actions-toolkit';
55
import {Context} from '@docker/actions-toolkit/lib/context';
6-
import {Docker} from '@docker/actions-toolkit/lib/docker';
6+
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
77
import {Exec} from '@docker/actions-toolkit/lib/exec';
88
import {GitHub} from '@docker/actions-toolkit/lib/github';
99
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
@@ -13,8 +13,8 @@ import * as context from './context';
1313
actionsToolkit.run(
1414
// main
1515
async () => {
16-
const inputs: context.Inputs = await context.getInputs();
1716
const toolkit = new Toolkit();
17+
const inputs: context.Inputs = await context.getInputs(toolkit);
1818

1919
await core.group(`GitHub Actions runtime token ACs`, async () => {
2020
try {

yarn.lock

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
dependencies:
3535
tunnel "^0.0.6"
3636

37-
"@actions/io@^1.0.1":
38-
version "1.0.2"
39-
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.0.2.tgz#2f614b6e69ce14d191180451eb38e6576a6e6b27"
40-
integrity sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==
41-
42-
"@actions/io@^1.1.1", "@actions/io@^1.1.2":
37+
"@actions/io@^1.0.1", "@actions/io@^1.1.1", "@actions/io@^1.1.2":
4338
version "1.1.2"
4439
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.1.2.tgz#766ac09674a289ce0f1550ffe0a6eac9261a8ea9"
4540
integrity sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==
@@ -563,18 +558,20 @@
563558
dependencies:
564559
"@cspotcode/source-map-consumer" "0.8.0"
565560

566-
"@docker/actions-toolkit@^0.1.0-beta.14":
567-
version "0.1.0-beta.14"
568-
resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.1.0-beta.14.tgz#82fa8a6b9802a7f770fde3ddcef1cf591739a80b"
569-
integrity sha512-N+aqiO0E2ygoaBORN8fx4K7j/CzJ2nCSgOewtDm0gdzrch8qZmTU14e3oNAbZlP8Q34Lk45KKefm5wDfLipRqg==
561+
"@docker/actions-toolkit@^0.1.0-beta.19":
562+
version "0.1.0-beta.19"
563+
resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.1.0-beta.19.tgz#d4e6f56dec13d00b772d5d6b1b10c71164568820"
564+
integrity sha512-HeJ7tsFPsq7otV7KFNiWccW+rJeXFboqJ59rBAa2lTncq9cybCtNs+Z5ug++sIju0FN+zmSFAY77sBS9FhH9jQ==
570565
dependencies:
571566
"@actions/core" "^1.10.0"
572567
"@actions/exec" "^1.1.1"
573568
"@actions/github" "^5.1.1"
574569
"@actions/http-client" "^2.0.1"
575570
"@actions/io" "^1.1.2"
576571
"@actions/tool-cache" "^2.0.1"
572+
async-retry "^1.3.3"
577573
csv-parse "^5.3.5"
574+
handlebars "^4.7.7"
578575
jwt-decode "^3.1.2"
579576
semver "^7.3.8"
580577
tmp "^0.2.1"
@@ -1333,6 +1330,13 @@ array-union@^2.1.0:
13331330
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
13341331
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
13351332

1333+
async-retry@^1.3.3:
1334+
version "1.3.3"
1335+
resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280"
1336+
integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==
1337+
dependencies:
1338+
retry "0.13.1"
1339+
13361340
asynckit@^0.4.0:
13371341
version "0.4.0"
13381342
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
@@ -3257,6 +3261,11 @@ resolve@^1.20.0:
32573261
path-parse "^1.0.7"
32583262
supports-preserve-symlinks-flag "^1.0.0"
32593263

3264+
3265+
version "0.13.1"
3266+
resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658"
3267+
integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==
3268+
32603269
reusify@^1.0.4:
32613270
version "1.0.4"
32623271
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
@@ -3293,10 +3302,10 @@ saxes@^5.0.1:
32933302
dependencies:
32943303
xmlchars "^2.2.0"
32953304

3296-
[email protected], semver@^7.3.2, semver@^7.3.5:
3297-
version "7.3.7"
3298-
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f"
3299-
integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==
3305+
[email protected], semver@^7.3.2, semver@^7.3.5, semver@^7.3.8:
3306+
version "7.3.8"
3307+
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
3308+
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
33003309
dependencies:
33013310
lru-cache "^6.0.0"
33023311

@@ -3305,13 +3314,6 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.3.0:
33053314
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
33063315
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
33073316

3308-
semver@^7.3.8:
3309-
version "7.3.8"
3310-
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
3311-
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
3312-
dependencies:
3313-
lru-cache "^6.0.0"
3314-
33153317
shebang-command@^2.0.0:
33163318
version "2.0.0"
33173319
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"

0 commit comments

Comments
 (0)