home.social

#yq — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #yq, aggregated by home.social.

  1. Turns out that not only do Actions runners come with jq preinstalled, but yq is there too.

    hollycummins.com/using-yq-in-g…

    There was a featured snippet for “is yq available on GitHub actions,” which directed me to a marketplace installer. The yq project itself had a marketplace installer. Clearly, I needed to install it before using it. Right?

    My colleague George Gastaldi looked at what I’d done, and pointed out yq was available on the runners. This matters, because we try and limit our use of external, ‘non-official’ actions, for supply chain security reasons.

    So I searched again to confirm, and … still found very little. To actually confirm, I had to merge and experiment. And, indeed, the GitHub runners do come with yq pre-installed. They’ve had yq since 2021.

    #yaml #yq #jq #GithubActions
    #CICD
    #ContinuousIntegration
    #ContinuousDeployment

  2. Turns out that not only do Actions runners come with jq preinstalled, but yq is there too.

    hollycummins.com/using-yq-in-g…

    There was a featured snippet for “is yq available on GitHub actions,” which directed me to a marketplace installer. The yq project itself had a marketplace installer. Clearly, I needed to install it before using it. Right?

    My colleague George Gastaldi looked at what I’d done, and pointed out yq was available on the runners. This matters, because we try and limit our use of external, ‘non-official’ actions, for supply chain security reasons.

    So I searched again to confirm, and … still found very little. To actually confirm, I had to merge and experiment. And, indeed, the GitHub runners do come with yq pre-installed. They’ve had yq since 2021.

    #yaml #yq #jq #GithubActions
    #CICD
    #ContinuousIntegration
    #ContinuousDeployment

  3. Turns out that not only do Actions runners come with jq preinstalled, but yq is there too.

    hollycummins.com/using-yq-in-g…

    There was a featured snippet for “is yq available on GitHub actions,” which directed me to a marketplace installer. The yq project itself had a marketplace installer. Clearly, I needed to install it before using it. Right?

    My colleague George Gastaldi looked at what I’d done, and pointed out yq was available on the runners. This matters, because we try and limit our use of external, ‘non-official’ actions, for supply chain security reasons.

    So I searched again to confirm, and … still found very little. To actually confirm, I had to merge and experiment. And, indeed, the GitHub runners do come with yq pre-installed. They’ve had yq since 2021.

    #yaml #yq #jq #GithubActions
    #CICD
    #ContinuousIntegration
    #ContinuousDeployment

  4. Turns out that not only do Actions runners come with jq preinstalled, but yq is there too.

    hollycummins.com/using-yq-in-g…

    There was a featured snippet for “is yq available on GitHub actions,” which directed me to a marketplace installer. The yq project itself had a marketplace installer. Clearly, I needed to install it before using it. Right?

    My colleague George Gastaldi looked at what I’d done, and pointed out yq was available on the runners. This matters, because we try and limit our use of external, ‘non-official’ actions, for supply chain security reasons.

    So I searched again to confirm, and … still found very little. To actually confirm, I had to merge and experiment. And, indeed, the GitHub runners do come with yq pre-installed. They’ve had yq since 2021.

    #yaml #yq #jq #GithubActions
    #CICD
    #ContinuousIntegration
    #ContinuousDeployment

  5. Turns out that not only do Actions runners come with jq preinstalled, but yq is there too.

    hollycummins.com/using-yq-in-g…

    There was a featured snippet for “is yq available on GitHub actions,” which directed me to a marketplace installer. The yq project itself had a marketplace installer. Clearly, I needed to install it before using it. Right?

    My colleague George Gastaldi looked at what I’d done, and pointed out yq was available on the runners. This matters, because we try and limit our use of external, ‘non-official’ actions, for supply chain security reasons.

    So I searched again to confirm, and … still found very little. To actually confirm, I had to merge and experiment. And, indeed, the GitHub runners do come with yq pre-installed. They’ve had yq since 2021.

    #yaml #yq #jq #GithubActions
    #CICD
    #ContinuousIntegration
    #ContinuousDeployment

  6. So, in order to do the cleanups, I can use `yq`'s excellent filtering abilities. For example I have a list of verbatim API endpoints like `/token` and `/endpoint/{id}` in `allowed_apis.lst`:

    ```
    yq '(load_str("allowed_apis.lst") | split("\n")) as $l | .paths |= with_entries(select(.key as $k | $l | any_c(. == $k)))' api.yaml > api_cleaned_paths.yaml
    ```

    And similar approach for models, except for `any_c(..)` I have to use `all_c(. != $k)`.

    #openapi #yq #yaml #openapigenerator

  7. So, workflow is following:
    0. Manually fix the OpenAPI `bundle.yaml` - this was actually something that caused the tool to exit with error...
    1. Filter out unwanted APIs with `yq`
    2. Run the openapi-generator-cli validator to get the list of unused models/types
    3. Use `sed` to parse the list of unused models/types
    4. Use `yq` again to filter out the unneeded models.
    5. Generate the "minimum" client and models :)

    #openapi #sed #yq #openapigenerator

  8. So.. looked into this OpenAPI thing to query an API and eventually found a fancy tool - openapi-generator - openapi-generator.tech/.
    With this I can generate a ton of useful boilerplate in almost every programming language.

    But what if I only want to communicate only two of the endpoints?!

    So, over a few days I've been part-time tinkering with `yq` and `sed` to cut down the autogenerated code to include just the minimum by filtering out the unwanted APIs and data types...

    #openapi #yq #sed

  9. CW: shell script in post

    YAML to XLSX pipeline 🙈

    This was fun, but I don't want to do it again.

    curl -s raw.githubusercontent.com/AKVo \
    | uvx yq '(.l10n.strings + .l10n.frontend_strings) | to_entries | map(select(.value | type == "object")) | map({id: .key} + .value)' \
    | uvx --from csvkit in2csv -f json > strings.csv \
    && libreoffice --headless --infilter=CSV:44,34,76,1 --convert-to xlsx strings.csv

    #YAML #CSV #XSLX #jq #yq #CSVKit #LibreOffice #CLI #ShellScript #bash

  10. Programming By Stealth is officially spun off as a standalone podcast with new music, a new intro, and a direct link to @bart’s fabulous tutorial shownotes!

    Instalment 169 of X — Advanced YAML Topics pbs.bartificer.net/pbs169

    #Programming #ProgrammingByStealth #YAML #yq

  11. 🆕 📜: Get webmentions with shell script using jq & yq

    Here is my new blog post of how I manage on website to fetch and sync new webmentions, using shell script and `jq` and `yq` to parse and set the data

    maw.sh/blog/get-webmention-wit

  12. I'm making a concerted effort to switch flat config files to formatted YAML in my various scripts and utilities. I've been using Mike Farah's yq for my random shell scripts, excellent!

  13. I half sort of found a way to do this with #Infisical and #yq, by using props annotation and parsing it through yq:

    infisical export --env=dev -fyaml | yq -pprops -o yaml

    This get it's into properly formatted yaml. yq can also do the same in the opposite direction to import back into infisical.

    And to support having .'s in keys, use \\x2e and pass it through echo:

    echo -e "$(infisical export --env=dev -fyaml | yq -pprops -o yaml)"

  14. Hello Fediverse, why did nobody tell me about #YQ ?
    #jq #json #yaml #xml
    yq: Command-line YAML/XML/TOML processor - jq wrapper for YAML, XML, TOML documents
    kislyuk.github.io/yq/

  15. I got to output tables. Very nice!

  16. Whoop whoop - yq is kinda "jq for yaml" :

    mikefarah.gitbook.io/yq

    Bonus : yq ist able to transform json to yaml and vice versa 🤟

  17. Whoop whoop - yq is kinda "jq for yaml" :

    mikefarah.gitbook.io/yq

    Bonus : yq ist able to transform json to yaml and vice versa 🤟

  18. I don't know if I'm learning syntax or just making a collection of usable queries, but here's one for yaml from today.

    To pull the config for the user(s) with "prod" in the name:

    yq '.users.[] | select(.name|contains("prod"))' $home\.kube\config

    That's github.com/mikefarah/yq

    doesn't (yet) support _all_ of jq's syntax, but it supports everything I've needed, and it works on yaml AS WELL AS on json...

  19. @ikkeT while #yq is super useful, especially in scripts, I have found #k9s to be super for exploring cluster and doing small edits.

  20. @skunksarebetter If you do a lot of work around , should definitely be in your digital toolbox!

  21. is a processor.

    yq is a preprocessor for which converts YAML into JSON, processes the data with standard jq, finally outputting YAML. yq has the ability to preserve custom tags and formatting, allowing for more accurate round-trip processing. yq also includes for , and for .

    Website 🔗️: github.com/kislyuk/yq

  22. is a processor.

    yq is a command line program that takes in YAML data and runs an expression against it, like . yq programs can be made up of many operators, including simple accessors, assignment operators, arithmetic, sorting, recursive globbing, and more. yq can also process , as it is a subset of YAML.

    Website 🔗️: github.com/mikefarah/yq