Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to bump stack versions #10599

Merged
merged 5 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/bump-elastic-stack-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: Update versions of Elastic Stack dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 1-5'
pull_request:
paths:
- .github/updatecli.d/*
- .github/workflows/bump-elastic-stack-version.yml

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
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved

- name: Select diff action
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "UPDATECLI_ACTION=diff" >> $GITHUB_ENV
- name: Select apply action
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "UPDATECLI_ACTION=apply" >> $GITHUB_ENV
- name: Update latest testing 7.x stack version
# --experimental needed for commitusingapi option.
run: updatecli --experimental ${{ env.UPDATECLI_ACTION }} --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 ${{ env.UPDATECLI_ACTION }} --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