Skip to content
12 changes: 6 additions & 6 deletions .buildkite/pipeline.package.mbp.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
name: "fleet server package mbp"
env:
IMAGE_UBUNTU_X86_64: "family/core-ubuntu-2204"
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2204-aarch64"
IMAGE_UBUNTU_X86_64: "platform-ingest-fleets-ubuntu-2204-1770381074"
Copy link
Member Author

Choose a reason for hiding this comment

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

Running agent pre-command hook, I'm not sure what's the reason for using that particular pre-command hook, but IIRC, fleet-server does not need it.

Can you confirm if the VM Images used are not copying the pre-command hook?

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been trying to find any reference from the fleet-server images but I found nothing, so I'd say that no copy of the hooks/base/pre-command is happening in this images

Copy link
Member Author

Choose a reason for hiding this comment

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

1770381074 is from February (2026-02-06 12:31:14 UTC), but there are new commits in the ci-agent-images. Can you generate the new VM images and update the timestamp here?

Copy link
Contributor

@fr4nc1sc0-r4m0n fr4nc1sc0-r4m0n Mar 3, 2026

Choose a reason for hiding this comment

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

Sure:

Let's see if it works.

Copy link
Contributor

@fr4nc1sc0-r4m0n fr4nc1sc0-r4m0n Mar 4, 2026

Choose a reason for hiding this comment

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

In this execution the E2E test have passed:

IMAGE_UBUNTU_ARM_64: "platform-ingest-fleet-server-ubuntu-2204-aarch64-1770381074"

# This section is used to define the plugins that will be used in the pipeline.
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
Expand Down Expand Up @@ -91,7 +91,7 @@ steps:
command: ".buildkite/scripts/package.sh snapshot"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
image: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
artifact_paths:
- build/distributions/**
Expand All @@ -106,7 +106,7 @@ steps:
.buildkite/scripts/package.sh staging
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
image: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
artifact_paths:
- build/distributions/**
Expand All @@ -122,7 +122,7 @@ steps:
FIPS: "true"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
image: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
artifact_paths:
- build/distributions/**
Expand All @@ -139,7 +139,7 @@ steps:
FIPS: "true"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
image: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
artifact_paths:
- build/distributions/**
Expand Down
10 changes: 5 additions & 5 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
env:
DOCKER_COMPOSE_VERSION: "1.25.5"
TERRAFORM_VERSION: "1.6.4"
IMAGE_UBUNTU_X86_64: "platform-ingest-elastic-agent-ubuntu-2204-1767879728"
IMAGE_UBUNTU_ARM_64: "platform-ingest-elastic-agent-ubuntu-2204-aarch64-1767879728"
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-fleet-server-ubuntu-2204-fips"
IMAGE_UBUNTU_X86_64: "platform-ingest-fleets-ubuntu-2204-1770381074"
IMAGE_UBUNTU_ARM_64: "platform-ingest-fleet-server-ubuntu-2204-aarch64-1770381074"
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-fleet-server-ubuntu-2204-fips-1770381074"

# This section is used to define the plugins that will be used in the pipeline.
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
Expand Down Expand Up @@ -173,7 +173,7 @@ steps:
GO_DISTRO: "microsoft"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_X86_64_FIPS}"
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
instanceType: "m5.xlarge"
artifact_paths:
- build/*.xml
Expand All @@ -187,7 +187,7 @@ steps:
GO_DISTRO: "stdlib"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_X86_64_FIPS}"
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
instanceType: "m5.xlarge"
artifact_paths:
- build/*.xml
Expand Down
64 changes: 53 additions & 11 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ func (Build) Local() error {
outFile = filepath.Join("bin", binaryExe)

}
return sh.RunWithV(env, "go", "build", "-tags="+getTagsString(), "-gcflags="+getGCFlags(), "-ldflags="+getLDFlags(), "-o", outFile, ".")
return sh.RunWithV(env, "go", "build", "-buildvcs=false", "-tags="+getTagsString(), "-gcflags="+getGCFlags(), "-ldflags="+getLDFlags(), "-o", outFile, ".")
}

// Binary builds release binaries for the specified platforms.
Expand Down Expand Up @@ -753,6 +753,7 @@ func goBuild(osArg, archArg string, cover bool) error {

args := []string{
"build",
"-buildvcs=false",
"-tags=" + getTagsString(),
"-gcflags=" + getGCFlags(),
"-ldflags=" + getLDFlags(),
Expand Down Expand Up @@ -973,6 +974,8 @@ func (Docker) Release() error {
}

// dockerRun runs the target on a container produced by docker:builder.
// When .git/objects/info/alternates exists and points to paths on the host (e.g. CI git mirrors),
// those paths are mounted into the container at the same location so Go's VCS stamping can read them.
func dockerRun(target string) error {
userInfo, err := user.Current()
if err != nil {
Expand All @@ -982,17 +985,56 @@ func dockerRun(target string) error {
if err != nil {
return fmt.Errorf("unable to get wd: %w", err)
}
return sh.RunV("docker", "run", "--rm",
"-u", userInfo.Uid+":"+userInfo.Gid,
args := []string{"run", "--rm",
"-u", userInfo.Uid + ":" + userInfo.Gid,
"--env=GOCACHE=/go/cache",
"--volume", pwd+":/fleet-server/",
"-e", envPlatforms+"="+strings.Join(getPlatforms(), ","),
"-e", envDev+"="+strconv.FormatBool(isDEV()),
"-e", envFIPS+"="+strconv.FormatBool(isFIPS()),
"-e", envSnapshot+"="+strconv.FormatBool(isSnapshot()),
"-e", envVersionQualifier+"="+os.Getenv(envVersionQualifier),
dockerBuilderName+":"+getGoVersion(), target,
)
"--volume", pwd + ":/fleet-server/",
"-e", envPlatforms + "=" + strings.Join(getPlatforms(), ","),
"-e", envDev + "=" + strconv.FormatBool(isDEV()),
"-e", envFIPS + "=" + strconv.FormatBool(isFIPS()),
"-e", envSnapshot + "=" + strconv.FormatBool(isSnapshot()),
"-e", envVersionQualifier + "=" + os.Getenv(envVersionQualifier),
}
for _, vol := range gitAlternatesVolumeMounts() {
args = append(args, "--volume", vol)
}
args = append(args, dockerBuilderName+":"+getGoVersion(), target)
return sh.RunV("docker", args...)
}

// gitAlternatesVolumeMounts returns docker --volume args for paths listed in
// .git/objects/info/alternates that exist on the host, so the container can
// access them at the same path (required for Go VCS stamping when using git alternates).
func gitAlternatesVolumeMounts() []string {
alternatesPath := filepath.Join(".git", "objects", "info", "alternates")
data, err := os.ReadFile(alternatesPath)
if err != nil {
return nil
}
infoDir := filepath.Dir(alternatesPath)
var mounts []string
scanner := bufio.NewScanner(bytes.NewReader(data))
for scanner.Scan() {
path := strings.TrimSpace(scanner.Text())
if path == "" || strings.HasPrefix(path, "#") {
continue
}
// Path in alternates is relative to .git/objects/info or absolute.
if !filepath.IsAbs(path) {
path = filepath.Join(infoDir, path)
}
path, err = filepath.Abs(path)
if err != nil {
continue
}
info, err := os.Stat(path)
if err != nil || !info.IsDir() {
continue
}
// Mount host path to same path in container so Go's VCS resolution works.
mounts = append(mounts, path+":"+path)
}
return mounts
}

// Binary builds binaries within a docker image produced by docker:builder.
Expand Down