@@ -152,6 +152,14 @@ def log-skipped [ctx: record, path: string, reason: string] {
152152 compose-log $ctx $" - ($path ) \( ($reason )\) "
153153}
154154
155+ def normalize-variant-list [val : any ]: nothing -> list <string > {
156+ if ($val | describe | str starts-with " list" ) {
157+ $val | each {|v | $v | str trim } | where {|v | ($v | is-not-empty )}
158+ } else {
159+ $val | into string | split row " ," | each {|v | $v | str trim } | where {|v | ($v | is-not-empty )}
160+ }
161+ }
162+
155163def build-file-list [
156164 selected : list <string >
157165 variants : record
@@ -185,30 +193,34 @@ def build-file-list [
185193 let svc_dir = ($base_dir | path join $name | to-forward-slashes )
186194
187195 for dep in ($svc_cfg | columns | where $it != " default" ) {
188- let override = ($variants | get -- optional $" ($name ).($dep )" | default " " )
189- let variant = if ($override | is-not-empty ) {
196+ let override = ($variants | get -- optional $" ($name ).($dep )" | default " " )
197+ let raw_val = if ($override | is-not-empty ) {
190198 $override
191199 } else {
192200 $svc_cfg | get -- optional $dep | default " "
193201 }
194- let reason = if ($override | is-not-empty ) {
195- $" ($name ).($dep )=($variant ) via ENVCTL_VARIANTS"
196- } else {
197- $" ($name ).($dep )=($variant ) default"
198- }
199-
200- let vf = ($svc_dir | path join $" compose.($name ).($dep ).($variant ).yml" | to-forward-slashes )
201- if ($vf | path exists ) {
202- $files = ($files | append $vf )
203- log-included $ctx $vf $reason
204- } else {
205- log-skipped $ctx $vf $reason
206- }
207-
208- let vf_stage = ($svc_dir | path join $" compose.($name ).($dep ).($variant ).($stage ).yml" | to-forward-slashes )
209- if ($vf_stage | path exists ) {
210- $files = ($files | append $vf_stage )
211- log-included $ctx $vf_stage $" ($reason ) / stage: ($stage )"
202+ let dep_variants = (normalize-variant-list $raw_val )
203+
204+ for variant in $dep_variants {
205+ let reason = if ($override | is-not-empty ) {
206+ $" ($name ).($dep )=($variant ) via ENVCTL_VARIANTS"
207+ } else {
208+ $" ($name ).($dep )=($variant ) default"
209+ }
210+
211+ let vf = ($svc_dir | path join $" compose.($name ).($dep ).($variant ).yml" | to-forward-slashes )
212+ if ($vf | path exists ) {
213+ $files = ($files | append $vf )
214+ log-included $ctx $vf $reason
215+ } else {
216+ log-skipped $ctx $vf $reason
217+ }
218+
219+ let vf_stage = ($svc_dir | path join $" compose.($name ).($dep ).($variant ).($stage ).yml" | to-forward-slashes )
220+ if ($vf_stage | path exists ) {
221+ $files = ($files | append $vf_stage )
222+ log-included $ctx $vf_stage $" ($reason ) / stage: ($stage )"
223+ }
212224 }
213225 }
214226
0 commit comments