mikefarah / yq

yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor
https://mikefarah.gitbook.io/yq/
MIT License
12.11k stars 593 forks source link

yq not found, installed with snap in GH actions #418

Closed itaysk closed 2 years ago

itaysk commented 4 years ago

$ 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.
mikefarah commented 4 years ago

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

itaysk commented 4 years ago

thanks

pranas commented 4 years ago

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.

itaysk commented 4 years ago

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

itaysk commented 4 years ago

@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/yq@3.3.0
      - name: test
        run: yq --version
itaysk commented 4 years ago

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.

pranas commented 4 years ago

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
itaysk commented 4 years ago

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

mikefarah commented 4 years ago

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

sarumont commented 4 years ago

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

      - name: install tooling
        run: |
          brew install yq
remi-debette commented 4 years ago

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?

mikefarah commented 4 years ago

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?

tyrann0us commented 4 years ago

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!

molteninjabob commented 4 years ago

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.

mabushey commented 3 years ago

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

mikefarah commented 2 years ago

Closing due to inactivity