@@ -2,6 +2,7 @@ import {beforeEach, describe, expect, it, jest, test} from '@jest/globals';
22import * as fs from 'fs' ;
33import * as path from 'path' ;
44
5+ import * as buildx from '../src/buildx' ;
56import * as context from '../src/context' ;
67
78const pgp = `-----BEGIN PGP PRIVATE KEY BLOCK-----
@@ -127,6 +128,8 @@ jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
127128 return path . join ( '/tmp/.docker-build-push-jest' , '.tmpname-jest' ) . split ( path . sep ) . join ( path . posix . sep ) ;
128129} ) ;
129130
131+ jest . spyOn ( buildx , 'satisfiesBuildKitVersion' ) . mockResolvedValueOnce ( true ) ;
132+
130133describe ( 'getArgs' , ( ) => {
131134 beforeEach ( ( ) => {
132135 process . env = Object . keys ( process . env ) . reduce ( ( object , key ) => {
@@ -159,7 +162,11 @@ describe('getArgs', () => {
159162 1 ,
160163 '0.4.2' ,
161164 new Map < string , string > ( [
162- [ 'build-args' , 'MY_ARG=val1,val2,val3\nARG=val' ] ,
165+ [ 'build-args' , `MY_ARG=val1,val2,val3
166+ ARG=val
167+ "MULTILINE=aaaa
168+ bbbb
169+ ccc"` ] ,
163170 [ 'load' , 'false' ] ,
164171 [ 'no-cache' , 'false' ] ,
165172 [ 'push' , 'false' ] ,
@@ -169,6 +176,7 @@ describe('getArgs', () => {
169176 'build' ,
170177 '--build-arg' , 'MY_ARG=val1,val2,val3' ,
171178 '--build-arg' , 'ARG=val' ,
179+ '--build-arg' , `MULTILINE=aaaa\nbbbb\nccc` ,
172180 '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
173181 'https://github.com/docker/build-push-action.git#refs/heads/test-jest'
174182 ]
@@ -517,7 +525,119 @@ nproc=3`],
517525 '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
518526 'https://github.com/docker/build-push-action.git#refs/heads/test-jest:subdir'
519527 ]
520- ]
528+ ] ,
529+ [
530+ 17 ,
531+ '0.8.2' ,
532+ new Map < string , string > ( [
533+ [ 'context' , '.' ] ,
534+ [ 'load' , 'false' ] ,
535+ [ 'no-cache' , 'false' ] ,
536+ [ 'push' , 'false' ] ,
537+ [ 'pull' , 'false' ] ,
538+ [ 'provenance' , 'true' ] ,
539+ ] ) ,
540+ [
541+ 'build' ,
542+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
543+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
544+ '.'
545+ ]
546+ ] ,
547+ [
548+ 18 ,
549+ '0.10.0' ,
550+ new Map < string , string > ( [
551+ [ 'context' , '.' ] ,
552+ [ 'load' , 'false' ] ,
553+ [ 'no-cache' , 'false' ] ,
554+ [ 'push' , 'false' ] ,
555+ [ 'pull' , 'false' ] ,
556+ ] ) ,
557+ [
558+ 'build' ,
559+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
560+ "--provenance" , `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789` ,
561+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
562+ '.'
563+ ]
564+ ] ,
565+ [
566+ 19 ,
567+ '0.10.0' ,
568+ new Map < string , string > ( [
569+ [ 'context' , '.' ] ,
570+ [ 'load' , 'false' ] ,
571+ [ 'no-cache' , 'false' ] ,
572+ [ 'push' , 'false' ] ,
573+ [ 'pull' , 'false' ] ,
574+ [ 'provenance' , 'true' ] ,
575+ ] ) ,
576+ [
577+ 'build' ,
578+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
579+ "--provenance" , `builder-id=https://github.com/docker/build-push-action/actions/runs/123456789` ,
580+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
581+ '.'
582+ ]
583+ ] ,
584+ [
585+ 20 ,
586+ '0.10.0' ,
587+ new Map < string , string > ( [
588+ [ 'context' , '.' ] ,
589+ [ 'load' , 'false' ] ,
590+ [ 'no-cache' , 'false' ] ,
591+ [ 'push' , 'false' ] ,
592+ [ 'pull' , 'false' ] ,
593+ [ 'provenance' , 'mode=max' ] ,
594+ ] ) ,
595+ [
596+ 'build' ,
597+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
598+ "--provenance" , `mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789` ,
599+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
600+ '.'
601+ ]
602+ ] ,
603+ [
604+ 21 ,
605+ '0.10.0' ,
606+ new Map < string , string > ( [
607+ [ 'context' , '.' ] ,
608+ [ 'load' , 'false' ] ,
609+ [ 'no-cache' , 'false' ] ,
610+ [ 'push' , 'false' ] ,
611+ [ 'pull' , 'false' ] ,
612+ [ 'provenance' , 'false' ] ,
613+ ] ) ,
614+ [
615+ 'build' ,
616+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
617+ "--provenance" , 'false' ,
618+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
619+ '.'
620+ ]
621+ ] ,
622+ [
623+ 22 ,
624+ '0.10.0' ,
625+ new Map < string , string > ( [
626+ [ 'context' , '.' ] ,
627+ [ 'load' , 'false' ] ,
628+ [ 'no-cache' , 'false' ] ,
629+ [ 'push' , 'false' ] ,
630+ [ 'pull' , 'false' ] ,
631+ [ 'provenance' , 'builder-id=foo' ] ,
632+ ] ) ,
633+ [
634+ 'build' ,
635+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
636+ "--provenance" , 'builder-id=foo' ,
637+ '--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
638+ '.'
639+ ]
640+ ] ,
521641 ] ) (
522642 '[%d] given %p with %p as inputs, returns %p' ,
523643 async ( num : number , buildxVersion : string , inputs : Map < string , string > , expected : Array < string > ) => {
0 commit comments