From 4847566b903dac8f7a36bb77d2668734d08d0244 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Tue, 30 Jul 2024 11:17:33 +0200 Subject: [PATCH] Add sample to use updatecli to update mysql image --- .../workflows/bump-integration-services.yml | 44 +++++++++++++++++++ .../workflows/updatecli-packages.d/mysql.yml | 42 ++++++++++++++++++ packages/mysql/_dev/deploy/variants.yml | 4 +- 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/bump-integration-services.yml create mode 100644 .github/workflows/updatecli-packages.d/mysql.yml diff --git a/.github/workflows/bump-integration-services.yml b/.github/workflows/bump-integration-services.yml new file mode 100644 index 00000000000..dfc54e561f8 --- /dev/null +++ b/.github/workflows/bump-integration-services.yml @@ -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/updatecli-action@v2.62.0 + + - 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 }} diff --git a/.github/workflows/updatecli-packages.d/mysql.yml b/.github/workflows/updatecli-packages.d/mysql.yml new file mode 100644 index 00000000000..5754790cea3 --- /dev/null +++ b/.github/workflows/updatecli-packages.d/mysql.yml @@ -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" }}' diff --git a/packages/mysql/_dev/deploy/variants.yml b/packages/mysql/_dev/deploy/variants.yml index 58efb36358e..92b17d7d500 100755 --- a/packages/mysql/_dev/deploy/variants.yml +++ b/packages/mysql/_dev/deploy/variants.yml @@ -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