Skip to content

Commit 51090f2

Browse files
Merge remote-tracking branch 'upstream/main' into dependabot/go_modules/otel-dependencies-40b20a2a27
2 parents d6748cd + 0e34a69 commit 51090f2

File tree

3 files changed

+87
-25
lines changed

3 files changed

+87
-25
lines changed

.github/workflows/bump-agent-versions.yml

+43-22
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22
name: update-agent-versions
33

44
on:
5+
workflow_dispatch:
56
schedule:
67
- cron: "0 0 * * *"
78

89
jobs:
910
update_versions:
1011
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
1115
steps:
12-
- name: Setup Git
13-
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
14-
15-
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
16-
with:
17-
url: ${{ secrets.VAULT_ADDR }}
18-
roleId: ${{ secrets.VAULT_ROLE_ID }}
19-
secretId: ${{ secrets.VAULT_SECRET_ID }}
2016

2117
- name: Checkout
2218
uses: actions/checkout@v4
@@ -42,24 +38,49 @@ jobs:
4238
- name: Update versions
4339
id: update
4440
env:
45-
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4642
run: ./.github/workflows/bump-agent-versions.sh
4743

48-
- if: ${{ failure() }}
49-
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
44+
- if: ${{ failure() }}
45+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
5046
with:
51-
url: ${{ secrets.VAULT_ADDR }}
52-
roleId: ${{ secrets.VAULT_ROLE_ID }}
53-
secretId: ${{ secrets.VAULT_SECRET_ID }}
54-
message: ":traffic_cone: Elastic Agent version update failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
55-
channel: "#ingest-notifications"
47+
channel-id: '#ingest-notifications'
48+
payload: |
49+
{
50+
"text": "${{ env.SLACK_MESSAGE }}",
51+
"blocks": [
52+
{
53+
"type": "section",
54+
"text": {
55+
"type": "mrkdwn",
56+
"text": "${{ env.SLACK_MESSAGE }}"
57+
}
58+
}
59+
]
60+
}
61+
env:
62+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
63+
SLACK_MESSAGE: ":traffic_cone: Elastic Agent version update failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
5664

5765
# if a PR was created as a result of this job, we notify on the Slack channel
5866
- if: ${{ startsWith(steps.update.outputs.pr, 'https') }}
59-
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
67+
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
6068
with:
61-
url: ${{ secrets.VAULT_ADDR }}
62-
roleId: ${{ secrets.VAULT_ROLE_ID }}
63-
secretId: ${{ secrets.VAULT_SECRET_ID }}
64-
message: "Update for Elastic Agent versions has been created: ${{ steps.update.outputs.pr }}"
65-
channel: "#ingest-notifications"
69+
channel-id: '#ingest-notifications'
70+
payload: |
71+
{
72+
"text": "${{ env.SLACK_MESSAGE }}",
73+
"blocks": [
74+
{
75+
"type": "section",
76+
"text": {
77+
"type": "mrkdwn",
78+
"text": "${{ env.SLACK_MESSAGE }}"
79+
}
80+
}
81+
]
82+
}
83+
env:
84+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
85+
SLACK_MESSAGE: "Update for Elastic Agent versions has been created: ${{ steps.update.outputs.pr }}"
86+
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: Make delayed enrollment try indefinitely
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:
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/4727
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/4716

internal/pkg/agent/cmd/run.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,18 @@ func tryDelayEnroll(ctx context.Context, logger *logger.Logger, cfg *configurati
547547
if err != nil {
548548
return nil, err
549549
}
550-
err = c.Execute(ctx, cli.NewIOStreams())
551-
if err != nil {
552-
return nil, err
550+
// perform the enrollment in a loop, it should keep trying to enroll no matter what
551+
// the enrollCmd has built in backoff so no need to wrap this in its own backoff as well
552+
for {
553+
if ctx.Err() != nil {
554+
return nil, ctx.Err()
555+
}
556+
err = c.Execute(ctx, cli.NewIOStreams())
557+
if err == nil {
558+
// enrollment was successful
559+
break
560+
}
561+
logger.Error(fmt.Errorf("failed to perform delayed enrollment (will try again): %w", err))
553562
}
554563
err = os.Remove(enrollPath)
555564
if err != nil {

0 commit comments

Comments
 (0)