Skip to content

Commit

Permalink
chore: add updatecli configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
argoyle committed Aug 12, 2024
1 parent 7480bc3 commit 6e27823
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 1 deletion.
43 changes: 43 additions & 0 deletions .github/workflows/updatecli.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Updatecli

on:
# Trigger Updatecli if a new commit land on the main branch
push:
branches: [ main ]
# Trigger Updatecli if a pullrequest is open targeting the main branch.
# This is useful to test Updatecli manifest change
pull_request:
branches: [ main ]
# Manually trigger Updatecli via GitHub UI
workflow_dispatch:
# Trigger Updatecli once day by a cronjob
schedule:
# * is a special character in YAML, so you have to quote this string
# Run once a day
- cron: '0 0 * * *'

permissions:
contents: "write"
pull-requests: "write"

jobs:
updatecli:
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Updatecli in the runner
uses: updatecli/updatecli-action@v2

- uses: azure/setup-kubectl@v4
id: kubectl

- uses: azure/setup-helm@v4.2.0
id: helm

- name: Run Updatecli in apply mode
run: "updatecli --experimental apply --config ./updatecli/updatecli.d --values updatecli/values.yaml --clean=true"
env:
UPDATECLI_GITHUB_TOKEN: "${{ secrets.UPDATECLI_GITHUB_TOKEN }}"
3 changes: 2 additions & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
locals {
keda_yaml = file("${path.module}/keda.yaml")
version = "2.15.0"
}

output "addons" {
value = [{
name : "keda"
version : "2.15.0"
version : local.version
content : local.keda_yaml
}]
}
65 changes: 65 additions & 0 deletions updatecli/updatecli.d/keda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
sources:
lastRelease:
kind: helmchart
spec:
url: 'https://kedacore.github.io/charts'
name: 'keda'

targets:
chart:
name: bump chart version
kind: yaml
scmid: github
spec:
file: 'keda/kustomization.yaml'
key: '$.helmCharts[0].version'
transformers:
- addprefix: "'"
- addsuffix: "'"
module_version:
name: bump module version
kind: hcl
scmid: github
spec:
file: 'outputs.tf'
path: 'locals.version'
transformers:
- trimprefix: "v"
kubectl:
name: run kubectl when chart changed
kind: shell
scmid: github
dependson:
- chart
- module_version
dependsonchange: true
disablesourceinput: true
spec:
command: "rm -rf keda/charts && kubectl kustomize . -o keda.yaml --enable-helm && git diff --shortstat keda.yaml"
environments:
- name: PATH

scms:
github:
kind: "github"
spec:
user: "argoyle"
email: "updatecli@opzkit.io"
owner: "opzkit"
repository: "terraform-aws-k8s-addons-keda"
token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}'
username: 'UpdateCLI'
branch: "main"
commitusingapi: true

# Define action configurations if one needs to be created
actions:
addon:
kind: "github/pullrequest"
scmid: "github"
spec:
automerge: true
draft: false
labels:
- "dependencies"
title: "Update KEDA version"
4 changes: 4 additions & 0 deletions updatecli/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
github:
user: "UpdateCLI"
email: "updatecli@opzkit.io"
username: "github-actions"

0 comments on commit 6e27823

Please sign in to comment.