Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into service-monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry committed Jun 13, 2024
2 parents f1d0e5a + 840676d commit 0346c58
Show file tree
Hide file tree
Showing 33 changed files with 710 additions and 223 deletions.
2 changes: 1 addition & 1 deletion .agent-versions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"testVersions": [
"8.14.1",
"8.14.1-SNAPSHOT",
"8.14.0",
"8.13.5-SNAPSHOT",
"8.13.4",
"7.17.22-SNAPSHOT",
Expand Down
48 changes: 48 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,51 @@ steps:
image: "family/core-ubuntu-2204"
env:
- GH_VERSION=2.4.0

# Trigger for pull requests
- label: "Trigger Integration tests for Pull request"
if: |
(build.pull_request.id != null && !build.env("GITHUB_PR_LABELS") =~ /skip-it/) ||
build.env("GITHUB_PR_TRIGGER_COMMENT") =~ /.*extended.*/
plugins:
- monorepo-diff#v1.0.1:
diff: "git diff --name-only origin/${GITHUB_PR_TARGET_BRANCH}...HEAD"
watch:
- path:
- internal/
- dev-tools/
- pkg/
- testing/
- version/
- specs/
- .agent-versions.json
- .go-version
- .package-version
- go.mod
- go.sum
- magefile.go
- main.go

- .buildkite/integration.pipeline.yml
- .buildkite/pipeline.yml
- .buildkite/scripts/
- .buildkite/hooks/

config:
trigger: "elastic-agent-extended-testing"
build:
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
env:
- BUILDKITE_PULL_REQUEST=${BUILDKITE_PULL_REQUEST}
- BUILDKITE_PULL_REQUEST_BASE_BRANCH=${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
- GITHUB_PR_LABELS=${GITHUB_PR_LABELS}

# Trigger for branches
- label: "Triggering Integration tests for branches"
if: build.pull_request.id == null
trigger: "elastic-agent-extended-testing"
build:
commit: "${BUILDKITE_COMMIT}"
branch: "${BUILDKITE_BRANCH}"
21 changes: 2 additions & 19 deletions .buildkite/pull-requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,13 @@
"set_commit_status": true,
"build_on_commit": true,
"build_on_comment": true,
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$",
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$",
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it|extended))|^/test\\W*(?:extended|)",
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it|extended))|^/test\\W*(?:extended|)",
"skip_ci_labels": [ "skip-ci" ],
"skip_target_branches": [ ],
"skip_ci_on_only_changed": [ "^.ci/", "^changelog", "^docs/", "\\.md$", "^docker-compose.yml", "^.pre-commit-config.yaml", "skaffold.yaml", "^Dockerfile.skaffold", "^Dockerfile"],
"always_require_ci_on_changed": [ ]
},
{
"enabled": true,
"build_drafts": false,
"pipelineSlug": "elastic-agent-extended-testing",
"allow_org_users": true,
"allowed_repo_permissions": ["admin", "write"],
"allowed_list": ["dependabot[bot]", "mergify[bot]", "github-actions[bot]"],
"set_commit_status": true,
"build_on_commit": true,
"build_on_comment": true,
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:extended))|^/test extended$",
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:extended))|^/test extended$",
"skip_ci_labels": [ "skip-ci", "skip-it" ],
"skip_target_branches": [ ],
"skip_ci_on_only_changed": [ "^.ci/", "^changelog", "^docs/", "\\.md$", "^sonar-project.properties", "^docker-compose.yml", "^.pre-commit-config.yaml", "skaffold.yaml", "^Dockerfile.skaffold", "^Dockerfile"],
"always_require_ci_on_changed": [ ]
},
{
"enabled": true,
"pipelineSlug": "elastic-agent-package",
Expand Down
64 changes: 32 additions & 32 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2220,6 +2220,36 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/go-licenser@v0.
limitations under the License.


--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-service
Version: v0.0.0-20240611154109-f44f756f194f
Licence type (autodetected): Zlib
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]/LICENSE:

Copyright (c) 2015 Daniel Theophanes

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.


--------------------------------------------------------------------------------
Dependency : github.com/elastic/go-sysinfo
Version: v1.14.0
Expand Down Expand Up @@ -3782,36 +3812,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


--------------------------------------------------------------------------------
Dependency : github.com/kardianos/service
Version: v1.2.1-0.20210728001519-a323c3813bc7
Licence type (autodetected): Zlib
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/kardianos/[email protected]/LICENSE:

Copyright (c) 2015 Daniel Theophanes

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source
distribution.


--------------------------------------------------------------------------------
Dependency : github.com/magefile/mage
Version: v1.15.0
Expand Down Expand Up @@ -16815,11 +16815,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected]

--------------------------------------------------------------------------------
Dependency : github.com/elastic/gosigar
Version: v0.14.2
Version: v0.14.3
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].2/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].3/LICENSE:

Apache License
Version 2.0, January 2004
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: Capture early errors on Windows in Application eventlog.

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

# 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/4627
34 changes: 34 additions & 0 deletions changelog/fragments/1718200496-Add-unprivileged-mode-support.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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 unprivileged mode support (beta)

# 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 new --unprivileged installation option. This option installs the Elastic Agent as a non-root or non-Administrator
user that has limited permissions on the host.
# 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
3 changes: 3 additions & 0 deletions changelog/fragments/1718268915-increase-remove-timeout.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: bug-fix
summary: Increase removal timeout when uninstall
component: "elastic-agent"
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/elastic/elastic-transport-go/v8 v8.6.0
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/elastic/go-licenser v0.4.1
github.com/elastic/go-service v0.0.0-20240611154109-f44f756f194f
github.com/elastic/go-sysinfo v1.14.0
github.com/elastic/go-ucfg v0.8.8
github.com/elastic/mock-es v0.0.0-20240605193845-b5546a703d6f
Expand All @@ -36,7 +37,6 @@ require (
github.com/jedib0t/go-pretty/v6 v6.4.6
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901
github.com/josephspurrier/goversioninfo v0.0.0-20190209210621-63e6d1acd3dd
github.com/kardianos/service v1.2.1-0.20210728001519-a323c3813bc7
github.com/magefile/mage v1.15.0
github.com/mitchellh/gox v1.0.1
github.com/mitchellh/hashstructure v1.1.0
Expand Down Expand Up @@ -134,7 +134,7 @@ require (
github.com/elastic/go-elasticsearch/v7 v7.17.10 // indirect
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/elastic/pkcs8 v1.0.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ github.com/elastic/go-elasticsearch/v8 v8.14.0/go.mod h1:WRvnlGkSuZyp83M2U8El/LG
github.com/elastic/go-licenser v0.3.1/go.mod h1:D8eNQk70FOCVBl3smCGQt/lv7meBeQno2eI1S5apiHQ=
github.com/elastic/go-licenser v0.4.1 h1:1xDURsc8pL5zYT9R29425J3vkHdt4RT5TNEMeRN48x4=
github.com/elastic/go-licenser v0.4.1/go.mod h1:V56wHMpmdURfibNBggaSBfqgPxyT1Tldns1i87iTEvU=
github.com/elastic/go-service v0.0.0-20240611154109-f44f756f194f h1:kMtsJ3zfcBBR6wfbf5yUExmvWLru6R7zSLaJIfSjU3g=
github.com/elastic/go-service v0.0.0-20240611154109-f44f756f194f/go.mod h1:3lVNFcuNMdWJrSpGF5SMPUVuC+qOYobfPIrMQUoizrk=
github.com/elastic/go-structform v0.0.10 h1:oy08o/Ih2hHTkNcRY/1HhaYvIp5z6t8si8gnCJPDo1w=
github.com/elastic/go-structform v0.0.10/go.mod h1:CZWf9aIRYY5SuKSmOhtXScE5uQiLZNqAFnwKR4OrIM4=
github.com/elastic/go-sysinfo v1.1.1/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
Expand All @@ -828,8 +830,8 @@ github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6
github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0=
github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
github.com/elastic/gojsonschema v1.2.1/go.mod h1:biw5eBS2Z4T02wjATMRSfecfjCmwaDPvuaqf844gLrg=
github.com/elastic/gosigar v0.14.2 h1:Dg80n8cr90OZ7x+bAax/QjoW/XqTI11RmA79ZwIm9/4=
github.com/elastic/gosigar v0.14.2/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/uo=
github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/elastic/mock-es v0.0.0-20240605193845-b5546a703d6f h1:qo0Nn9G+p7HbG+CmiWwSoiKJ/cyRq59TRn9Z2PRHTi8=
github.com/elastic/mock-es v0.0.0-20240605193845-b5546a703d6f/go.mod h1:mVdKBYYwt30xRFjCegbcURHh+3LWOCkQM33fgWbUiRI=
github.com/elastic/package-spec/v2 v2.6.0/go.mod h1:ks9/FaVOS+vCrGRQcDvXAd2FlmB84mrLikbRiO6ACuk=
Expand Down Expand Up @@ -1281,8 +1283,6 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
github.com/kardianos/service v1.2.1-0.20210728001519-a323c3813bc7 h1:oohm9Rk9JAxxmp2NLZa7Kebgz9h4+AJDcc64txg3dQ0=
github.com/kardianos/service v1.2.1-0.20210728001519-a323c3813bc7/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM=
github.com/karrick/godirwalk v1.15.6/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ type fakeAgentInfo struct {
snapshot bool
version string
unprivileged bool
isStandalone bool
}

func (a fakeAgentInfo) AgentID() string {
Expand Down Expand Up @@ -663,5 +664,9 @@ func (a fakeAgentInfo) Unprivileged() bool {
return a.unprivileged
}

func (a fakeAgentInfo) IsStandalone() bool {
return a.isStandalone
}

func (a fakeAgentInfo) ReloadID(ctx context.Context) error { panic("implement me") }
func (a fakeAgentInfo) SetLogLevel(ctx context.Context, level string) error { panic("implement me") }
4 changes: 4 additions & 0 deletions internal/pkg/agent/application/gateway/fleet/fleet_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ func (f *FleetGateway) execute(ctx context.Context) (*fleetapi.CheckinResponse,
// convert components into checkin components structure
components := f.convertToCheckinComponents(state.Components)

f.log.Debugf("correcting agent loglevel from %s to %s using coordinator state", ecsMeta.Elastic.Agent.LogLevel, state.LogLevel.String())
// Fix loglevel with the current log level used by coordinator
ecsMeta.Elastic.Agent.LogLevel = state.LogLevel.String()

// checkin
cmd := fleetapi.NewCheckinCmd(f.agentInfo, f.client)
req := &fleetapi.CheckinRequest{
Expand Down
Loading

0 comments on commit 0346c58

Please sign in to comment.