Skip to content

Commit 2277bae

Browse files
committed
feat: add automated kube-stack-version update workflow
- Add GitHub Actions workflow to update kube-stack-version weekly - Add Python script to fetch latest version from elastic-agent repository - Workflow runs on schedule (Mondays) and can be triggered manually - Creates PR automatically when changes are detected - Includes dry-run option for testing
1 parent bb1440d commit 2277bae

File tree

3 files changed

+234
-231
lines changed

3 files changed

+234
-231
lines changed
Lines changed: 73 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,106 @@
1-
name: Update Kube-Stack Version
1+
name: Update Kube Stack Version
22

33
on:
44
schedule:
55
# Run every Monday at 9:00 AM UTC
66
- cron: '0 9 * * 1'
7-
workflow_dispatch: # Allow manual triggering
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: 'Dry run (check for updates without creating PR)'
11+
required: false
12+
default: false
13+
type: boolean
814

915
jobs:
1016
update-kube-stack-version:
1117
runs-on: ubuntu-latest
1218

1319
steps:
1420
- name: Checkout repository
15-
uses: actions/checkout@v5
21+
uses: actions/checkout@v4
1622
with:
1723
token: ${{ secrets.GITHUB_TOKEN }}
18-
24+
fetch-depth: 0
25+
1926
- name: Set up Python
2027
uses: actions/setup-python@v4
2128
with:
22-
python-version: '3.13'
23-
24-
- name: Set up Git configuration
29+
python-version: '3.9'
30+
31+
- name: Install dependencies
2532
run: |
26-
git config --local user.email "[email protected]"
27-
git config --local user.name "GitHub Action"
28-
29-
- name: Run kube-stack version update script
33+
python -m pip install --upgrade pip
34+
pip install requests
35+
36+
- name: Run update script
37+
id: update-script
3038
run: |
31-
cd scripts
32-
python update_kube_stack_version.py --prepare-git
33-
39+
echo "Running kube-stack-version update script..."
40+
python scripts/update_kube_stack_version.py
41+
echo "Script completed successfully"
42+
3443
- name: Check for changes
35-
id: verify-changed-files
44+
id: check-changes
3645
run: |
37-
if [ -n "$(git status --porcelain)" ]; then
38-
echo "changed=true" >> $GITHUB_OUTPUT
46+
if git diff --quiet HEAD -- docset.yml; then
47+
echo "No changes detected in docset.yml"
48+
echo "has_changes=false" >> $GITHUB_OUTPUT
3949
else
40-
echo "changed=false" >> $GITHUB_OUTPUT
50+
echo "Changes detected in docset.yml"
51+
echo "has_changes=true" >> $GITHUB_OUTPUT
52+
53+
# Show the diff for logging
54+
echo "Changes:"
55+
git diff HEAD -- docset.yml
4156
fi
42-
57+
4358
- name: Create Pull Request
44-
if: steps.verify-changed-files.outputs.changed == 'true'
45-
uses: peter-evans/create-pull-request@v7
59+
if: steps.check-changes.outputs.has_changes == 'true' && github.event.inputs.dry_run != 'true'
60+
uses: peter-evans/create-pull-request@v5
4661
with:
4762
token: ${{ secrets.GITHUB_TOKEN }}
48-
commit-message: "chore: update kube-stack version"
49-
title: "chore: update kube-stack version"
63+
commit-message: 'chore: update kube-stack-version'
64+
title: 'chore: update kube-stack-version'
5065
body: |
51-
This PR automatically updates the kube-stack version in `docset.yml` based on the latest version from the elastic-agent repository.
66+
This PR automatically updates the `kube-stack-version` in `docset.yml` based on the latest version from the elastic-agent repository.
5267
5368
**Changes:**
54-
- Updated kube-stack version in docset.yml
69+
- Updated `kube-stack-version` to the latest value from elastic-agent repository
70+
71+
**Generated by:** [Update Kube Stack Version workflow](https://github.com/${{ github.repository }}/actions/workflows/update-kube-stack-version.yml)
5572
56-
This PR was created automatically by the weekly kube-stack version update workflow.
57-
branch: update-kube-stack-version-${{ github.run_id }}
73+
This is an automated update. Please review the changes before merging.
74+
branch: update-kube-stack-version
5875
delete-branch: true
5976
labels: |
6077
automated
61-
documentation
78+
chore
79+
kube-stack-version
80+
81+
- name: Dry run summary
82+
if: github.event.inputs.dry_run == 'true'
83+
run: |
84+
echo "## Dry Run Summary" >> $GITHUB_STEP_SUMMARY
85+
echo "" >> $GITHUB_STEP_SUMMARY
86+
if [ "${{ steps.check-changes.outputs.has_changes }}" == "true" ]; then
87+
echo "✅ **Changes detected** - A PR would be created in a real run" >> $GITHUB_STEP_SUMMARY
88+
echo "" >> $GITHUB_STEP_SUMMARY
89+
echo "**Changes that would be made:**" >> $GITHUB_STEP_SUMMARY
90+
echo '```diff' >> $GITHUB_STEP_SUMMARY
91+
git diff HEAD -- docset.yml >> $GITHUB_STEP_SUMMARY
92+
echo '```' >> $GITHUB_STEP_SUMMARY
93+
else
94+
echo "ℹ️ **No changes needed** - kube-stack-version is already up to date" >> $GITHUB_STEP_SUMMARY
95+
fi
96+
97+
- name: Summary
98+
if: github.event.inputs.dry_run != 'true'
99+
run: |
100+
echo "## Update Summary" >> $GITHUB_STEP_SUMMARY
101+
echo "" >> $GITHUB_STEP_SUMMARY
102+
if [ "${{ steps.check-changes.outputs.has_changes }}" == "true" ]; then
103+
echo "✅ **PR Created** - Changes detected and pull request created" >> $GITHUB_STEP_SUMMARY
104+
else
105+
echo "ℹ️ **No changes needed** - kube-stack-version is already up to date" >> $GITHUB_STEP_SUMMARY
106+
fi

docset.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,5 +295,5 @@ subs:
295295
intake-apis: https://www.elastic.co/docs/api/doc/observability-serverless/
296296
models-app: "Trained Models"
297297
agent-builder: "Elastic Agent Builder"
298-
kube-stack-version: 0.6.3
298+
kube-stack-version: 0.9.1
299299

0 commit comments

Comments
 (0)