cloudneopren
cloudneopren
TTask
Created by cloudneopren on 9/10/2024 in #help
yaml formatted data
Thanks, looks good
6 replies
TTask
Created by cloudneopren on 9/10/2024 in #help
yaml formatted data
Hi @pbitty, this goes into the right direction. My use case: In case there is a file file.json with a list of tools to be installed each with configurable package managers: [{"cosign":{"pkm":"arkade"}},{"flux":{"pkm":"go"}},{"kubectl":{"pkm":"arkade"}}] Not sure, how to reference the key of the map and the "pkm" field:
json-from-file:
vars:
FILE:
sh: cat file.json
ARRAY:
ref: "fromJson .FILE"
cmds:
- echo FILE={{.FILE}}
- echo ARRAY={{.ARRAY}}
- for:
var: ARRAY
cmd: echo ITEM={{.ITEM.pkm}} KEY={{.KEY}}
json-from-file:
vars:
FILE:
sh: cat file.json
ARRAY:
ref: "fromJson .FILE"
cmds:
- echo FILE={{.FILE}}
- echo ARRAY={{.ARRAY}}
- for:
var: ARRAY
cmd: echo ITEM={{.ITEM.pkm}} KEY={{.KEY}}
6 replies