-
Hello 👋. I'm trying to convert Spinnaker pipelines definition (which are giant json) to CUE and it's going great. One think that I don't know how to do yet is generate a field called {
"stages": [
{
…
"refId": "1"
…
},
{
…
"refId": "2"
…
},
{
…
"refId": "3"
…
}
]
} My questions are:
Thank you 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There is the |
Beta Was this translation helpful? Give feedback.
-
If you already have your objects in a list, you can unify the id into the object after string interpolation, in a list comprehension refd: [ for i, obj in objs { obj & { refId: "\(i)" } }] Use |
Beta Was this translation helpful? Give feedback.
If you already have your objects in a list, you can unify the id into the object after string interpolation, in a list comprehension
Use
refId: "\(i+1)"
if you want to start indexing at 1https://cuelang.org/play/?id=ciMZWAwEWBK#cue@export@cue