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

Temporary QEMU fix for CI beskar-ostree image build #35

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: actions/checkout@v3
- name: Release beskar-ostree image
run: ./scripts/mage ci:image ghcr.io/ctrliq/beskar-ostree:${{ github.ref_name }} "${{ github.actor }}" "${{ secrets.GITHUB_TOKEN }}"
Expand Down
15 changes: 13 additions & 2 deletions build/mage/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type genAPI struct {
type binaryConfig struct {
configFiles map[string]string
excludedPlatforms map[dagger.Platform]struct{}
useQEMUForCIImage bool
execStmts [][]string
useProto bool
genAPI *genAPI
Expand Down Expand Up @@ -171,6 +172,7 @@ var binaries = map[string]binaryConfig{
"linux/arm/v6": {},
"linux/arm/v7": {},
},
useQEMUForCIImage: true,
},
}

Expand Down Expand Up @@ -290,15 +292,24 @@ func (b Build) build(ctx context.Context, name string) error {
}

binary := name
if string(platform) != currentPlatform {
nativePlatform := string(platform) == currentPlatform
if !nativePlatform {
binary += "-" + getPlatformBinarySuffix(string(platform))
}

fmt.Printf("Building %s (%s)\n", binary, platform)

src := getSource(client)

golang := client.Container().From(GoImage)
var opts []dagger.ContainerOpts

if binaryConfig.useQEMUForCIImage && buildOpts.publishOptions != nil && !nativePlatform {
opts = append(opts, dagger.ContainerOpts{
Platform: platform,
})
}

golang := client.Container(opts...).From(GoImage)

golang = golang.
WithMountedDirectory("/src", src).
Expand Down
Loading