Skip to content

Commit f98ba8c

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/elastic/elastic-agent-libs-0.7.5
2 parents 13fc8e9 + d8f5134 commit f98ba8c

File tree

127 files changed

+11199
-1618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+11199
-1618
lines changed

.buildkite/hooks/pre-command.ps1

+4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ go version
1414

1515
$GOPATH = $(go env GOPATH)
1616
$env:Path = "$GOPATH\bin;" + $env:Path
17+
$env:GOTMPDIR = "$GOPATH\tmp"
18+
New-Item -ItemType Directory -Force -Path $env:GOTMPDIR
1719
[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine)
20+
[Environment]::SetEnvironmentVariable("GOTMPDIR", "$GOPATH\tmp", [EnvironmentVariableTarget]::Machine)
1821
[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine)
22+
go env
1923

2024
# Install tools
2125
go install github.com/magefile/mage

.buildkite/pipeline.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ steps:
130130
agents:
131131
provider: "gcp"
132132
# TODO create own image
133-
image: "family/endpoint-windows-10-tester-rel"
133+
image: "family/general-windows-10"
134134
machine_type: "n2-standard-8"
135135
disk_type: "pd-ssd"
136136
retry:
@@ -147,7 +147,7 @@ steps:
147147
agents:
148148
provider: "gcp"
149149
# TODO create own image
150-
image: "family/endpoint-windows-11-tester-rel"
150+
image: "family/general-windows-11"
151151
machine_type: "n2-standard-8"
152152
disk_type: "pd-ssd"
153153
retry:

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/deploy/kubernetes @elastic/obs-cloudnative-monitoring
55
/dev-tools/kubernetes @elastic/obs-cloudnative-monitoring
66
/internal/pkg/composable/providers/kubernetes @elastic/obs-cloudnative-monitoring
7+
/internal/pkg/agent/application/configuration_embed_changed_test.go @elastic/cloudbeat

.github/workflows/bump-golang.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ name: bump-golang
44
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: "0 20 * * 6"
7+
- cron: "0 20 * * 1-6"
88

99
permissions:
1010
contents: read
1111

12+
env:
13+
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
14+
1215
jobs:
1316
bump:
1417
runs-on: ubuntu-latest
@@ -21,3 +24,5 @@ jobs:
2124
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
2225
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
2326
pipeline: ./.github/updatecli-bump-golang.yml
27+
notifySlackChannel: "#ingest-notifications"
28+
messageIfFailure: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, `@agent-team` please look what's going on <${{ env.JOB_URL }}|here>"

.go-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.21.6
1+
1.21.7

.golangci.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ linters-settings:
116116

117117
gosimple:
118118
# Select the Go version to target. The default is '1.13'.
119-
go: "1.21.6"
119+
go: "1.21.7"
120120

121121
nakedret:
122122
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
@@ -136,17 +136,17 @@ linters-settings:
136136

137137
staticcheck:
138138
# Select the Go version to target. The default is '1.13'.
139-
go: "1.21.6"
139+
go: "1.21.7"
140140
checks: ["all"]
141141

142142
stylecheck:
143143
# Select the Go version to target. The default is '1.13'.
144-
go: "1.21.6"
144+
go: "1.21.7"
145145
checks: ["all"]
146146

147147
unused:
148148
# Select the Go version to target. The default is '1.13'.
149-
go: "1.21.6"
149+
go: "1.21.7"
150150

151151
gosec:
152152
excludes:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GO_VERSION=1.21.6
1+
ARG GO_VERSION=1.21.7
22
FROM circleci/golang:${GO_VERSION}
33

44

Dockerfile.skaffold

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GO_VERSION=1.21.6
1+
ARG GO_VERSION=1.21.7
22
ARG crossbuild_image="docker.elastic.co/beats-dev/golang-crossbuild"
33
ARG AGENT_VERSION=8.9.0-SNAPSHOT
44
ARG AGENT_IMAGE="docker.elastic.co/beats/elastic-agent"

NOTICE.txt

+416-595
Large diffs are not rendered by default.

_meta/config/providers.yml.tmpl

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
# and conditionals. Each provider's keys are automatically prefixed with the name
55
# of the provider.
66

7+
# All registered providers are enabled by default.
8+
9+
# Disable all providers by default and only enable explicitly configured providers.
10+
# agent.providers.initial_default: false
11+
712
#providers:
813

914
# Agent provides information about the running agent.

catalog-info.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ spec:
4848
filter_condition: >-
4949
build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null)
5050
cancel_intermediate_builds: true
51-
cancel_intermediate_builds_branch_filter: "!main"
51+
cancel_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
5252
skip_intermediate_builds: true
53-
skip_intermediate_builds_branch_filter: "!main"
53+
skip_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
5454
env:
5555
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: "true"
5656
SLACK_NOTIFICATIONS_CHANNEL: "#ingest-notifications"
@@ -96,14 +96,16 @@ spec:
9696
filter_condition: >-
9797
build.pull_request.id == null || (build.creator.name == 'elasticmachine' && build.pull_request.id != null)
9898
cancel_intermediate_builds: true
99-
cancel_intermediate_builds_branch_filter: "!main"
99+
cancel_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
100100
skip_intermediate_builds: true
101-
skip_intermediate_builds_branch_filter: "!main"
101+
skip_intermediate_builds_branch_filter: '!main !7.* !8.* !9.*'
102102
teams:
103103
ingest-fp:
104104
access_level: MANAGE_BUILD_AND_READ
105105
release-eng:
106106
access_level: BUILD_AND_READ
107+
endpoint-ci-admin:
108+
access_level: BUILD_AND_READ
107109
everyone:
108110
access_level: READ_ONLY
109111

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: security
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: Upgrade to Go 1.21.7
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: Removes support for Windows 8.1. See https://tip.golang.org/doc/go1.21#windows.
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: "elastic-agent"
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/elastic/elastic-agent/pull/4221
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

changelog/fragments/1704304944-Upgrade-to-Go-1.21.6.yaml changelog/fragments/1704824761-fleet-config-change-logging.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@
88
# - security: impacts on the security of a product or a user’s deployment.
99
# - upgrade: important information for someone upgrading from a prior version
1010
# - other: does not fit into any of the other categories
11-
kind: security
11+
kind: feature
1212

1313
# Change summary; a 80ish characters long description of the change.
14-
summary: Upgrade to Go 1.21.6
14+
summary: fleet-config-change-logging
1515

1616
# Long description; in case the summary is not enough to describe the change
1717
# this field accommodate a description without length limits.
1818
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
19-
# description:
19+
#description:
2020

2121
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22-
component: "elastic-agent"
22+
component: Coordinator
2323

2424
# PR URL; optional; the PR number that added the changeset.
2525
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
2626
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
2727
# Please provide it if you are adding a fragment for a different PR.
28-
pr: https://github.com/elastic/elastic-agent/pull/4073
28+
#pr: https://github.com/owner/repo/1234
2929

3030
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
3131
# If not present is automatically filled by the tooling with the issue linked to the PR number.
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: On Windows prevent uninstall from within installed directory
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: 'On Windows, prevent uninstall from within installed directory to prevent a sharing violation. Also for install and uninstall, print debug logs to stderr if command fails.'
20+
21+
# Affected component; a word indicating the component this changeset affects.
22+
component: agent
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
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: enhancement
12+
13+
# Change summary; a 80ish characters long description of the change.
14+
summary: Add agent.providers.initial_default configuration flag to disable providers by default
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:
20+
21+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
22+
component: elastic-agent
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/elastic/elastic-agent/pull/4166
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/elastic/elastic-agent/issues/4145

dev-tools/mage/common.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,14 @@ func untar(sourceFile, destinationDir string) error {
480480
if err = writer.Close(); err != nil {
481481
return err
482482
}
483+
case tar.TypeSymlink:
484+
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
485+
return err
486+
}
487+
if err := os.Symlink(header.Linkname, path); err != nil {
488+
return fmt.Errorf("error creating symlink %s pointing to %s: %w", path, header.Linkname, err)
489+
}
490+
483491
default:
484492
return fmt.Errorf("unable to untar type=%c in file=%s", header.Typeflag, path)
485493
}
@@ -861,21 +869,21 @@ var parseVersionRegex = regexp.MustCompile(`(?m)^[^\d]*(?P<major>\d+)\.(?P<minor
861869

862870
// ParseVersion extracts the major, minor, and optional patch number from a
863871
// version string.
864-
func ParseVersion(version string) (major, minor, patch int, err error) {
872+
func ParseVersion(version string) (int, int, int, error) {
865873
names := parseVersionRegex.SubexpNames()
866874
matches := parseVersionRegex.FindStringSubmatch(version)
867875
if len(matches) == 0 {
868-
err = fmt.Errorf("failed to parse version '%v'", version)
869-
return
876+
err := fmt.Errorf("failed to parse version '%v'", version)
877+
return 0, 0, 0, err
870878
}
871879

872880
data := map[string]string{}
873881
for i, match := range matches {
874882
data[names[i]] = match
875883
}
876-
major, _ = strconv.Atoi(data["major"])
877-
minor, _ = strconv.Atoi(data["minor"])
878-
patch, _ = strconv.Atoi(data["patch"])
884+
major, _ := strconv.Atoi(data["major"])
885+
minor, _ := strconv.Atoi(data["minor"])
886+
patch, _ := strconv.Atoi(data["patch"])
879887
return major, minor, patch, nil
880888
}
881889

dev-tools/mage/copy.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"os"
1212
"path/filepath"
1313
"regexp"
14-
15-
"github.com/pkg/errors"
1614
)
1715

1816
// Copy copies a file or a directory (recursively) and preserves the permissions.
@@ -34,22 +32,25 @@ type CopyTask struct {
3432
// Execute executes the copy and returns an error of there is a failure.
3533
func (t *CopyTask) Execute() error {
3634
if err := t.init(); err != nil {
37-
return errors.Wrap(err, "copy failed")
35+
return fmt.Errorf("copy failed: %w", err)
3836
}
3937

4038
info, err := os.Stat(t.Source)
4139
if err != nil {
42-
return errors.Wrapf(err, "copy failed: cannot stat source file %v", t.Source)
40+
return fmt.Errorf("copy failed: cannot stat source file %v: %w", t.Source, err)
4341
}
4442

45-
return errors.Wrap(t.recursiveCopy(t.Source, t.Dest, fs.FileInfoToDirEntry(info)), "copy failed")
43+
if err := t.recursiveCopy(t.Source, t.Dest, fs.FileInfoToDirEntry(info)); err != nil {
44+
return fmt.Errorf("copy failed: %w", err)
45+
}
46+
return nil
4647
}
4748

4849
func (t *CopyTask) init() error {
4950
for _, excl := range t.Exclude {
5051
re, err := regexp.Compile(excl)
5152
if err != nil {
52-
return errors.Wrapf(err, "bad exclude pattern %v", excl)
53+
return fmt.Errorf("bad exclude pattern %v: %w", excl, err)
5354
}
5455
t.excludes = append(t.excludes, re)
5556
}
@@ -89,8 +90,7 @@ func (t *CopyTask) fileCopy(src, dest string, entry fs.DirEntry) error {
8990
}
9091

9192
if !info.Mode().IsRegular() {
92-
return errors.Errorf("failed to copy source file because it is not a " +
93-
"regular file")
93+
return fmt.Errorf("failed to copy source file because it is not a regular file")
9494
}
9595

9696
mode := t.Mode
@@ -126,19 +126,19 @@ func (t *CopyTask) dirCopy(src, dest string, entry fs.DirEntry) error {
126126
}
127127

128128
if err := os.MkdirAll(dest, mode&os.ModePerm); err != nil {
129-
return errors.Wrap(err, "failed creating dirs")
129+
return fmt.Errorf("failed creating dirs: %w", err)
130130
}
131131

132132
contents, err := os.ReadDir(src)
133133
if err != nil {
134-
return errors.Wrapf(err, "failed to read dir %v", src)
134+
return fmt.Errorf("failed to read dir %v: %w", src, err)
135135
}
136136

137137
for _, entry := range contents {
138-
srcFile := filepath.Join(src, info.Name())
139-
destFile := filepath.Join(dest, info.Name())
138+
srcFile := filepath.Join(src, entry.Name())
139+
destFile := filepath.Join(dest, entry.Name())
140140
if err = t.recursiveCopy(srcFile, destFile, entry); err != nil {
141-
return errors.Wrapf(err, "failed to copy %v to %v", srcFile, destFile)
141+
return fmt.Errorf("failed to copy %v to %v: %w", srcFile, destFile, err)
142142
}
143143
}
144144

0 commit comments

Comments
 (0)