Skip to content

Commit edd46bd

Browse files
authored
Merge branch 'main' into fix/error-types
2 parents 234e5ff + d4dcd54 commit edd46bd

File tree

5 files changed

+76
-17
lines changed

5 files changed

+76
-17
lines changed

.buildkite/pipeline.elastic-agent-binary-dra.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ steps:
138138
PLATFORMS: "linux/amd64"
139139
FIPS: "true"
140140

141-
- label: ":package: linux/arm64 darwin/arm64 Elastic-Agent Core staging"
141+
- label: ":package: linux/arm64 darwin/arm64 windows/arm64 Elastic-Agent Core staging"
142142
commands: |
143143
source .buildkite/scripts/version_qualifier.sh
144144
.buildkite/scripts/steps/build-agent-core.sh
@@ -151,7 +151,7 @@ steps:
151151
imagePrefix: "core-ubuntu-2204-aarch64"
152152
env:
153153
DRA_WORKFLOW: "dra-core-staging"
154-
PLATFORMS: "linux/arm64 darwin/arm64"
154+
PLATFORMS: "linux/arm64 darwin/arm64 windows/arm64"
155155

156156
- label: ":package: linux/arm64 FIPS Elastic-Agent Core staging"
157157
commands: |
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# REQUIRED
2+
# Kind can be one of:
3+
# - breaking-change: a change to previously-documented behavior
4+
# - deprecation: functionality that is being removed in a later release
5+
# - bug-fix: fixes a problem in a previous version
6+
# - enhancement: extends functionality but does not break or fix existing behavior
7+
# - feature: new functionality
8+
# - known-issue: problems that we are aware of in a given version
9+
# - security: impacts on the security of a product or a user’s deployment.
10+
# - upgrade: important information for someone upgrading from a prior version
11+
# - other: does not fit into any of the other categories
12+
kind: bug-fix
13+
14+
# REQUIRED for all kinds
15+
# Change summary; a 80ish characters long description of the change.
16+
summary: "inspect: Handle components with slashes in their name"
17+
18+
# REQUIRED for breaking-change, deprecation, known-issue
19+
# Long description; in case the summary is not enough to describe the change
20+
# this field accommodate a description without length limits.
21+
# description:
22+
23+
# REQUIRED for breaking-change, deprecation, known-issue
24+
# impact:
25+
26+
# REQUIRED for breaking-change, deprecation, known-issue
27+
# action:
28+
29+
# REQUIRED for all kinds
30+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
31+
component: elastic-agent
32+
33+
# AUTOMATED
34+
# OPTIONAL to manually add other PR URLs
35+
# PR URL: A link the PR that added the changeset.
36+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
37+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
38+
# Please provide it if you are adding a fragment for a different PR.
39+
# pr: https://github.com/owner/repo/1234
40+
41+
# AUTOMATED
42+
# OPTIONAL to manually add other issue URLs
43+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
44+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
45+
# issue: https://github.com/owner/repo/1234

internal/pkg/agent/cmd/inspect.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -318,24 +318,30 @@ func inspectComponents(ctx context.Context, cfgPath string, opts inspectComponen
318318

319319
// ID provided.
320320
if opts.id != "" {
321-
splitID := strings.SplitN(opts.id, "/", 2)
322-
compID := splitID[0]
323-
unitID := ""
324-
if len(splitID) > 1 {
325-
unitID = splitID[1]
326-
}
321+
// Interpret the ID as either a component or component/unit.
322+
// First try to find a component with the full ID.
323+
compID := opts.id
327324
comp, ok := findComponent(comps, compID)
328325
if ok {
329-
if unitID != "" {
330-
unit, ok := findUnit(comp, unitID)
331-
if ok {
332-
return printUnit(unit, streams)
333-
}
334-
return fmt.Errorf("unable to find unit with ID: %s/%s", compID, unitID)
335-
}
336326
return printComponent(comp, streams)
337327
}
338-
return fmt.Errorf("unable to find component with ID: %s", compID)
328+
329+
// Next try to split the ID and find a unit inside a component.
330+
splitID := strings.SplitN(opts.id, "/", 2)
331+
if len(splitID) > 1 {
332+
compID = splitID[0]
333+
comp, ok = findComponent(comps, compID)
334+
}
335+
if !ok {
336+
return fmt.Errorf("unable to find component with ID: %s", compID)
337+
}
338+
339+
unitID := splitID[1]
340+
unit, ok := findUnit(comp, unitID)
341+
if !ok {
342+
return fmt.Errorf("unable to find unit with ID: %s/%s", compID, unitID)
343+
}
344+
return printUnit(unit, streams)
339345
}
340346

341347
// Separate any components that are blocked by capabilities config

testing/integration/ess/inspect_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,13 @@ func TestInspect(t *testing.T) {
100100
assert.Equalf(t, "<REDACTED>", yObj.Inputs[0].CustomAttr, "inspect output: %s", p)
101101
assert.Equalf(t, "<REDACTED>", yObj.Agent.Protection.SigningKey, "`signing_key` is not redacted but it should be, because it contains `key`. inspect output: %s", p)
102102
assert.Equalf(t, "<REDACTED>", yObj.Agent.Protection.UninstallTokenHash, "`uninstall_token_hash` is not redacted but it should be, because it contains `token`. inspect output: %s", p)
103+
104+
p, err = fixture.Exec(ctx, []string{"inspect", "components", "beat/metrics-monitoring"})
105+
require.NoErrorf(t, err, "Error when running inspect components, output: %s", p)
106+
var yamlComponent struct {
107+
InputType string `yaml:"input_type"`
108+
}
109+
err = yaml.Unmarshal(p, &yamlComponent)
110+
require.NoError(t, err)
111+
assert.Equal(t, "beat/metrics", yamlComponent.InputType)
103112
}

testing/integration/serverless/logs_ingestion_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ func TestLogIngestionFleetManaged(t *testing.T) {
2020
Local: false,
2121
Sudo: true,
2222
})
23-
t.Skip("Skip serverless tests until we can enroll an agent with 9.3.0-SNAPSHOT.")
2423
integration.LogIngestionFleetManaged(t, info)
2524
}

0 commit comments

Comments
 (0)