Skip to content

Commit

Permalink
Merge pull request #35 from ctrliq/qemu-temporary-ci-fix
Browse files Browse the repository at this point in the history
Temporary QEMU fix for CI beskar-ostree image build
  • Loading branch information
ikaneshiro authored Jan 26, 2024
2 parents 64999f4 + a48ca6e commit b7c7e43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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 @@ -172,6 +173,7 @@ var binaries = map[string]binaryConfig{
"linux/arm/v6": {},
"linux/arm/v7": {},
},
useQEMUForCIImage: true,
},
BeskarMirrorBinary: {
configFiles: map[string]string{
Expand Down Expand Up @@ -311,15 +313,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

0 comments on commit b7c7e43

Please sign in to comment.