Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use load to slurp YAML file #219

Merged
merged 1 commit into from
Jul 20, 2023
Merged

fix: use load to slurp YAML file #219

merged 1 commit into from
Jul 20, 2023

Conversation

kelvintaywl
Copy link
Contributor

@kelvintaywl kelvintaywl commented Jul 19, 2023

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

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.
@kelvintaywl kelvintaywl requested a review from a team as a code owner July 19, 2023 08:49
@orb-publisher
Copy link

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

@kelvintaywl kelvintaywl changed the title feat: use load to slurp YAML file fix: use load to slurp YAML file Jul 20, 2023
Copy link
Contributor

@KyleTryon KyleTryon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving as a fix

@KyleTryon KyleTryon merged commit 87f3392 into CircleCI-Public:master Jul 20, 2023
2 checks passed
@orb-publisher
Copy link

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
Copy link

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

@kelvintaywl kelvintaywl deleted the feat-use-load branch August 24, 2023 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants