post image :date_long | 1 min Read

How to use jq as PRO

curl -s \
      --header "Authorization: Bearer $TOKEN" \
      --header "Content-Type: application/vnd.api+json" \
      --request GET ${URL}  | jq -r '(.included |
  map({(.id): .}) | add) as $inc |
  .data[] | {"run-id": .id} +
  ($inc[$inc[.relationships."configuration-version".data.id].relationships."ingress-attributes".data.id].attributes |
  {
    branch,
    "commit-message",
    "sender-username",
    "clone-url",
    "commit-url",
    "compare-url",
    identifier
  }) +
  (.attributes."status-timestamps"|
    {
      "applied-at",
      "planned-at",
      "queuing-at",
      "applying-at",
      "planning-at",
      "confirmed-at",
      "plan-queued-at",
      "apply-queued-at",
      "queuing-apply-at",
      "plan-queueable-at",

    }
  ) + (.attributes |
    {
      "trigger-reason"

    }
  )
  '

author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus