carvel-dev / carvel-dev/ytt

Sorry, but I just can't figure it out with overlays

Open
#917 3 comments 0 reactions 0 assignees View on GitHub
helping with an issue
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

I have watched the primer youtube video, but I don't think any of those examples apply to my situation. I am trying to add a map item to ONLY the Plan_Containers_development step without using hardcoded indexes since the Plan_Containers_development step could be anywhere. The issue, I think, is that I have arrays of maps of arrays of maps of maps.

My source yaml is:
```
image:
name: image:1234

pipelines:
branches:
dynamic:
- parallel:
- step:
name: build_generic
- step:
name: build_containers
- step:
name: build_lambdas
- step:
name: publish_docs
- parallel:
- step:
name: 'Plan_Containers_development'
deployment: 'development_containers_plan'
- step:
name: 'Plan_Containers_stage'
deployment: 'stage_containers_plan'
- step:
name: 'Plan_Containers_production'
deployment: 'production_containers_plan'
- parallel:
- step:
name: 'Apply_Containers_development'
deployment: 'development_containers_apply'
trigger: 'automatic'
- step:
name: 'Apply_Containers_stage'
deployment: 'stage_containers_apply'
- step:
name: 'Apply_Containers_production'
deployment: 'production_containers_apply'

```

My current overlay is:
```
#@ load("@ytt:overlay", "overlay")
#@overlay/match by=overlay.all
---
pipelines:
branches:
#@overlay/match by=overlay.all
_:
#@overlay/match by=overlay.all, expects="0+"
- parallel:
#@overlay/match by=overlay.all, expects="0+"
-
#@overlay/match by=overlay.subset({"name": "Plan_Containers_development"}), missing_ok=True
step:
new: "value"
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the supplied source YAML and overlay with ytt, focusing on the nested pipelines, branches, parallel, and step structures. Check how overlay matching by the step name behaves without hardcoded indexes. Done means the overlay adds the new map item only to Plan_Containers_development regardless of that step's position.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.