Skip to content

Conversation

@donoghuc
Copy link
Member

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.

Implements https://github.com/elastic/ingest-dev/issues/5977

@github-actions
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@mergify
Copy link
Contributor

mergify bot commented Aug 25, 2025

This pull request does not have a backport label. Could you fix it @donoghuc? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit.
  • If no backport is necessary, please add the backport-skip label

@donoghuc
Copy link
Member Author

Use of updatecli for dep bumps was based on this comment #17945 (comment)

@donoghuc
Copy link
Member Author

To test locally:

install updatecli

brew install updatecli/updatecli/updatecli

generate config file:

# Create the same config the GitHub Action uses
cat > test-updatecli.yml << 'EOF'
name: Update versions.yml

sources:
  logstash_version:
    kind: shell
    spec:
      command: echo "9.3.0"

targets:
  update_logstash_version:
    name: Update logstash version in versions.yml
    kind: yaml
    spec:
      file: versions.yml
      key: $.logstash
    sourceid: logstash_version
  
  update_logstash_core_version:
    name: Update logstash-core version in versions.yml
    kind: yaml
    spec:
      file: versions.yml
      key: $.logstash-core
    sourceid: logstash_version

---
name: Update lock file

sources:
  logstash_version:
    kind: shell
    spec:
      command: echo "9.3.0"

conditions:
  check_lockfile_exists:
    name: Check if lockfile exists
    kind: shell
    disablesourceinput: true
    spec:
      command: test -f Gemfile.jruby-3.1.lock.release

targets:
  update_gemfile_lock_dependency:
    name: Update logstash-core dependency
    kind: file
    spec:
      file: Gemfile.jruby-3.1.lock.release
      matchpattern: 'logstash-core \(= [0-9]+\.[0-9]+\.[0-9]+'
      replacepattern: 'logstash-core (= 9.3.0'
    sourceid: logstash_version
  
  update_gemfile_lock_spec:
    name: Update logstash-core spec
    kind: file
    spec:
      file: Gemfile.jruby-3.1.lock.release
      matchpattern: 'logstash-core \([0-9]+\.[0-9]+\.[0-9]+-java\)'
      replacepattern: 'logstash-core (9.3.0-java)'
    sourceid: logstash_version
EOF

run

➜  logstash git:(bump-ls-version-action) ✗ updatecli apply --config test-updatecli.yml



+++++++++++
+ PREPARE +
+++++++++++

Loading Pipeline "test-updatecli.yml"

SCM repository retrieved: 0


++++++++++++++++++
+ AUTO DISCOVERY +
++++++++++++++++++



++++++++++++
+ PIPELINE +
++++++++++++



#######################
# UPDATE VERSIONS.YML #
#######################

source: source#logstash_version
-----------------------
The shell 🐚 command "/bin/sh /var/folders/cw/q_xjr4md1wj_w_c1xwfrnxdw0000gn/T/updatecli/bin/33b3af0384bd90f14aef112598cfabdf6d6e77168b475723abbaaf5f269b28f2.sh" ran successfully with the following output:
----
9.3.0
----
✔ shell command executed successfully

target: target#update_logstash_core_version
-----------------------------------
⚠ - change detected:
	* key "$.logstash-core" updated from "9.2.0" to "9.3.0", in file "versions.yml"

target: target#update_logstash_version
------------------------------
⚠ - change detected:
	* key "$.logstash" updated from "9.2.0" to "9.3.0", in file "versions.yml"


####################
# UPDATE LOCK FILE #
####################

source: source#logstash_version
-----------------------
The shell 🐚 command "/bin/sh /var/folders/cw/q_xjr4md1wj_w_c1xwfrnxdw0000gn/T/updatecli/bin/33b3af0384bd90f14aef112598cfabdf6d6e77168b475723abbaaf5f269b28f2.sh" ran successfully with the following output:
----
9.3.0
----
✔ shell command executed successfully

condition: condition#check_lockfile_exists
-------------------------------
The shell 🐚 command "/bin/sh /var/folders/cw/q_xjr4md1wj_w_c1xwfrnxdw0000gn/T/updatecli/bin/c4efa96ffd6665bfcc18724aff4523a9b7e976d0a59d6da437e1263a76b5f8c6.sh" exited on error (exit code 1) with the following output:
----
----

command stderr output was:
----
----
shell command failed. Expected exit code 0 but got 1
✗ shell condition of type "console/output" not passing

target: target#update_gemfile_lock_spec
-------------------------------

target: target#update_gemfile_lock_dependency
-------------------------------------


ACTIONS
========


=============================

SUMMARY:



- Update lock file:
	Source:
		✔ [logstash_version]
	Condition:
		✗ [check_lockfile_exists] Check if lockfile exists
	Target:
		- [update_gemfile_lock_dependency] Update logstash-core dependency
		- [update_gemfile_lock_spec] Update logstash-core spec


⚠ Update versions.yml:
	Source:
		✔ [logstash_version]
	Target:
		⚠ [update_logstash_core_version] Update logstash-core version in versions.yml
		⚠ [update_logstash_version] Update logstash version in versions.yml


Run Summary
===========
Pipeline(s) run:
  * Changed:	1
  * Failed:	0
  * Skipped:	1
  * Succeeded:	0
  * Total:	2

@donoghuc
Copy link
Member Author

This was tested with #18050 and produced a PR with a version bump! Ready for review.

@donoghuc donoghuc marked this pull request as ready for review August 27, 2025 23:10
@donoghuc donoghuc requested review from a team as code owners August 27, 2025 23:10
@donoghuc donoghuc force-pushed the bump-ls-version-action branch 2 times, most recently from 956fd79 to 38c0131 Compare September 8, 2025 22:35
Comment on lines 6 to 9
# begin updatecli-compose policy values
user: 'github-actions[bot]'
email: '41898282+github-actions[bot]@users.noreply.github.com'
# end updatecli-compose policy values No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need those values, that's when using a shared policy with updatecli, in this case, you only added the .ci/updatecli/bump-logstash-version.yml manifest.

Suggested change
# begin updatecli-compose policy values
user: 'github-actions[bot]'
email: '41898282+github-actions[bot]@users.noreply.github.com'
# end updatecli-compose policy values

@@ -1,19 +1,34 @@
name: Stub GH action for devoping new workflows [STUB]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicates .github/workflows/bump-version.yml?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as #18035 (comment)

Comment on lines 15 to 16
pull_request:
types: [opened, synchronize, reopened]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, this event will not work with forked PRs, since the GH token will never have any elevated access but read-only.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the idea here was that this "stub" action is already checked in with a pull_request trigger. I was hoping that by doing that and targeting that workflow file from a branch that pushed to the elastic master copy of logstash would be enough to actually give a valid token for raising a PR. It may not actually be necessary though. Either way I will be removing the "stub" before this is actually ready for review.

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 pattern suggested in code review
@@ -0,0 +1,81 @@
---
name: Update logstash version files
pipelineid: "logstash/version-updates"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run this manifest targeting multiple branches, then the pipelineid should be unique. I'd recommend using LOGSTASH_BRANCH.

Suggested change
pipelineid: "logstash/version-updates"
pipelineid: "logstash/version-updates-{{ requiredEnv "LOGSTASH_BRANCH" }}"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

enabled: true
owner: elastic
repository: logstash
commitusingapi: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is hardcoded in the updatecli manifest

Suggested change
commitusingapi: true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@@ -0,0 +1,5 @@
scm:
enabled: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: unused

Suggested change
enabled: true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

workflow_dispatch:
inputs:
logstash_version:
description: 'Logstash version'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think adding an example might be useful here?

Suggested change
description: 'Logstash version'
description: 'Logstash version (i.e: 1.2.3)'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, added one

required: true
type: string
logstash_branch:
description: 'Logstash branch'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: 'Logstash branch'
description: 'Logstash branch (i.e: 8.19)'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, added one

@donoghuc donoghuc requested a review from v1v September 16, 2025 22:12
@elastic-sonarqube
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@donoghuc
Copy link
Member Author

@v1v Could you take another pass at reviewing this? I updated based on your comments, and used the test action to do all the version bumps this cycle!

Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this PR, it's wonderful!

@donoghuc donoghuc added the backport-active-all Automated backport with mergify to all the active branches label Sep 23, 2025
@donoghuc donoghuc merged commit ad20032 into elastic:main Sep 23, 2025
14 checks passed
@github-actions
Copy link
Contributor

@Mergifyio backport 8.18 8.19 9.0 9.1

@mergify
Copy link
Contributor

mergify bot commented Sep 23, 2025

backport 8.18 8.19 9.0 9.1

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)
mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)
mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)
mergify bot pushed a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)
donoghuc added a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)

Co-authored-by: Cas Donoghue <[email protected]>
donoghuc added a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)

Co-authored-by: Cas Donoghue <[email protected]>
donoghuc added a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)

Co-authored-by: Cas Donoghue <[email protected]>
donoghuc added a commit that referenced this pull request Sep 23, 2025
* 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

(cherry picked from commit ad20032)

Co-authored-by: Cas Donoghue <[email protected]>
v1v pushed a commit that referenced this pull request Oct 21, 2025
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants