Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/elastic/go-…
Browse files Browse the repository at this point in the history
…elasticsearch/v8-8.11.0
  • Loading branch information
pierrehilbert authored Jan 23, 2024
2 parents 0a4ef9e + c588a73 commit ea84fc9
Show file tree
Hide file tree
Showing 103 changed files with 2,636 additions and 1,309 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ steps:
matrix:
setup:
k8s_version:
- "1.29.0"
- "1.28.0"
- "1.27.3"
- "1.26.6"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
name: "Flaky Test"
about: "Report a flaky test (one that doesn't pass consistently)"
description: "Report a flaky test (one that doesn't pass consistently)"
title: "[Flaky Test]: <test_case> – <short_error_message>"
labels: ["Team:Elastic-Agent", "flaky-test"]
projects: ["elastic/1457"]
projects: ["elastic/979", "elastic/1457"]
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -37,19 +36,18 @@ body:
attributes:
label: OS
description: "On which OS the test is failing"
multiple: true
options:
- Linux
- Mac
- Windows
default: 0
multiple: true
options:
- Linux
- Mac
- Windows
default: 0
validations:
required: true
- type: textarea
attributes:
label: "Stacktrace and notes"
description: "Detailed output of the test failure and your notes about possible cause."
render: markdown
render: markdown
validations:
required: true
---
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ fleet.yml.lock
fleet.yml.old
pkg/component/fake/component/component
pkg/component/fake/shipper/shipper
internal/pkg/agent/install/testblocking/testblocking
1,326 changes: 956 additions & 370 deletions NOTICE.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: bug-fix

# Change summary; a 80ish characters long description of the change.
summary: Fix component control protocol to allow checkin to be chunked across multiple messages

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

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

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

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
issue: https://github.com/elastic/elastic-agent/issues/2460
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: feature

# Change summary; a 80ish characters long description of the change.
summary: Add mTLS flags to install/enroll

# Long description; in case the summary is not enough to describe the change
# this field accommodate a description without length limits.
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment.
description: |
Add mTLS flags to the install/enroll commands to allow fleet-server to
use client certs when connecting to Elasticsearch, and to allow
elastic-agent to use client certs when connecting to fleet-server.
Fleet-server will use the CAs passed in `--certificate-authorities` to
validate any client certs. Agent client certs do not influence auth in
fleet-server, an enrollment token, or API key is still required.
# Affected component; a word indicating the component this changeset affects.
component:

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

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
#issue: https://github.com/owner/repo/1234
32 changes: 32 additions & 0 deletions changelog/fragments/1704994055-add-error-statements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: enhancement

# Change summary; a 80ish characters long description of the change.
summary: add error descriptors to inspect command, config methods

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

# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
component: config

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

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
#issue: https://github.com/owner/repo/1234
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Kind can be one of:
# - breaking-change: a change to previously-documented behavior
# - deprecation: functionality that is being removed in a later release
# - bug-fix: fixes a problem in a previous version
# - enhancement: extends functionality but does not break or fix existing behavior
# - feature: new functionality
# - known-issue: problems that we are aware of in a given version
# - security: impacts on the security of a product or a user’s deployment.
# - upgrade: important information for someone upgrading from a prior version
# - other: does not fit into any of the other categories
kind: feature

# Change summary; a 80ish characters long description of the change.
summary: fix creation of directories when unpacking tar.gz packages

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

# Affected component; a word indicating the component this changeset affects.
component: elastic-agent

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

# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
# If not present is automatically filled by the tooling with the issue linked to the PR number.
#issue: https://github.com/owner/repo/1234
3 changes: 1 addition & 2 deletions control_v2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ message ComponentUnitState {
message ComponentVersionInfo {
// Name of the component.
string name = 1;
// Version of the component.
string version = 2;
// 2 reserved - used to be used for version of component.
// Extra meta information about the version.
map<string, string> meta = 3;
}
Expand Down
3 changes: 1 addition & 2 deletions dev-tools/cmd/buildfleetcfg/buildfleetcfg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions dev-tools/licenses/license_generate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions dev-tools/mage/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -118,7 +117,7 @@ func joinMaps(args ...map[string]interface{}) map[string]interface{} {
}

func expandFile(src, dst string, args ...map[string]interface{}) error {
tmplData, err := ioutil.ReadFile(src)
tmplData, err := os.ReadFile(src)
if err != nil {
return fmt.Errorf("failed reading from template %v, %w", src, err)
}
Expand All @@ -133,7 +132,7 @@ func expandFile(src, dst string, args ...map[string]interface{}) error {
return err
}

if err = ioutil.WriteFile(createDir(dst), []byte(output), 0644); err != nil {
if err = os.WriteFile(createDir(dst), []byte(output), 0644); err != nil {
return fmt.Errorf("failed to write rendered template: %w", err)
}

Expand Down Expand Up @@ -236,13 +235,13 @@ func FindReplace(file string, re *regexp.Regexp, repl string) error {
return err
}

contents, err := ioutil.ReadFile(file)
contents, err := os.ReadFile(file)
if err != nil {
return err
}

out := re.ReplaceAllString(string(contents), repl)
return ioutil.WriteFile(file, []byte(out), info.Mode().Perm())
return os.WriteFile(file, []byte(out), info.Mode().Perm())
}

// MustFindReplace invokes FindReplace and panics if an error occurs.
Expand Down
3 changes: 1 addition & 2 deletions dev-tools/mage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package mage
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -159,7 +158,7 @@ func makeConfigTemplate(destination string, mode os.FileMode, confParams ConfigF
}
}

data, err := ioutil.ReadFile(confFile.Template)
data, err := os.ReadFile(confFile.Template)
if err != nil {
return errors.Wrapf(err, "failed to read config template %q", confFile.Template)
}
Expand Down
34 changes: 23 additions & 11 deletions dev-tools/mage/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
package mage

import (
"fmt"
"io"
"io/ioutil"
"io/fs"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -41,7 +42,7 @@ func (t *CopyTask) Execute() error {
return errors.Wrapf(err, "copy failed: cannot stat source file %v", t.Source)
}

return errors.Wrap(t.recursiveCopy(t.Source, t.Dest, info), "copy failed")
return errors.Wrap(t.recursiveCopy(t.Source, t.Dest, fs.FileInfoToDirEntry(info)), "copy failed")
}

func (t *CopyTask) init() error {
Expand All @@ -64,14 +65,14 @@ func (t *CopyTask) isExcluded(src string) bool {
return false
}

func (t *CopyTask) recursiveCopy(src, dest string, info os.FileInfo) error {
if info.IsDir() {
return t.dirCopy(src, dest, info)
func (t *CopyTask) recursiveCopy(src, dest string, entry fs.DirEntry) error {
if entry.IsDir() {
return t.dirCopy(src, dest, entry)
}
return t.fileCopy(src, dest, info)
return t.fileCopy(src, dest, entry)
}

func (t *CopyTask) fileCopy(src, dest string, info os.FileInfo) error {
func (t *CopyTask) fileCopy(src, dest string, entry fs.DirEntry) error {
if t.isExcluded(src) {
return nil
}
Expand All @@ -82,6 +83,11 @@ func (t *CopyTask) fileCopy(src, dest string, info os.FileInfo) error {
}
defer srcFile.Close()

info, err := entry.Info()
if err != nil {
return fmt.Errorf("converting dir entry: %w", err)
}

if !info.Mode().IsRegular() {
return errors.Errorf("failed to copy source file because it is not a " +
"regular file")
Expand All @@ -104,28 +110,34 @@ func (t *CopyTask) fileCopy(src, dest string, info os.FileInfo) error {
return destFile.Close()
}

func (t *CopyTask) dirCopy(src, dest string, info os.FileInfo) error {
func (t *CopyTask) dirCopy(src, dest string, entry fs.DirEntry) error {
if t.isExcluded(src) {
return nil
}

info, err := entry.Info()
if err != nil {
return fmt.Errorf("converting dir entry: %w", err)
}

mode := t.DirMode
if mode == 0 {
mode = info.Mode()
}

if err := os.MkdirAll(dest, mode&os.ModePerm); err != nil {
return errors.Wrap(err, "failed creating dirs")
}

contents, err := ioutil.ReadDir(src)
contents, err := os.ReadDir(src)
if err != nil {
return errors.Wrapf(err, "failed to read dir %v", src)
}

for _, info := range contents {
for _, entry := range contents {
srcFile := filepath.Join(src, info.Name())
destFile := filepath.Join(dest, info.Name())
if err = t.recursiveCopy(srcFile, destFile, info); err != nil {
if err = t.recursiveCopy(srcFile, destFile, entry); err != nil {
return errors.Wrapf(err, "failed to copy %v to %v", srcFile, destFile)
}
}
Expand Down
Loading

0 comments on commit ea84fc9

Please sign in to comment.