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

ci: use matrix build for multi-arch build #156

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

jpbernius
Copy link
Contributor

This simplifies your @actions config by replacing duplication with a matrix configuration.

Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

I don't know if this syntax works but we can merge it to main and see.

@tisonkun tisonkun merged commit 9bf10d0 into korandoru:main Oct 10, 2024
16 checks passed
@tisonkun
Copy link
Member

Broken - The workflow is not valid. .github/workflows/docker.yml (Line: 49, Col: 7): Unrecognized named-value: 'matrix'. Located at position 1 within expression: matrix.arch

@jpbernius
Copy link
Contributor Author

Hi @tisonkun, sorry about that.

I had another look and from what I see there would be one option to make this work.
We would need to add an intermediate job which helps us put the matrix value into the output names (Source).
Something like this could work:

  build-and-push-hawkeye:
    ...
    steps:
     ...
+     - name: Matrix Output Converter
+       id: output
+       run: |
+         echo "digest-${{ matrix.arch }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
    outputs:
-     digest-${{ matrix.arch }}: ${{ steps.build.outputs.digest }}
+     digest-amd64: ${{ steps.output.outputs.digest-amd64 }}
+     digest-arm64: ${{ steps.output.outputs.digest-arm64 }}

But, TBH, I am not sure if this is still an improvement. Let me know what you think.

@tisonkun
Copy link
Member

tisonkun commented Oct 11, 2024

I guess this doesn't work because the job finished later will override both outputs or the opposite.

IIRC I ever try to avoid duplicate and read a lot of GitHub Actions' docs but end up with the current solution. But it can be more than one year ago :D

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