Skip to content

Commit

Permalink
Merge pull request #1121 from docker/dependabot/npm_and_yarn/docker/a…
Browse files Browse the repository at this point in the history
…ctions-toolkit-0.23.0

chore(deps): Bump @docker/actions-toolkit from 0.22.0 to 0.23.0
  • Loading branch information
crazy-max committed May 14, 2024
2 parents 6003d32 + 0e2ab16 commit df19a79
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 89 deletions.
111 changes: 62 additions & 49 deletions __tests__/context.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
import * as fs from 'fs';
import * as path from 'path';

import {Builder} from '@docker/actions-toolkit/lib/buildx/builder';
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
import {Build} from '@docker/actions-toolkit/lib/buildx/build';
import {Context} from '@docker/actions-toolkit/lib/context';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
import {GitHub} from '@docker/actions-toolkit/lib/github';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';

import {BuilderInfo} from '@docker/actions-toolkit/lib/types/builder';
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';

Expand Down Expand Up @@ -35,6 +38,16 @@ jest.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean>
return true;
});

const metadataJson = path.join(tmpDir, 'metadata.json');
jest.spyOn(Build.prototype, 'getMetadataFilePath').mockImplementation((): string => {
return metadataJson;
});

const imageIDFilePath = path.join(tmpDir, 'iidfile.txt');
jest.spyOn(Build.prototype, 'getImageIDFilePath').mockImplementation((): string => {
return imageIDFilePath;
});

jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
return {
name: 'builder2',
Expand Down Expand Up @@ -78,7 +91,7 @@ describe('getArgs', () => {
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'.'
]
],
Expand All @@ -101,7 +114,7 @@ ccc"`],
'--build-arg', 'MY_ARG=val1,val2,val3',
'--build-arg', 'ARG=val',
'--build-arg', `MULTILINE=aaaa\nbbbb\nccc`,
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'https://github.com/docker/build-push-action.git#refs/heads/master'
]
],
Expand All @@ -117,7 +130,7 @@ ccc"`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--tag', 'name/app:7.4',
'--tag', 'name/app:latest',
'https://github.com/docker/build-push-action.git#refs/heads/master'
Expand Down Expand Up @@ -172,7 +185,7 @@ ccc"`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'.'
]
],
Expand All @@ -189,7 +202,7 @@ ccc"`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
'.'
]
Expand Down Expand Up @@ -230,7 +243,7 @@ ccc"`],
[
'build',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--platform', 'linux/amd64,linux/arm64',
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
'--builder', 'builder-git-context-2',
Expand Down Expand Up @@ -264,7 +277,7 @@ ccc"`],
[
'build',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--platform', 'linux/amd64,linux/arm64',
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
'--secret', `id=MYSECRET,src=${tmpName}`,
Expand Down Expand Up @@ -301,7 +314,7 @@ ccc`],
[
'build',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--platform', 'linux/amd64,linux/arm64',
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
'--secret', `id=MYSECRET,src=${tmpName}`,
Expand Down Expand Up @@ -330,7 +343,7 @@ ccc`],
[
'build',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--secret', `id=MY_SECRET,src=${tmpName}`,
'--builder', 'builder-git-context-2',
'--network', 'host',
Expand Down Expand Up @@ -377,8 +390,8 @@ ccc`],
'--add-host', 'docker:10.180.0.1',
'--add-host', 'foo:10.0.0.1',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--iidfile', imageIDFilePath,
'--metadata-file', metadataJson,
'--network', 'host',
'--push',
'.'
Expand Down Expand Up @@ -406,11 +419,11 @@ nproc=3`],
'--add-host', 'foo:10.0.0.1',
'--cgroup-parent', 'foo',
'--file', './test/Dockerfile',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--shm-size', '2g',
'--ulimit', 'nofile=1024:1024',
'--ulimit', 'nproc=3',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -426,8 +439,8 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--iidfile', imageIDFilePath,
'--metadata-file', metadataJson,
'https://github.com/docker/build-push-action.git#refs/heads/master:docker'
]
],
Expand All @@ -444,9 +457,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--secret', `id=GIT_AUTH_TOKEN,src=${tmpName}`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'https://github.com/docker/build-push-action.git#refs/heads/master:subdir'
]
],
Expand All @@ -463,8 +476,8 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--iidfile', imageIDFilePath,
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -480,9 +493,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -499,9 +512,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -518,9 +531,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -537,9 +550,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', 'type=provenance,disabled=true',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -556,9 +569,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', 'type=provenance,builder-id=foo',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -575,9 +588,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
"--output", 'type=docker',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -593,9 +606,9 @@ nproc=3`],
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--load',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -613,9 +626,9 @@ nproc=3`],
[
'build',
'--build-arg', 'FOO=bar#baz',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--load',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -635,9 +648,9 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'build',
'--secret', 'id=MY_SECRET,env=MY_SECRET_ENV',
'--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--load',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -656,9 +669,9 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'build',
'--secret', 'id=MY_SECRET,env=MY_SECRET_ENV',
'--secret', 'id=ANOTHER_SECRET,env=ANOTHER_SECRET_ENV',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--load',
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -678,7 +691,7 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'build',
'--output', 'type=local,dest=./release-out',
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -702,7 +715,7 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
'--annotation', 'manifest-descriptor[linux/amd64]:example4=zzz',
'--output', 'type=local,dest=./release-out',
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -719,10 +732,10 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
"--output", `type=image,"name=localhost:5000/name/app:latest,localhost:5000/name/app:foo",push-by-digest=true,name-canonical=true,push=true`,
'--attest', `type=provenance,mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -740,10 +753,10 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--attest', `type=sbom,disabled=false`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -761,9 +774,9 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand All @@ -780,9 +793,9 @@ ANOTHER_SECRET=ANOTHER_SECRET_ENV`]
]),
[
'build',
'--iidfile', path.join(tmpDir, 'iidfile'),
'--iidfile', imageIDFilePath,
'--attest', `type=provenance,mode=min,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
'--metadata-file', path.join(tmpDir, 'metadata-file'),
'--metadata-file', metadataJson,
'.'
]
],
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 0 additions & 19 deletions dist/licenses.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.10.1",
"@docker/actions-toolkit": "0.22.0",
"@docker/actions-toolkit": "0.23.0",
"handlebars": "^4.7.7"
},
"devDependencies": {
Expand Down

0 comments on commit df19a79

Please sign in to comment.