earthly / earthly

Super simple build framework with fast, repeatable builds and an instantly familiar syntax – like Dockerfile and Makefile had a baby.
https://earthly.dev
Mozilla Public License 2.0
11.19k stars 392 forks source link

Deprecate matrix builds in favor of array arguments #3435

Open idelvall opened 10 months ago

idelvall commented 10 months ago

It would be useful to have a way to pass an array as an argument, without requiring the developer to deal with its serialization/deserialization.

In particular, I would like that repeated args are available as a bash array:

foo:
  DO +BAR \
    --color=red
    --color=blue
    --color=green
  DO +BAR2 \
    --color=red
    --color=blue
    --color=green

BAR:
  COMMAND
  ARG color
  RUN \
    for c in "${color[@]}"; \
      do echo $c; \
    done

BAR2:
  COMMAND
  ARG color
  FOR c IN $color
    RUN echo $c
  END

Right now, arg repetition makes the target being called multiple times in parallel (matrix builds), but I found this other behavior more intuitive.

Proposal

vladaionescu commented 10 months ago

Note that the proposed syntax is currently used to represent a matrix target.

This is likely a duplicate of https://github.com/earthly/earthly/issues/1890 (currently on the roadmap). Please reopen if not!

idelvall commented 10 months ago

Note that the proposed syntax is currently used to represent a matrix target.

I know, actually my proposal is to deprecate this behavior in favor of array arguments. Updating the description