Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/github.com/elastic/ela…
Browse files Browse the repository at this point in the history
…stic-agent-autodiscover-0.9.0
  • Loading branch information
michel-laterman authored Oct 4, 2024
2 parents a311b85 + 3072cc5 commit 3d77e03
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ linters-settings:

gosimple:
# Select the Go version to target. The default is '1.13'.
go: "1.22.7"
go: "1.22.8"

nolintlint:
# Enable to ensure that nolint directives are all used. Default is true.
Expand All @@ -138,17 +138,17 @@ linters-settings:

staticcheck:
# Select the Go version to target. The default is '1.13'.
go: "1.22.7"
go: "1.22.8"
checks: ["all"]

stylecheck:
# Select the Go version to target. The default is '1.13'.
go: "1.22.7"
go: "1.22.8"
checks: ["all"]

unused:
# Select the Go version to target. The default is '1.13'.
go: "1.22.7"
go: "1.22.8"

gosec:
excludes:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GO_VERSION=1.22.7
ARG GO_VERSION=1.22.8
FROM circleci/golang:${GO_VERSION}


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.skaffold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GO_VERSION=1.22.7
ARG GO_VERSION=1.22.8
ARG crossbuild_image="docker.elastic.co/beats-dev/golang-crossbuild"
ARG AGENT_VERSION=8.9.0-SNAPSHOT
ARG AGENT_IMAGE="docker.elastic.co/beats/elastic-agent"
Expand Down
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: Update Ubuntu base image from 20.04 to 24.04

# 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: 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
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: Stop elastic-agent inspect from printing output twice

# 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: 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/elastic/elastic-agent/pull/5692

# 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/4471
4 changes: 2 additions & 2 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,11 @@ shared:
- &docker_ubuntu_spec
docker_variant: 'basic'
extra_vars:
from: '--platform=linux/amd64 ubuntu:20.04'
from: '--platform=linux/amd64 ubuntu:24.04'
- &docker_ubuntu_arm_spec
docker_variant: 'basic'
extra_vars:
from: '--platform=linux/arm64 ubuntu:20.04'
from: '--platform=linux/arm64 ubuntu:24.04'

- &docker_ubi_spec
docker_variant: 'ubi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ RUN for iter in {1..10}; do microdnf update -y && microdnf install -y tar gzip f
{{- end }}

{{- if contains .from "ubuntu" }}
# Delete the existing "ubuntu" user to prevent conflict with the user that is added later.
# See https://bugs.launchpad.net/cloud-images/+bug/2005129/comments/2.
RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu
RUN for iter in {1..10}; do \
apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --yes ca-certificates curl gawk xz-utils && \
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/agent/cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func inspectConfig(ctx context.Context, cfgPath string, opts inspectConfigOpts,
if err != nil {
return fmt.Errorf("error printing config: %w", err)
}
return nil
}

cfg, lvl, err := getConfigWithVariables(ctx, l, cfgPath, opts.variablesWait, !isAdmin)
Expand Down
4 changes: 1 addition & 3 deletions pkg/testing/fixture_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,7 @@ func (f *Fixture) installNoPkgManager(ctx context.Context, installOpts *InstallO
f.setClient(c)

f.t.Cleanup(func() {
if f.t.Failed() {
f.DumpProcesses("-cleanup")
}
f.DumpProcesses("-post-uninstall")
})

f.t.Cleanup(func() {
Expand Down
17 changes: 13 additions & 4 deletions testing/fleetservertest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"net/http"
"strconv"
"sync"
"sync/atomic"

"github.com/gofrs/uuid/v5"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -121,13 +122,18 @@ func NewRouter(handlers *Handlers) *mux.Router {

ww := &statusResponseWriter{w: w}

requestID := uuid.Must(uuid.NewV4()).String()
requestID := r.Header.Get("X-Request-Id")
if requestID == "" {
requestID = uuid.Must(uuid.NewV4()).String()
}
ww.Header().Set("X-Request-Id", requestID)

handlers.logFn("[%s] STARTING - %s %s %s %s\n",
requestID, r.Method, r.URL, r.Proto, r.RemoteAddr)
route.Handler.
ServeHTTP(ww, r)
handlers.logFn("[%s] DONE %d - %s %s %s %s\n",
requestID, ww.statusCode, r.Method, r.URL, r.Proto, r.RemoteAddr)
handlers.logFn("[%s] DONE %d - %s %s %s %s %d\n",
requestID, ww.statusCode, r.Method, r.URL, r.Proto, r.RemoteAddr, ww.byteCount.Load())
}))
}

Expand Down Expand Up @@ -499,14 +505,17 @@ func updateLocalMetaAgentID(data []byte, agentID string) ([]byte, error) {
type statusResponseWriter struct {
w http.ResponseWriter
statusCode int
byteCount atomic.Uint64
}

func (s *statusResponseWriter) Header() http.Header {
return s.w.Header()
}

func (s *statusResponseWriter) Write(bs []byte) (int, error) {
return s.w.Write(bs)
n, err := s.w.Write(bs)
s.byteCount.Add(uint64(n))
return n, err
}

func (s *statusResponseWriter) WriteHeader(statusCode int) {
Expand Down
4 changes: 4 additions & 0 deletions testing/integration/proxy_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ func TestProxyURL(t *testing.T) {

// Specific testcase setup and map of created proxies
proxies, args := tt.setup(t, mockFleet)
t.Logf("Fleet-server port: %s", mockFleet.fleetServer.Port)

fixture, err := define.NewFixtureFromLocalBuild(t,
define.Version(),
Expand Down Expand Up @@ -732,6 +733,9 @@ func TestProxyURL(t *testing.T) {
Key: args.key,
}})
t.Logf("elastic-agent install output: \n%s\n", string(out))
for proxyName, proxy := range proxies {
t.Logf("Proxy %s requests: %v", proxyName, proxy.ProxiedRequests())
}
if tt.wantErr(t, err, "elastic-agent install returned an unexpected error") {
tt.assertFunc(ctx, t, fixture, proxies, mockFleet)
}
Expand Down
2 changes: 1 addition & 1 deletion version/docs/version.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// FIXME: once elastic.co docs have been switched over to use `main`, remove
// the `doc-site-branch` line below as well as any references to it in the code.
:doc-site-branch: master
:go-version: 1.22.7
:go-version: 1.22.8
:release-state: unreleased
:python: 3.7
:docker: 1.12
Expand Down

0 comments on commit 3d77e03

Please sign in to comment.