Skip to content

Commit 25dc0d2

Browse files
committed
Merge branch 'main' into feature/support-updatecli-for-pin-vm-images
* main: chore: Update to elastic/beats@c51fee3a852e (#8246) chore: Update to elastic/beats@82f47f73acbd (#8239) Fix minor typo in beats update job (#8233) fix(diagnostics): handle log rotation races (#8215) Fix some minor issues with the beats version update job (#8224) [main][Automation] Update elastic/beats to 9382cc20546b (#8222) Automatically update beats module versions (#8174) chore: deps(ironbank): Bump ubi version to 9.6 (#8218)
2 parents 2ead76b + 5c6b6d4 commit 25dc0d2

File tree

13 files changed

+1220
-112
lines changed

13 files changed

+1220
-112
lines changed

.ci/scripts/update-beats.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script is executed by the automation we are putting in place
4+
# and it requires the git add/commit commands.
5+
#
6+
set -euo pipefail
7+
TARGET_VERSION="${1:?Error: Please provide the target version to update to}"
8+
9+
echo "~~~ Updating to elastic/beats@${TARGET_VERSION}"
10+
mage update:beats "${TARGET_VERSION}"

.ci/updatecli/update-beats.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: Bump beats
3+
pipelineid: 'updatecli-update-beats-{{ requiredEnv "BRANCH_NAME" }}'
4+
5+
scms:
6+
default:
7+
kind: github
8+
spec:
9+
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
10+
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
11+
owner: '{{ .scm.owner }}'
12+
repository: '{{ .scm.repository }}'
13+
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
14+
branch: '{{ requiredEnv "BRANCH_NAME" }}'
15+
commitusingapi: true
16+
17+
actions:
18+
default:
19+
title: '[{{ requiredEnv "BRANCH_NAME" }}][Automation] Update elastic/beats to {{ source "beats" }}'
20+
kind: github/pullrequest
21+
scmid: default
22+
spec:
23+
automerge: false
24+
labels:
25+
- automation
26+
- skip-changelog
27+
- "Team:Elastic-Agent-Control-Plane"
28+
description: |-
29+
### What
30+
Update `elastic/beats` to the latest version on branch `{{ requiredEnv "BRANCH_NAME" }}`.
31+
32+
*Changeset*
33+
* https://github.com/elastic/beats/compare/{{ source "gomod" }}...{{ source "beats" }}
34+
35+
sources:
36+
beats:
37+
kind: json
38+
spec:
39+
file: 'https://api.github.com/repos/elastic/beats/commits?sha={{ requiredEnv "BRANCH_NAME" }}&per_page=1'
40+
key: '.[0].sha'
41+
transformers:
42+
# substring 12 chars so it works for the condition
43+
- findsubmatch:
44+
pattern: ^(.{12}).*
45+
captureindex: 1
46+
gomod:
47+
kind: golang/gomod
48+
spec:
49+
module: github.com/elastic/beats/v7
50+
transformers:
51+
# the commit hash is the last 12 chars
52+
- findsubmatch:
53+
pattern: .*(.{12})$
54+
captureindex: 1
55+
56+
57+
conditions:
58+
is-already-updated:
59+
name: Is version 'github.com/elastic/beats@{{ source "beats" }}' not updated in 'go.mod'?
60+
kind: shell
61+
disablesourceinput: true
62+
scmid: default
63+
spec:
64+
command: '[ {{ source "beats" }} != {{ source "gomod" }} ]'
65+
failwhen: false
66+
67+
targets:
68+
beats:
69+
name: 'Update to elastic/beats@{{ source "beats" }}'
70+
sourceid: beats
71+
scmid: default
72+
kind: shell
73+
spec:
74+
command: .ci/scripts/update-beats.sh
75+
environments:
76+
- name: PATH
77+
- name: HOME
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: update-beats
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * 1-5'
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
13+
14+
jobs:
15+
filter:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 1
18+
outputs:
19+
matrix: ${{ steps.generator.outputs.matrix }}
20+
permissions:
21+
contents: read
22+
steps:
23+
- id: generator
24+
uses: elastic/oblt-actions/elastic/active-branches@v1
25+
with:
26+
exclude-branches: "7.17,8.17,8.18,9.0"
27+
filter-branches: true
28+
29+
update-beats:
30+
permissions:
31+
contents: write
32+
pull-requests: write
33+
needs:
34+
- filter
35+
runs-on: ubuntu-latest
36+
strategy:
37+
fail-fast: false
38+
matrix: ${{ fromJson(needs.filter.outputs.matrix) }}
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
ref: ${{ matrix.branch }}
43+
44+
- name: Set up Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version-file: 'go.mod'
48+
49+
- name: Install mage
50+
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
51+
with:
52+
version: v1.13.0
53+
install-only: true
54+
55+
- name: Run Updatecli in Apply mode
56+
uses: elastic/oblt-actions/updatecli/run@v1
57+
with:
58+
command: apply --config .ci/updatecli/update-beats.yml --values .ci/updatecli/values.d/scm.yml
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
BRANCH_NAME: ${{ matrix.branch }}
62+
63+
- if: ${{ failure() }}
64+
uses: elastic/oblt-actions/slack/send@v1
65+
with:
66+
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
67+
channel-id: "#ingest-notifications"
68+
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, `@agent-team` please look what's going on <${{ env.JOB_URL }}|here>"

0 commit comments

Comments
 (0)