Skip to content

Commit ad20032

Browse files
authored
GH action for updating logstash version (#18035)
* GH action for updating logstash version This commit adds a GH action for bumping the logstash version. It uses the updatescli based on a suggestion for how the beats team is doing file updates. There is a workflow_dispatch trigger that accepts a new logstash version. Both the versions.yml and lock file are updated. If it is a branch where we are not vendoring a lockfile that file is skipped without failing the workflow step. * use stub workflow to test * Separate step when modifying * dont track temp updatecli file and install action * restore stub * Refactor updatecli workflow use pattern suggested in code review * Use test stub to validate changes * fix inputs section * fix branch * dont fail if file is not present * try with no global conditionals * file condition * name conditional * split into separate pipeline files * remove unused scmid * no explicit pr action? * add back PR * try sources pattern * explicitly connect target with scmid * ensure lock file lookup executes from checkout * Cleanup * test * restore LOGSTASH_BRANCH * codereview feedback
1 parent 132f917 commit ad20032

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: Update logstash version files
3+
pipelineid: "logstash/version-updates-{{ requiredEnv "LOGSTASH_BRANCH" }}"
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 "LOGSTASH_BRANCH" }}'
15+
commitusingapi: true
16+
force: false
17+
18+
actions:
19+
default:
20+
title: 'Bump logstash version {{ requiredEnv "LOGSTASH_VERSION" }}'
21+
kind: github/pullrequest
22+
scmid: default
23+
spec:
24+
automerge: false
25+
labels:
26+
- automation
27+
description: |-
28+
### What
29+
Update logstash version
30+
31+
sources:
32+
lock_file_exists:
33+
kind: shell
34+
scmid: default
35+
spec:
36+
command: test -f Gemfile.jruby-3.1.lock.release
37+
38+
targets:
39+
update_logstash_version:
40+
name: Update logstash version in versions.yml
41+
kind: yaml
42+
disablesourceinput: true
43+
scmid: default
44+
spec:
45+
file: versions.yml
46+
key: $.logstash
47+
value: '{{ requiredEnv "LOGSTASH_VERSION" }}'
48+
49+
update_logstash_core_version:
50+
name: Update logstash-core version in versions.yml
51+
kind: yaml
52+
disablesourceinput: true
53+
scmid: default
54+
spec:
55+
file: versions.yml
56+
key: $.logstash-core
57+
value: '{{ requiredEnv "LOGSTASH_VERSION" }}'
58+
59+
update_gemfile_lock_dependency:
60+
name: Update logstash-core dependency in lockfile
61+
kind: file
62+
disablesourceinput: true
63+
scmid: default
64+
dependson:
65+
- 'source#lock_file_exists'
66+
spec:
67+
file: Gemfile.jruby-3.1.lock.release
68+
matchpattern: 'logstash-core \(= [0-9]+\.[0-9]+\.[0-9]+'
69+
replacepattern: 'logstash-core (= {{ requiredEnv "LOGSTASH_VERSION" }}'
70+
71+
update_gemfile_lock_spec:
72+
name: Update logstash-core spec in lockfile
73+
kind: file
74+
disablesourceinput: true
75+
scmid: default
76+
dependson:
77+
- 'source#lock_file_exists'
78+
spec:
79+
file: Gemfile.jruby-3.1.lock.release
80+
matchpattern: 'logstash-core \([0-9]+\.[0-9]+\.[0-9]+-java\)'
81+
replacepattern: 'logstash-core ({{ requiredEnv "LOGSTASH_VERSION" }}-java)'

.ci/updatecli/values.d/scm.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scm:
2+
owner: elastic
3+
repository: logstash
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: bump-logstash-version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
logstash_version:
7+
description: 'Logstash version (example: 9.1.4)'
8+
required: true
9+
type: string
10+
logstash_branch:
11+
description: 'Logstash branch (example: 9.1)'
12+
required: true
13+
type: string
14+
15+
jobs:
16+
bump:
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v5
23+
24+
- uses: elastic/oblt-actions/updatecli/run@v1
25+
with:
26+
command: apply --config .ci/updatecli/bump-logstash-version.yml --values .ci/updatecli/values.d/scm.yml
27+
version-file: .updatecli-version
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
LOGSTASH_BRANCH: "${{ github.event.inputs.logstash_branch }}"
31+
LOGSTASH_VERSION: "${{ github.event.inputs.logstash_version }}"

.updatecli-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.104.0

0 commit comments

Comments
 (0)