Skip to content

Commit c2114a6

Browse files
Add multiplatform images
1 parent 2bd5bfb commit c2114a6

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Kind can be one of:
2+
# - breaking-change: a change to previously-documented behavior
3+
# - deprecation: functionality that is being removed in a later release
4+
# - bug-fix: fixes a problem in a previous version
5+
# - enhancement: extends functionality but does not break or fix existing behavior
6+
# - feature: new functionality
7+
# - known-issue: problems that we are aware of in a given version
8+
# - security: impacts on the security of a product or a user’s deployment.
9+
# - upgrade: important information for someone upgrading from a prior version
10+
# - other: does not fit into any of the other categories
11+
kind: bug-fix
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: Add missing multiplatform builds
15+
16+
# Long description; in case the summary is not enough to describe the change
17+
# this field accommodate a description without length limits.
18+
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
19+
description: Add multiplaform builds that were accidently removed when migrating to mage.
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: fleet-server
23+
24+
# PR URL; optional; the PR number that added the changeset.
25+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
26+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
27+
# Please provide it if you are adding a fragment for a different PR.
28+
#pr: https://github.com/owner/repo/1234
29+
30+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
31+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
32+
#issue: https://github.com/owner/repo/1234

magefile.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ var (
128128
"linux/arm64",
129129
}
130130

131+
platformsDocker = []string{
132+
"linux/amd64",
133+
"linux/arm64",
134+
}
135+
131136
// platformRemap contains mappings for platforms where if the GOOS/GOARCH key is used, artifacts should use the value instead. Missing keys are unalted.
132137
platformRemap = map[string]string{
133138
"darwin/amd64": "darwin/x86_64",
@@ -987,8 +992,13 @@ func (Docker) Image() error {
987992
if v, ok := os.LookupEnv(envDockerImage); ok && v != "" {
988993
image = v
989994
}
995+
dockerEnv := map[string]string{"DOCKER_BUILDKIT": "1"}
996+
if err := sh.RunWithV(dockerEnv, "docker", "buildx", "create", "--use"); err != nil {
997+
return fmt.Errorf("docker buildx create failed: %w", err)
998+
}
990999

991-
return sh.RunWithV(map[string]string{"DOCKER_BUILDKIT": "1"}, "docker", "build",
1000+
return sh.RunWithV(dockerEnv, "docker", "buildx", "build",
1001+
"--platform", strings.Join(platformsDocker, ","),
9921002
"--build-arg", "GO_VERSION="+getGoVersion(),
9931003
"--build-arg", "DEV="+strconv.FormatBool(isDEV()),
9941004
"--build-arg", "FIPS="+strconv.FormatBool(isFIPS()),

0 commit comments

Comments
 (0)