Publish-Docker-Github-Action: [BUG] docker:20.10.8 seem to break the test.bats

Describe the bug I’ve been using the master action for a while. It suddenly break for me. I tried most recent release 3.04 which works fine. So the recent changes https://github.com/elgohr/Publish-Docker-Github-Action/compare/3.04...master may have introduced a bug.

Failed on Build container for action use

It looks like it failed on Dockerfile#L17

Step 12/13 : RUN /test.bats

partial error logs:

  Step 9/13 : ADD test.bats /test.bats
   ---> 6f0705b7f549
  Step 10/13 : ADD mock.sh /usr/local/bin/docker
   ---> a4e437bed22a
  Step 11/13 : ADD mock.sh /usr/bin/date
   ---> fb7ee6d4aad2
  Step 12/13 : RUN /test.bats
   ---> Running in 81fa579a8d29
  1..46
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/libexec/bats-core/bats-exec-test: line 127: * 1000 : syntax error: operand expected (error token is "* 1000 ")
  /usr/lib/bats-core/tracing.bash: line 61: BATS_STACK_TRACE: bad array subscript
  not ok 1 
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/libexec/bats-core/bats-exec-test: line 127: * 1000 : syntax error: operand expected (error token is "* 1000 ")
  not ok 2 
  ...
   not ok 45 
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/bin/date: line 12: mockReturns: No such file or directory
  /usr/bin/date: line 13: /usr/bin/date: syntax error: operand expected (error token is "/usr/bin/date")
  /usr/libexec/bats-core/bats-exec-test: line 127: * 1000 : syntax error: operand expected (error token is "* 1000 ")
  not ok 46 
  /usr/lib/bats-core/tracing.bash: line 61: BATS_STACK_TRACE: bad array subscript
  The command '/bin/sh -c /test.bats' returned a non-zero code: 1

BATS_STACK_TRACE: bad array subscript

So it looks like the root cause was on bats by checking the log I found on for Step 8/13 : RUN apk add --no-cache coreutils bats will install different versions of bats. Which may lead to this error.

on master(docker:20.10.8) it will install bats (1.3.0-r0) on release-3.04(docker:20.10.6) it will install bats (1.2.1-r0)

This may related to https://github.com/bats-core/bats-core/issues/350

Sorry I’m not familiar with bats can’t provide more details.

suggestions:

We may either rollback docker version or pin the right bats version to be apk added

Thank you for this awesome project.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Change workflow config from: uses: elgohr/Publish-Docker-Github-Action@master to uses: elgohr/Publish-Docker-Github-Action@3.04

Error fixed.

it works for me now. Thanks!

Excellent, this failed for me 4 hours ago, I went out to eat lunch, got pulled into a few meetings, and now I was going to investigate why it was failing. Went to this repo to look for a relevant issue, and found out that you’ve already fixed it. Ran my workflow again, it works now!

Thanks for addressing this so quickly, @elgohr, I appreciate it! 👏🏼

@elgohr Seems that there are breaking changes between Alpine 3.13 to Alpine 3.14.2

Great, will investigate later why dependabot merged this, even if this was breaking. Until then I removed dependabot