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

fix: matrix loops should be deterministic #1784

Merged
merged 1 commit into from
Sep 2, 2024
Merged

fix: matrix loops should be deterministic #1784

merged 1 commit into from
Sep 2, 2024

Conversation

pd93
Copy link
Member

@pd93 pd93 commented Sep 2, 2024

I noticed that the unit tests for the matrix implementation are flaky. This is because the order of the input maps is not preserved. e.g.

  loop-matrix:
    cmds:
      - for:
          matrix:
            OS: ["windows", "linux", "darwin"]
            ARCH: ["amd64", "arm64"]
        cmd: echo "{{.ITEM.OS}}/{{.ITEM.ARCH}}"

can result in both:

windows/amd64
windows/arm64
linux/amd64
linux/arm64
darwin/amd64
darwin/arm64

and:

windows/amd64
linux/amd64
darwin/amd64
windows/arm64
linux/arm64
darwin/arm64

I have made it so that the output is always the former example.

Copy link
Member

@andreynering andreynering left a comment

Choose a reason for hiding this comment

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

Good catch!

@pd93 pd93 merged commit e4b4d04 into main Sep 2, 2024
14 checks passed
@pd93 pd93 deleted the fix-matrix-order branch September 2, 2024 21:43
pd93 added a commit that referenced this pull request Sep 2, 2024
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