Skip to content

Commit

Permalink
Use csv-parse lib to parse outputs
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Oct 20, 2020
1 parent 695ef9e commit bf051e6
Show file tree
Hide file tree
Showing 7 changed files with 1,350 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1
with:
# TODO: Remove image=moby/buildkit:buildx-stable-1 when moby/buildkit#1727 fixed
driver-opts: |
network=host
image=moby/buildkit:buildx-stable-1
Expand Down Expand Up @@ -348,6 +349,7 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1
with:
# TODO: Remove image=moby/buildkit:buildx-stable-1 when moby/buildkit#1727 fixed
driver-opts: |
network=host
image=moby/buildkit:buildx-stable-1
Expand Down Expand Up @@ -412,6 +414,7 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v1
with:
# TODO: Remove image=moby/buildkit:buildx-stable-1 when moby/buildkit#1727 fixed
driver-opts: |
network=host
image=moby/buildkit:buildx-stable-1
Expand Down
60 changes: 60 additions & 0 deletions __tests__/buildx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,66 @@ describe('getImageID', () => {
});
});

describe('isLocalOrTarExporter', () => {
// prettier-ignore
test.each([
[
[
'type=registry,ref=user/app',
],
false
],
[
[
'type=docker',
],
false
],
[
[
'type=local,dest=./release-out'
],
true
],
[
[
'type=tar,dest=/tmp/image.tar'
],
true
],
[
[
'type=docker',
'type=tar,dest=/tmp/image.tar'
],
true
],
[
[
'"type=tar","dest=/tmp/image.tar"'
],
true
],
[
[
'" type= local" , dest=./release-out'
],
true
],
[
[
'.'
],
false
],
])(
'given %p returns %p',
async (outputs: Array<string>, expected: boolean) => {
expect(buildx.isLocalOrTarExporter(outputs)).toEqual(expected);
}
);
});

describe('getVersion', () => {
it('valid', async () => {
await exec.exec('docker', ['buildx', 'version']);
Expand Down
22 changes: 9 additions & 13 deletions __tests__/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ describe('getArgs', () => {
[
'buildx',
'build',
'--iidfile',
'/tmp/.docker-build-push-jest/iidfile',
'--file',
'Dockerfile',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--file', 'Dockerfile',
'https://github.com/docker/build-push-action.git#test-jest'
]
],
Expand Down Expand Up @@ -81,26 +79,24 @@ describe('getArgs', () => {
[
'buildx',
'build',
'--iidfile',
'/tmp/.docker-build-push-jest/iidfile',
'--secret',
'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--file', 'Dockerfile',
'.'
]
],
[
'0.4.2',
new Map<string, string>([
['github-token', 'abcdefghijklmno0123456789']
['github-token', 'abcdefghijklmno0123456789'],
['outputs', '.']
]),
[
'buildx',
'build',
'--iidfile',
'/tmp/.docker-build-push-jest/iidfile',
'--secret',
'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--output', '.',
'--iidfile', '/tmp/.docker-build-push-jest/iidfile',
'--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest',
'--file', 'Dockerfile',
'https://github.com/docker/build-push-action.git#test-jest'
]
Expand Down
Loading

0 comments on commit bf051e6

Please sign in to comment.