CircleCI-Public / orb-tools-orb

Various tools for authoring and publishing CircleCI orbs
https://circleci.com/orbs/registry/orb/circleci/orb-tools
MIT License
50 stars 74 forks source link

fix: use load to slurp YAML file #219

Closed kelvintaywl closed 11 months ago

kelvintaywl commented 11 months ago

This change leverages the load function from yq. It allows us to load the full content from a YAML file. This way, we do not need to cat the YAML file content in a prior step.

In addition, I believe this can avoid the 'Argument list too long' yq error. Related: https://stackoverflow.com/questions/70278587/yq-v4-env-operator-returning-errnoe2big-argument-list-too-long

I've made a sample project to showcase the proposed change. Public workflow here: https://app.circleci.com/pipelines/github/kelvintaywl-cci/explore-yq/2/workflows/12f05943-7c50-453b-a680-210979221316/jobs/2

additional

I confirmed that the executors have yq >= 4.x so the load function should indeed be available for the continue job (if executor is kept as default).

# docker image of orb-tools/default executor
$ docker run --rm circleci/circleci-cli:0.1.26646 yq --version
yq (https://github.com/mikefarah/yq/) version v4.31.2

# docker image of orb-tools/python executor
$ docker run --rm cimg/python:3.11 yq --version
yq (https://github.com/mikefarah/yq/) version v4.30.6
orb-publisher commented 11 months ago

Your development orb(s) have been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link(s): https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:9ca9fddbea3418dc7e5e8ac1a4941a422c8c7d17 https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:alpha

orb-publisher commented 11 months ago

Your development orb(s) have been published. It will expire in 30 days. You can preview what this will look like on the CircleCI Orb Registry at the following link(s): https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:87f33926e3a3bb02f1b46be9b83a5c45b4ebe2ca https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=dev:alpha

orb-publisher commented 11 months ago

Your orb has been published to the CircleCI Orb Registry. You can view your published orb on the CircleCI Orb Registry at the following link: https://circleci.com/developer/orbs/orb/circleci/orb-tools?version=12.0.4