Skip to content

Commit

Permalink
Add action to update addon versions (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjpryor authored Sep 22, 2023
1 parent 11c17bb commit 0cd307c
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 186 deletions.
59 changes: 0 additions & 59 deletions .github/scripts/generate-app-token

This file was deleted.

38 changes: 0 additions & 38 deletions .github/scripts/github-update-version

This file was deleted.

62 changes: 0 additions & 62 deletions .github/scripts/helm-update-version

This file was deleted.

4 changes: 0 additions & 4 deletions .github/scripts/requirements.txt

This file was deleted.

102 changes: 102 additions & 0 deletions .github/workflows/update-addons.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Update addons
on:
# Allow manual executions
workflow_dispatch:
# Run nightly
schedule:
- cron: '0 0 * * *'

jobs:
propose_update_pr:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- key: calico
path: cni.calico.chart

- key: cilium
path: cni.cilium.chart

- key: openstack-ccm
path: openstack.ccm.chart

- key: csi-cinder
path: openstack.csiCinder.chart

- key: metrics-server
path: metricsServer.chart

- key: kubernetes-dashboard
path: kubernetesDashboard.chart

- key: ingress-nginx
path: ingress.nginx.chart

- key: kube-prometheus-stack
path: monitoring.kubePrometheusStack.chart

- key: loki-stack
path: monitoring.lokiStack.chart

- key: node-feature-discovery
path: nodeFeatureDiscovery.chart

- key: nvidia-gpu-operator
path: nvidiaGPUOperator.chart

- key: mellanox-network-operator
path: mellanoxNetworkOperator.chart

name: ${{ matrix.key }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Extract repo and chart from values.yaml
id: chart-info
uses: stackhpc/github-actions/config-extract@master
with:
path: ./charts/cluster-addons/values.yaml
outputs: |
repo=${{ matrix.path }}.repo
name=${{ matrix.path }}.name
- name: Check for updates
id: next
uses: stackhpc/github-actions/helm-latest-version@master
with:
repository: ${{ steps.chart-info.outputs.repo }}
chart: ${{ steps.chart-info.outputs.name }}

- name: Update chart version in values.yaml
uses: stackhpc/github-actions/config-update@master
with:
path: ./charts/cluster-addons/values.yaml
updates: |
${{ matrix.path }}.version=${{ steps.next.outputs.version }}
- name: Generate app token for PR
uses: stackhpc/github-actions/generate-app-token@master
id: generate-app-token
with:
repository: ${{ github.repository }}
app-id: ${{ secrets.APP_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Propose changes via PR if required
uses: peter-evans/create-pull-request@v5
with:
token: ${{ steps.generate-app-token.outputs.token }}
commit-message: >-
Update ${{ matrix.key }} addon to ${{ steps.next.outputs.version }}
branch: update-addon/${{ matrix.key }}
delete-branch: true
title: >-
Update ${{ matrix.key }} addon to ${{ steps.next.outputs.version }}
body: >
This PR was created automatically to update the
${{ matrix.key }} addon to ${{ steps.next.outputs.version }}.
labels: |
automation
addon-update
46 changes: 23 additions & 23 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install script dependencies
run: pip install -r .github/scripts/requirements.txt

- name: Check for updates (Helm)
id: helm-update-version
run: |
.github/scripts/helm-update-version \
${{ matrix.repo_url }} \
${{ matrix.chart_name }} \
${{ matrix.key }} \
'${{ matrix.constraints || '>=0.0.0' }}'
id: helm-version
uses: stackhpc/github-actions/helm-latest-version@master
with:
repository: ${{ matrix.repo_url }}
chart: ${{ matrix.chart_name }}
if: ${{ matrix.type == 'helm' }}

- name: Check for updates (GitHub)
id: github-update-version
run: |
.github/scripts/github-update-version \
${{ matrix.repo }} \
${{ matrix.key }}
id: github-version
uses: stackhpc/github-actions/github-latest-release@master
with:
repository: ${{ matrix.repo }}
if: ${{ matrix.type == 'github' }}

- name: Get next version from relevant outputs
Expand All @@ -81,18 +75,24 @@ jobs:
NEXT_VERSION: >-
${{
matrix.type == 'helm' &&
steps.helm-update-version.outputs.next-version ||
steps.github-update-version.outputs.next-version
steps.helm-version.outputs.version ||
steps.github-version.outputs.version
}}
- name: Update dependency key
uses: stackhpc/github-actions/config-update@master
with:
path: ./dependencies.json
updates: |
${{ matrix.key }}=${{ steps.next.outputs.version }}
- name: Generate app token for PR
uses: stackhpc/github-actions/generate-app-token@master
id: generate-app-token
run: >
.github/scripts/generate-app-token "$REPO" "$APP_ID" "$APP_PRIVATE_KEY"
env:
REPO: ${{ github.repository }}
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
with:
repository: ${{ github.repository }}
app-id: ${{ secrets.APP_ID }}
app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Propose changes via PR if required
uses: peter-evans/create-pull-request@v5
Expand Down

0 comments on commit 0cd307c

Please sign in to comment.