@@ -140,6 +140,7 @@ describe('getArgs', () => {
140
140
// prettier-ignore
141
141
test . each ( [
142
142
[
143
+ 0 ,
143
144
'0.4.1' ,
144
145
new Map < string , string > ( [
145
146
[ 'context' , '.' ] ,
@@ -156,6 +157,7 @@ describe('getArgs', () => {
156
157
]
157
158
] ,
158
159
[
160
+ 1 ,
159
161
'0.4.2' ,
160
162
new Map < string , string > ( [
161
163
[ 'build-args' , 'MY_ARG=val1,val2,val3\nARG=val' ] ,
@@ -174,6 +176,7 @@ describe('getArgs', () => {
174
176
]
175
177
] ,
176
178
[
179
+ 2 ,
177
180
'0.4.2' ,
178
181
new Map < string , string > ( [
179
182
[ 'tags' , 'name/app:7.4, name/app:latest' ] ,
@@ -185,13 +188,14 @@ describe('getArgs', () => {
185
188
[
186
189
'buildx' ,
187
190
'build' ,
191
+ '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
188
192
'--tag' , 'name/app:7.4' ,
189
193
'--tag' , 'name/app:latest' ,
190
- '--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
191
194
'https://github.com/docker/build-push-action.git#refs/heads/test-jest'
192
195
]
193
196
] ,
194
197
[
198
+ 3 ,
195
199
'0.4.2' ,
196
200
new Map < string , string > ( [
197
201
[ 'context' , '.' ] ,
@@ -212,6 +216,7 @@ describe('getArgs', () => {
212
216
]
213
217
] ,
214
218
[
219
+ 4 ,
215
220
'0.4.1' ,
216
221
new Map < string , string > ( [
217
222
[ 'context' , '.' ] ,
@@ -229,6 +234,7 @@ describe('getArgs', () => {
229
234
]
230
235
] ,
231
236
[
237
+ 5 ,
232
238
'0.4.1' ,
233
239
new Map < string , string > ( [
234
240
[ 'context' , '.' ] ,
@@ -245,6 +251,7 @@ describe('getArgs', () => {
245
251
]
246
252
] ,
247
253
[
254
+ 6 ,
248
255
'0.4.2' ,
249
256
new Map < string , string > ( [
250
257
[ 'context' , '.' ] ,
@@ -263,6 +270,7 @@ describe('getArgs', () => {
263
270
]
264
271
] ,
265
272
[
273
+ 7 ,
266
274
'0.4.2' ,
267
275
new Map < string , string > ( [
268
276
[ 'github-token' , 'abcdefghijklmno0123456789' ] ,
@@ -281,6 +289,7 @@ describe('getArgs', () => {
281
289
]
282
290
] ,
283
291
[
292
+ 8 ,
284
293
'0.4.2' ,
285
294
new Map < string , string > ( [
286
295
[ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -297,16 +306,17 @@ describe('getArgs', () => {
297
306
[
298
307
'buildx' ,
299
308
'build' ,
300
- '--platform ' , 'linux/amd64,linux/arm64 ' ,
309
+ '--file ' , './test/Dockerfile ' ,
301
310
'--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
311
+ '--platform' , 'linux/amd64,linux/arm64' ,
302
312
'--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
303
- '--file' , './test/Dockerfile' ,
304
313
'--builder' , 'builder-git-context-2' ,
305
314
'--push' ,
306
315
'https://github.com/docker/build-push-action.git#refs/heads/master'
307
316
]
308
317
] ,
309
318
[
319
+ 9 ,
310
320
'0.4.2' ,
311
321
new Map < string , string > ( [
312
322
[ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -331,19 +341,20 @@ ccc"`],
331
341
[
332
342
'buildx' ,
333
343
'build' ,
334
- '--platform ' , 'linux/amd64,linux/arm64 ' ,
344
+ '--file ' , './test/Dockerfile ' ,
335
345
'--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
346
+ '--platform' , 'linux/amd64,linux/arm64' ,
336
347
'--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
337
348
'--secret' , 'id=MYSECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
338
349
'--secret' , 'id=FOO,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
339
350
'--secret' , 'id=EMPTYLINE,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
340
- '--file' , './test/Dockerfile' ,
341
351
'--builder' , 'builder-git-context-2' ,
342
352
'--push' ,
343
353
'https://github.com/docker/build-push-action.git#refs/heads/master'
344
354
]
345
355
] ,
346
356
[
357
+ 10 ,
347
358
'0.4.2' ,
348
359
new Map < string , string > ( [
349
360
[ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -368,19 +379,20 @@ ccc`],
368
379
[
369
380
'buildx' ,
370
381
'build' ,
371
- '--platform ' , 'linux/amd64,linux/arm64 ' ,
382
+ '--file ' , './test/Dockerfile ' ,
372
383
'--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
384
+ '--platform' , 'linux/amd64,linux/arm64' ,
373
385
'--secret' , 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
374
386
'--secret' , 'id=MYSECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
375
387
'--secret' , 'id=FOO,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
376
388
'--secret' , 'id=EMPTYLINE,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
377
- '--file' , './test/Dockerfile' ,
378
389
'--builder' , 'builder-git-context-2' ,
379
390
'--push' ,
380
391
'https://github.com/docker/build-push-action.git#refs/heads/master'
381
392
]
382
393
] ,
383
394
[
395
+ 11 ,
384
396
'0.5.1' ,
385
397
new Map < string , string > ( [
386
398
[ 'context' , 'https://github.com/docker/build-push-action.git#refs/heads/master' ] ,
@@ -397,16 +409,17 @@ ccc`],
397
409
[
398
410
'buildx' ,
399
411
'build' ,
412
+ '--file' , './test/Dockerfile' ,
400
413
'--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
401
414
'--secret' , 'id=MY_SECRET,src=/tmp/.docker-build-push-jest/.tmpname-jest' ,
402
- '--file' , './test/Dockerfile' ,
403
415
'--builder' , 'builder-git-context-2' ,
404
416
'--network' , 'host' ,
405
417
'--push' ,
406
418
'https://github.com/docker/build-push-action.git#refs/heads/master'
407
419
]
408
420
] ,
409
421
[
422
+ 12 ,
410
423
'0.4.2' ,
411
424
new Map < string , string > ( [
412
425
[ 'context' , '.' ] ,
@@ -427,6 +440,7 @@ ccc`],
427
440
]
428
441
] ,
429
442
[
443
+ 13 ,
430
444
'0.6.0' ,
431
445
new Map < string , string > ( [
432
446
[ 'context' , '.' ] ,
@@ -441,25 +455,23 @@ ccc`],
441
455
[
442
456
'buildx' ,
443
457
'build' ,
458
+ '--file' , './test/Dockerfile' ,
444
459
'--iidfile' , '/tmp/.docker-build-push-jest/iidfile' ,
445
460
'--metadata-file' , '/tmp/.docker-build-push-jest/metadata-file' ,
446
- '--file' , './test/Dockerfile' ,
447
461
'--network' , 'host' ,
448
462
'--push' ,
449
463
'.'
450
464
]
451
465
] ,
452
466
] ) (
453
- 'given %p with %p as inputs, returns %p' ,
454
- async ( buildxVersion : string , inputs : Map < string , any > , expected : Array < string > ) => {
467
+ '[%d] given %p with %p as inputs, returns %p' ,
468
+ async ( num : number , buildxVersion : string , inputs : Map < string , any > , expected : Array < string > ) => {
455
469
await inputs . forEach ( ( value : string , name : string ) => {
456
470
setInput ( name , value ) ;
457
471
} ) ;
458
472
const defContext = context . defaultContext ( ) ;
459
473
const inp = await context . getInputs ( defContext ) ;
460
- console . log ( inp ) ;
461
474
const res = await context . getArgs ( inp , defContext , buildxVersion ) ;
462
- console . log ( res ) ;
463
475
expect ( res ) . toEqual ( expected ) ;
464
476
}
465
477
) ;
@@ -469,63 +481,54 @@ describe('getInputList', () => {
469
481
it ( 'single line correctly' , async ( ) => {
470
482
await setInput ( 'foo' , 'bar' ) ;
471
483
const res = await context . getInputList ( 'foo' ) ;
472
- console . log ( res ) ;
473
484
expect ( res ) . toEqual ( [ 'bar' ] ) ;
474
485
} ) ;
475
486
476
487
it ( 'multiline correctly' , async ( ) => {
477
488
setInput ( 'foo' , 'bar\nbaz' ) ;
478
489
const res = await context . getInputList ( 'foo' ) ;
479
- console . log ( res ) ;
480
490
expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
481
491
} ) ;
482
492
483
493
it ( 'empty lines correctly' , async ( ) => {
484
494
setInput ( 'foo' , 'bar\n\nbaz' ) ;
485
495
const res = await context . getInputList ( 'foo' ) ;
486
- console . log ( res ) ;
487
496
expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
488
497
} ) ;
489
498
490
499
it ( 'comma correctly' , async ( ) => {
491
500
setInput ( 'foo' , 'bar,baz' ) ;
492
501
const res = await context . getInputList ( 'foo' ) ;
493
- console . log ( res ) ;
494
502
expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
495
503
} ) ;
496
504
497
505
it ( 'empty result correctly' , async ( ) => {
498
506
setInput ( 'foo' , 'bar,baz,' ) ;
499
507
const res = await context . getInputList ( 'foo' ) ;
500
- console . log ( res ) ;
501
508
expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
502
509
} ) ;
503
510
504
511
it ( 'different new lines correctly' , async ( ) => {
505
512
setInput ( 'foo' , 'bar\r\nbaz' ) ;
506
513
const res = await context . getInputList ( 'foo' ) ;
507
- console . log ( res ) ;
508
514
expect ( res ) . toEqual ( [ 'bar' , 'baz' ] ) ;
509
515
} ) ;
510
516
511
517
it ( 'different new lines and comma correctly' , async ( ) => {
512
518
setInput ( 'foo' , 'bar\r\nbaz,bat' ) ;
513
519
const res = await context . getInputList ( 'foo' ) ;
514
- console . log ( res ) ;
515
520
expect ( res ) . toEqual ( [ 'bar' , 'baz' , 'bat' ] ) ;
516
521
} ) ;
517
522
518
523
it ( 'multiline and ignoring comma correctly' , async ( ) => {
519
524
setInput ( 'cache-from' , 'user/app:cache\ntype=local,src=path/to/dir' ) ;
520
525
const res = await context . getInputList ( 'cache-from' , true ) ;
521
- console . log ( res ) ;
522
526
expect ( res ) . toEqual ( [ 'user/app:cache' , 'type=local,src=path/to/dir' ] ) ;
523
527
} ) ;
524
528
525
529
it ( 'different new lines and ignoring comma correctly' , async ( ) => {
526
530
setInput ( 'cache-from' , 'user/app:cache\r\ntype=local,src=path/to/dir' ) ;
527
531
const res = await context . getInputList ( 'cache-from' , true ) ;
528
- console . log ( res ) ;
529
532
expect ( res ) . toEqual ( [ 'user/app:cache' , 'type=local,src=path/to/dir' ] ) ;
530
533
} ) ;
531
534
@@ -539,7 +542,6 @@ ccccccccc"
539
542
FOO=bar`
540
543
) ;
541
544
const res = await context . getInputList ( 'secrets' , true ) ;
542
- console . log ( res ) ;
543
545
expect ( res ) . toEqual ( [
544
546
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
545
547
`MYSECRET=aaaaaaaa
563
565
ccc"`
564
566
) ;
565
567
const res = await context . getInputList ( 'secrets' , true ) ;
566
- console . log ( res ) ;
567
568
expect ( res ) . toEqual ( [
568
569
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
569
570
`MYSECRET=aaaaaaaa
@@ -587,7 +588,6 @@ ccccccccc
587
588
FOO=bar`
588
589
) ;
589
590
const res = await context . getInputList ( 'secrets' , true ) ;
590
- console . log ( res ) ;
591
591
expect ( res ) . toEqual ( [ 'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' , 'MYSECRET=aaaaaaaa' , 'bbbbbbb' , 'ccccccccc' , 'FOO=bar' ] ) ;
592
592
} ) ;
593
593
@@ -598,7 +598,6 @@ FOO=bar`
598
598
FOO=bar`
599
599
) ;
600
600
const res = await context . getInputList ( 'secrets' , true ) ;
601
- console . log ( res ) ;
602
601
expect ( res ) . toEqual ( [ `GPG_KEY=${ pgp } ` , 'FOO=bar' ] ) ;
603
602
} ) ;
604
603
@@ -612,7 +611,6 @@ ccccccccc"
612
611
FOO=bar`
613
612
) ;
614
613
const res = await context . getInputList ( 'secrets' , true ) ;
615
- console . log ( res ) ;
616
614
expect ( res ) . toEqual ( [
617
615
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789' ,
618
616
`MYSECRET=aaaaaaaa
0 commit comments