yq: yq not found, installed with snap in GH actions

  • I have a GitHub actions workflow that uses yq
  • it does sudo snap install yq
  • It was working well, and recently starting to fail (a couple of weeks ago it was fine)
  • it fails for not finding yq (yq: command not found)
  • I even tried the following action which fails: sudo snap install yq && yq --version
  • if I ssh into the worker to debug (using the tmate action), I can use yq. took this debugging info:
$ which yq
/snap/bin/yq

$ echo $PATH
/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/runner/.dotnet/tools

This might be a Github Actions issue, or a snapcraft issue, but I thought to check here as well if you know about a change to yq (or it’s packaging) that might cause this.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (4 by maintainers)

Commits related to this issue

Most upvoted comments

If there’s a better way to publish the action I’m open to suggestions. Otherwise, as there are compiled, dependency free binaries, I don’t see why you wouldn’t just wget the binary and go with that?

@mikefarah, I understand that a one-liner like the one suggested by @pranas is an option to run yq in GitHub Actions. However, it is far more verbose compared to a simple - uses: mikefarah/yq@3.4.0, which is the common way to include third-party packages in your workflow.

So it would be really great if there’d be an easy way to use yq without having to wget it manually. Thanks!

FYI, brew seems to work still (Homebrew for Linux is installed on ubuntu-latest):

      - name: install tooling
        run: |
          brew install yq

We switched to installing binaries from GitHub Releases:

- name: Install yq
  run: |
    sudo wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/3.3.0/yq_linux_amd64
    sudo chmod +x /usr/local/bin/yq

snap is beyond horrible. I’m switching all my Linux machines to Arch because of snap. Ubuntu can keep it.

Hi,

brew is working but is kind of slow (circa 1min) and it cannot pin a specific version of yq, which could break the pipelines. In comparison the yq action installs in seconds.

I found that I cannot run multiline command in the current yq action. The following does not execute but returns a success:

    - name: Apply YQ
      uses: mikefarah/yq@3.4.0
      with:
        cmd: |
          cd ./somedir

          yq w -i ${HELM_VALUES_FILE} flask.image.tag ${{ needs.set-data.outputs.version }}
          yq w -i ${HELM_VALUES_FILE} nginx.image.tag ${{ needs.set-data.outputs.version }}

So is only the binary what is supported in real github action use cases?