yq not found, installed with snap in GH actions

Created on 19 Apr 2020  路  14Comments  路  Source: mikefarah/yq

  • 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.

bug

Most helpful comment

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/[email protected], 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!

All 14 comments

Not a clue sorry - I tried snap on a VM and is seems to work.

There is an official github action you can use: https://github.com/marketplace/actions/yq-portable-yaml-processor.

Alternatively, you could also download the binary using wget or something from the releases...

thanks

I noticed the same thing. Snap release was updated on April 18 which is when it stopped working. Still trying to figure out whether it's Snap or yq packaging issue.

thanks for reporting @pranas , let me know if I should reopen this issue or not

@mikefarah I just want to point out that the yq GH action does't work as well. Here's a minimal failing pipeline, am I doing something wrong?:

name: test
jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    steps:
      - name: yq
        uses: mikefarah/[email protected]
      - name: test
        run: yq --version

it seems that the gh action is using docker so yq won't be available outside the step. still trying to make the original use case (snap install) work.

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

@pranas I was about to do the same thing, thanks for confirming!

Yeah not sure what's going on with snap - downloading the binary direct makes sense to me...

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

      - name: install tooling
        run: |
          brew install yq

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/[email protected]
      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?

Hmm seems so - I have to confess, I've never used github actions IRL. When I added the github action it was based on what I read and what some yq users were asking.

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?

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/[email protected], 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!

I just found yq and the Github Action and can confirm that even in the latest release (3.4.1) I still get the yq: command not found error. I'll try the workarounds listed above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmreicha picture jmreicha  路  9Comments

dakky picture dakky  路  5Comments

mkyc picture mkyc  路  6Comments

infa-ddeore picture infa-ddeore  路  5Comments

tadayosi picture tadayosi  路  6Comments