yq icon indicating copy to clipboard operation
yq copied to clipboard

Github actions attempts to build docker container every time

Open spencer-cdw opened this issue 1 year ago • 2 comments

If a user attempts to use the yq@v4 github actions like so:

      - name: Show inspec failures report
        uses: mikefarah/yq@v4
        with: 
          cmd: yq .error foobar.yaml

They will get a pipeline failure

Build container for action use: '/data/_work/_actions/mikefarah/yq/v4/github-action/Dockerfile'.
  Error: docker: command not found

Desired result

The github action should not attempt to rebuild a container every time the pipeliene runs. The docker container should be provided for the end user. Users should not be expected to setup docker-in-docker to use a github action

Theory

I believe the problem lies in 2 two lines.

https://github.com/mikefarah/yq/blob/master/action.yml#L14-L15

Instead of referencing a pre-build image, it is using docker:// to build the docker image locally.

For contrast, here is a project that uses a CLI similar to yq and does it without needing to rebuild the container every time

https://github.com/mikefarah/yq/blob/master/action.yml#L14-L15

Related

https://github.com/mikefarah/yq/issues/1283

spencer-cdw avatar Mar 28 '23 17:03 spencer-cdw

Note:

Even trying to use @v4.33.1 instead of @4 results in the same behavior

Screenshot 2023-03-28 at 12 08 56 PM

spencer-cdw avatar Mar 28 '23 18:03 spencer-cdw

Dang I thought I fixed that.

@spencer-cdw the link you have for the project without need to build is the wrong one - do you have an example? Or better yet a PR?

mikefarah avatar Mar 31 '23 08:03 mikefarah