opentdf / platform

OpenTDF Platform monorepo enabling the development and integration of _forever control_ of data into new and existing applications. The concept of forever control stems from an increasingly common concept known as zero trust.
BSD 3-Clause Clear License
15 stars 4 forks source link

chore(ci): fix jq syntax #1016

Closed dmihalcik-virtru closed 4 days ago

dmihalcik-virtru commented 1 week ago

jq 1.7.1 is fine with the .[] syntax but not version 1.6, which the version in the current ubuntu GitHub action runner.

Tested via running

> docker run -it --rm -v $(pwd)/:/project debian /bin/bash
> apt-get update
> apt-get install curl
> curl -L -o /usr/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64
> chmod +x /usr/bin/jq
> apt-get install golang
> cd project/sdk
> x=lib/fixtures
> export pkg=github.com/opentdf/platform/${x}

>  go mod edit --json | jq -e '.Replace.[] | select(.Old.Path == env.pkg)'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.Replace.[] | select(.Old.Path == env.pkg)
jq: 1 compile error

> go mod edit --json | jq -e '.Replace[] | select(.Old.Path == env.pkg)'
jq: error (at <stdin>:399): Cannot iterate over null (null)

> go mod edit --json | jq -e '.Require.[] | select(.Path == env.pkg)'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.Require.[] | select(.Path == env.pkg)
jq: 1 compile error

> go mod edit --json | jq -e '.Require[] | select(.Path == env.pkg)'
{
"Path": "github.com/opentdf/platform/lib/fixtures",
"Version": "v0.2.5"
}