-
Notifications
You must be signed in to change notification settings - Fork 4
Description
The bats test suite uses yq to manipulate yaml files (it's like jq but knowing the yaml format).
It's mentioned in CONTRIBUTING.md with brew install yq as the command.
It should be noted that there are different yq packages:
Ubuntu 23 or newer ship an yq package with an yq command that is a Python wrapper on top of jq. It can also be installed with pip3 install yq. With this flavor of yq, the bats test suite fails with a syntax error on the first yq invocation. The version reported by yq --version is: yq 3.4.3
There is another yq project written in Go (github page) which is what the bats test suite expects. For that one, yq --version reports:
yq (https://github.com/mikefarah/yq/) version v4.44.3
To install the "correct" yq on Linux Ubuntu:
sudo snap install yqis not adequate because binaries run within snap have their own private/tmp, and the bats test suite creates config files in the system-wide/tmp.- Compiling from source after
git clone https://github.com/mikefarah/yqdid not work me, failing with Go compilation error. - Getting the source at https://github.com/mikefarah/yq/archive/refs/tags/v4.44.3.tar.gz and compiling also failed with different compilation errors.
- Installing the pre-compiled static executable file at https://github.com/mikefarah/yq/releases/download/v4.44.3/yq_linux_amd64 did work
The dependency on yq is mentioned in:
scripts/bats/test/libs/dependencies.bash:apk add yqscripts/localdev/configuration/bats/Dockerfile:RUN apk add postgresql-client yq
Indeed Alpine Linux provides an yq package except that it exists in the v3.15 branch, but not in the more recent branches. These have two distinct yq-go and yq-python packages.
It probably implies that apk add yq will fail to work with more recent Alpine versions.
I suggest to get rid of the yq dependency if possible.