Skip to content

Commit 4f3ff0b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into beatsauth
2 parents f61a6e8 + 531f2fa commit 4f3ff0b

File tree

19 files changed

+917
-608
lines changed

19 files changed

+917
-608
lines changed

.buildkite/bk.integration-fips.pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ env:
44
ASDF_MAGE_VERSION: 1.14.0
55
MS_GOTOOLCHAIN_TELEMETRY_ENABLED: "0"
66

7-
IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1757120457"
8-
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-1757120457"
9-
IMAGE_UBUNTU_ARM64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-aarch64-1757120457"
7+
IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1757725254"
8+
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-1757725254"
9+
IMAGE_UBUNTU_ARM64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-aarch64-1757725254"
1010
ASDF_TERRAFORM_VERSION: 1.9.2
1111

1212
# This section is used to define the plugins that will be used in the pipeline.

.buildkite/bk.integration.pipeline.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ env:
66

77
# The following images are defined here and their values will be updated by updatecli
88
# Please do not change them manually.
9-
IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1757120457"
10-
IMAGE_UBUNTU_2404_ARM_64: "platform-ingest-elastic-agent-ubuntu-2404-aarch64-1757120457"
11-
IMAGE_RHEL_8: "platform-ingest-elastic-agent-rhel-8-1757120457"
12-
IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1757120457"
13-
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1757120457"
14-
IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1757120457"
9+
IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1757725254"
10+
IMAGE_UBUNTU_2404_ARM_64: "platform-ingest-elastic-agent-ubuntu-2404-aarch64-1757725254"
11+
IMAGE_RHEL_8: "platform-ingest-elastic-agent-rhel-8-1757725254"
12+
IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1757725254"
13+
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1757725254"
14+
IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1757725254"
1515
ASDF_TERRAFORM_VERSION: 1.9.2
1616

1717
# This section is used to define the plugins that will be used in the pipeline.

.buildkite/integration.pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ env:
66

77
# The following images are defined here and their values will be updated by updatecli
88
# Please do not change them manually.
9-
IMAGE_UBUNTU_2204_X86_64: "platform-ingest-elastic-agent-ubuntu-2204-1757120457"
10-
IMAGE_UBUNTU_2204_ARM_64: "platform-ingest-elastic-agent-ubuntu-2204-aarch64-1757120457"
9+
IMAGE_UBUNTU_2204_X86_64: "platform-ingest-elastic-agent-ubuntu-2204-1757725254"
10+
IMAGE_UBUNTU_2204_ARM_64: "platform-ingest-elastic-agent-ubuntu-2204-aarch64-1757725254"
1111

1212
common:
1313
- vault_docker_login: &vault_docker_login

.buildkite/pipeline.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ env:
55

66
# The following images are defined here and their values will be updated by updatecli
77
# Please do not change them manually.
8-
IMAGE_UBUNTU_2204_X86_64: "platform-ingest-elastic-agent-ubuntu-2204-1757120457"
9-
IMAGE_UBUNTU_2204_ARM_64: "platform-ingest-elastic-agent-ubuntu-2204-aarch64-1757120457"
10-
IMAGE_WIN_2016: "platform-ingest-elastic-agent-windows-2016-1757120457"
11-
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1757120457"
12-
IMAGE_WIN_10: "platform-ingest-elastic-agent-windows-10-1757120457"
13-
IMAGE_WIN_11: "platform-ingest-elastic-agent-windows-11-1757120457"
8+
IMAGE_UBUNTU_2204_X86_64: "platform-ingest-elastic-agent-ubuntu-2204-1757725254"
9+
IMAGE_UBUNTU_2204_ARM_64: "platform-ingest-elastic-agent-ubuntu-2204-aarch64-1757725254"
10+
IMAGE_WIN_2016: "platform-ingest-elastic-agent-windows-2016-1757725254"
11+
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1757725254"
12+
IMAGE_WIN_10: "platform-ingest-elastic-agent-windows-10-1757725254"
13+
IMAGE_WIN_11: "platform-ingest-elastic-agent-windows-11-1757725254"
1414

1515
steps:
1616
- label: "check-ci"

NOTICE-fips.txt

Lines changed: 148 additions & 148 deletions
Large diffs are not rendered by default.

NOTICE.txt

Lines changed: 148 additions & 148 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ To build a local version of the agent for development, run the command below. Th
108108
DEV=true EXTERNAL=true SNAPSHOT=true PLATFORMS=linux/amd64 PACKAGES=tar.gz mage -v package
109109
```
110110

111+
If you build the same agent package often (when running integration tests, for example),
112+
you can also set KEEP_ARCHIVE=true in your environment. The packaging step will then
113+
avoid deleting the binary archive after the package is generated, removing the need to
114+
re-download binaries on every invocation.
115+
111116
The resulting package will be produced in the build/distributions directory. The version is controlled by the value in [version.go](version/version.go).
112117
To install the agent extract the package and run the install command:
113118

dev-tools/mage/downloads/utils.go

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@ type downloadRequest struct {
3131
// It writes to the destination file as it downloads it, without
3232
// loading the entire file into memory.
3333
func downloadFile(downloadRequest *downloadRequest) error {
34-
targetFile, err := os.Create(downloadRequest.TargetPath)
35-
if err != nil {
36-
return fmt.Errorf("creating file: %w", err)
37-
}
38-
defer func() {
39-
_ = targetFile.Close()
40-
}()
34+
stat, _ := os.Stat(downloadRequest.TargetPath)
4135

4236
exp := getExponentialBackoff(3)
4337

@@ -47,6 +41,11 @@ func downloadFile(downloadRequest *downloadRequest) error {
4741
if err != nil {
4842
return fmt.Errorf("creating request: %w", err)
4943
}
44+
// if the target file already exists, add the If-Modified-Since header
45+
if stat != nil {
46+
req.Header.Add("If-Modified-Since", stat.ModTime().Format(http.TimeFormat))
47+
}
48+
5049
resp, err := http.DefaultClient.Do(req)
5150
if err != nil {
5251
retryCount++
@@ -55,23 +54,36 @@ func downloadFile(downloadRequest *downloadRequest) error {
5554
defer func() {
5655
_ = resp.Body.Close()
5756
}()
57+
58+
if resp.StatusCode == http.StatusNotModified {
59+
return nil
60+
}
61+
62+
targetFile, err := os.Create(downloadRequest.TargetPath)
63+
if err != nil {
64+
return fmt.Errorf("creating file: %w", err)
65+
}
66+
defer func() {
67+
_ = targetFile.Close()
68+
}()
69+
5870
_, err = io.Copy(targetFile, resp.Body)
5971
if err != nil {
6072
// try to drain the body before returning to ensure the connection can be reused
6173
_, _ = io.Copy(io.Discard, resp.Body)
6274
return fmt.Errorf("writing file %s: %w", targetFile.Name(), err)
6375
}
6476

77+
_ = os.Chmod(targetFile.Name(), 0666)
78+
6579
return nil
6680
}
6781

68-
err = backoff.Retry(download, exp)
82+
err := backoff.Retry(download, exp)
6983
if err != nil {
7084
return err
7185
}
7286

73-
_ = os.Chmod(targetFile.Name(), 0666)
74-
7587
return nil
7688
}
7789

dev-tools/mage/gotest.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ func GoTest(ctx context.Context, params GoTestArgs) error {
261261
testArgs = append(testArgs,
262262
"-covermode=atomic",
263263
"-coverprofile="+params.CoverageProfileFile,
264+
"-coverpkg=./...", // needed to calculate the coverage across the elastic-agent packages
264265
)
265266
}
266267

0 commit comments

Comments
 (0)