-
How would I generate something like this with dasel? Note: I don't know how is this called but GitLab tell me it expects "an array of hashes".
I ended up with this, which is not correct:
Command used:
|
Beta Was this translation helpful? Give feedback.
Answered by
TomWright
Mar 30, 2022
Replies: 1 comment 1 reply
-
Hey @paradaj, sorry for the delayed response. I must have missed this when it was first posted. This is how you can achieve that: echo "" |
dasel put string -p yaml 'rules.[].if' 'if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME && $CI_OPEN_MERGE_REQUESTS' |
dasel put string -p yaml -m "rules.[0].when" "never" |
dasel put string -p yaml -m "rules.[].when" "always" The output is: rules:
- if: 'if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME && $CI_OPEN_MERGE_REQUESTS'
when: never
- when: always |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
TomWright
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @paradaj, sorry for the delayed response. I must have missed this when it was first posted.
This is how you can achieve that:
The output is: