Skip to content

Commit

Permalink
Add github action to bump stack versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Jul 25, 2024
1 parent b92ed31 commit a2302d9
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/bump-elastic-stack-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Update versions of Elastic Stack dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 1-5'

permissions:
contents: read

jobs:
bump-elastic-stack:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4

- name: Install Updatecli in the runner
uses: updatecli/[email protected] # updatecli v0.80.0

- name: Update latest testing 7.x stack version
# --experimental needed for commitusingapi option.
run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-latest-7x-version.yml --values .github/workflows/updatecli.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update latest testing stack version
# --experimental needed for commitusingapi option.
run: updatecli --experimental apply --config .github/workflows/updatecli.d/bump-latest-snapshot-version.yml --values .github/workflows/updatecli.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/updatecli.d/bump-latest-7x-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Bump 7.x test version
pipelineid: 'bump-elastic-stack-7x-version'

actions:
default:
title: '[updatecli] Update 7.x snapshot to {{ source "latest7xSnapshot" }}'
kind: github/pullrequest
scmid: default
spec:
labels:
- automation
- dependency

scms:
default:
kind: github
spec:
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
commitusingapi: true
branch: main

sources:
latest7xSnapshot:
name: Get latest 7.x snapshot
kind: json
spec:
file: https://storage.googleapis.com/artifacts-api/snapshots/7.17.json
key: .version

targets:
update-7x-version:
name: '[updatecli] Update 7.x snapshot to {{ source "latest7xSnapshot" }}'
kind: file
sourceid: latest7xSnapshot
scmid: default
spec:
file: '.buildkite/pipeline.schedule-daily.yml'
matchpattern: '(STACK_VERSION:) 7\.[^\s]*\.[^\s]*'
replacepattern: '$1 {{ source "latest7xSnapshot" }}'
43 changes: 43 additions & 0 deletions .github/workflows/updatecli.d/bump-latest-snapshot-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Bump latest elastic-stack test version
pipelineid: 'bump-latest-elastic-stack-version'

actions:
default:
title: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}'
kind: github/pullrequest
scmid: default
spec:
labels:
- automation
- dependency

scms:
default:
kind: github
spec:
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
commitusingapi: true
branch: main

sources:
latestSnapshot:
name: Get latest snapshot
kind: json
spec:
file: https://storage.googleapis.com/artifacts-api/snapshots/main.json
key: .version

targets:
update-snapshot:
name: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}'
kind: file
sourceid: latestSnapshot
scmid: default
spec:
file: '.buildkite/pipeline.schedule-daily.yml'
matchpattern: '(STACK_VERSION:) 8\.[^\s]*\.[^\s]*'
replacepattern: '$1 {{ source "latestSnapshot" }}'
4 changes: 4 additions & 0 deletions .github/workflows/updatecli.d/scm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
scm:
owner: elastic
repository: integrations

0 comments on commit a2302d9

Please sign in to comment.