Skip to content

Commit

Permalink
Add sample to use updatecli to update mysql image
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano committed Jul 30, 2024
1 parent 5c1373d commit 4847566
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/bump-integration-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Update versions of integrations services.

on:
workflow_dispatch:
schedule:
- cron: '0 1 * * 1-5'
pull_request:
paths:
- .github/updatecli-packages.d/*
- .github/workflows/bump-integration-services.yml

permissions:
contents: read

jobs:
bump-mysql-version:
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]

- 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 mysql services.
# --experimental needed for commitusingapi option.
run: updatecli --experimental ${{ env.UPDATECLI_ACTION }} --config .github/workflows/updatecli-packages.d/mysql.yml --values .github/workflows/updatecli.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/updatecli-packages.d/mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Bump latest mysql service test version
pipelineid: 'bump-latest-mysql-variant-version'

actions:
default:
title: '[updatecli] Update latest mysql version to {{ source "latest" }}'
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:
latest:
kind: dockerimage
spec:
image: mysql
architecture: "linux/amd64"
kind: latest
tagfilter: '^8.\d*.\d*$'

targets:
mysqlTag:
name: "mysql variant"
kind: file
spec:
file: "packages/mysql/_dev/deploy/variants.yml"
matchpattern: '(IMAGE: mysql:)8.*'
replacepattern: '${1}{{ source "latest" }}'
4 changes: 2 additions & 2 deletions packages/mysql/_dev/deploy/variants.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variants:
mysql_8_0_35:
mysql_8:
IMAGE: mysql:8.0.35
percona_8_0_36:
IMAGE: percona:8.0.34-26
default: mysql_8_0_35
default: mysql_8

0 comments on commit 4847566

Please sign in to comment.