Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix with combinations AND includes #3992

Open
3 tasks done
lo48576 opened this issue Jul 30, 2024 · 0 comments
Open
3 tasks done

matrix with combinations AND includes #3992

lo48576 opened this issue Jul 30, 2024 · 0 comments
Labels
enhancement improve existing features pipeline-config related to pipeline config files (.yaml)

Comments

@lo48576
Copy link

lo48576 commented Jul 30, 2024

Clear and concise description of the problem

I want to describe matrix both with the combinations AND the list in the include field at the same time.

My main reasons to such selective include along with the combination is to avoid bloat of combinations.
See the example below.

Suggested solution

Suggested solution is, the combinations and include are both used to generate workflows.

Example:

matrix:
  TOOLCHAIN:
    - stable
    - beta
  PROFILE:
    - debug
    - release
  FEATURES:
    - NONE
    - foo
    - bar
    - foo+bar
  include:
    - TOOLCHAIN: oldest-supported # Versions before stable, but still supported officially.
      PROFILE: debug
      FEATURES: foo+bar # test with all major features enabled at once
    - TOOLCHAIN: nightly
      PROFILE: debug
      FEATURES: NONE # No features
    - TOOLCHAIN: nightly
      PROFILE: debug
      FEATURES: foo+bar # test with all major features at once
    - TOOLCHAIN: nightly
      PROFILE: debug
      FEATURES: foo+bar+experimental-baz # ...and also experimental feature!

steps:
  # long long steps

In this case, there will be 2×2×4 (=16) workflows to be generated from combinations, and additionally, plus 4 workflows to be generated from include (so total is 20).

Alternative

  • Write all "resolved" combinations in include manually.
    • This makes it hard to maintain the variables.
  • Write combinations without include, and accept extra (unnecessary) workflows.
    • This may make tests too long. In the above example, simply putting nightly to TOOLCHAIN: will create 8 more workflows, and I need more for TOOLCHAIN: oldest-supported and experimental-baz cases!
    • This may exceed the limit of combinations (25 or something? In my test environment 27 was the maximum but I don't know why this was not 25...)
  • Split the workflow YAML file into two, a combinations version and include version.
    • This forces the maintainer to duplicate all parts other than matrix (such as clone, variables, when, steps, etc.) so makes maintenance error-prone.

Additional context

I'm not familiar with go but this part seems to be responsible:

// Parse parses the Yaml matrix definition.
func Parse(data []byte) ([]Axis, error) {
axis, err := parseList(data)
if err == nil && len(axis) != 0 {
return axis, nil
}
matrix, err := parse(data)

Parsing both (of course ignoring include as a tag) and merging calc(matrix) and axis may produce the expected result?


BTW, the document should clarify this is not currently supported.

Validations

  • Checked that the feature isn't part of the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@lo48576 lo48576 added the feature add new functionality label Jul 30, 2024
@qwerty287 qwerty287 added enhancement improve existing features pipeline-config related to pipeline config files (.yaml) and removed feature add new functionality labels Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improve existing features pipeline-config related to pipeline config files (.yaml)
Projects
None yet
Development

No branches or pull requests

2 participants