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

Unmarshal empty lists, allow for adjustment-only build matrix #51

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

pda
Copy link
Member

@pda pda commented Sep 30, 2024

Perhaps it should be possible to define empty dimension lists, and then specify values for those dimensions via adjustments.

This pull request is currently just a failing test just some failing tests some tests by @pda and a solution written by @DrJosh9000 🙏🏼

Currently, an empty list gets converted to null which gets rejected server-side as being an invalid value for a matrix dimension value.

e.g. currently a pipeline like this:

steps:

  - command: "echo {{matrix.color}} {{matrix.shape}}"
    label: "{{matrix.color}} {{matrix.shape}}"
    matrix:
      setup:
        color: []
        shape: []
      adjustments:
        - with: { color: "green", shape: "hexagon" }
        - with: { color: "blue", shape: "triangle" }

is rejected with this error:

fatal: Failed to upload and process pipeline: Pipeline upload rejected: Each item within a matrix must be either a string, boolean or integer

Because the setup is uploaded as "setup":{"color":null,"shape":null}.

pda and others added 5 commits September 30, 2024 17:50
Perhaps it should be possible to define empty dimension lists, and then
specify values for those dimensions via adjustments.

Currently, an empty list gets converted to `null` which gets rejected
server-side as being an invalid value for a matrix dimension value.
Unmarshal non-nil `[]any` to non-nil `[]somethingElse`
Copy link
Contributor

@DrJosh9000 DrJosh9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test additions 👍

@pda pda marked this pull request as ready for review October 1, 2024 05:09
@pda pda changed the title parser_matrix_test: empty dimension list (allow for adjustment-only) Unmarshal empty lists, allow for adjustment-only build matrix Oct 1, 2024
@pda pda merged commit 1b67089 into main Oct 1, 2024
1 check passed
@pda pda deleted the matrix-with-empty-dimension branch October 1, 2024 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants