Skip to content

Commit

Permalink
Merge branch 'civo:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
keithhubner authored Apr 29, 2024
2 parents 39f967b + 1083817 commit ad705a6
Show file tree
Hide file tree
Showing 103 changed files with 5,935 additions and 533 deletions.
13 changes: 6 additions & 7 deletions .github/updatecli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ An Updatecli typical project has:

* A directory named `updatecli.d` that contains all Updatecli manifests. While the directory `updatecli.d` is not mandatory, it is used by IDE(s) to correctly load the Updatecli jsonshema used for validation and auto-completion. This simplifies writing the Updatecli custom DSL.

* A file named `values.yaml`. This file allows to customize Updatecli manifest. In the context of this project, we use it to quickly override git repository parameters such as the git repository we want to update.
* A file named `values.d/scm.yaml`. This file allows to customize Updatecli manifest. In the context of this project, we use it to quickly override git repository parameters such as the git repository we want to update.

```
├── README.md
Expand All @@ -39,7 +39,9 @@ An Updatecli typical project has:
│   ├── keda.yaml
│   ├── rancher.yaml
│   └── <your_manifest>.yaml
└── values.yaml
└── values.d
├── apps.yaml
└── scm.yaml
```

## Howto
Expand All @@ -49,19 +51,16 @@ An Updatecli typical project has:
```
export UPDATECLI_GITHUB_ACTOR="<your Github username>"
export UPDATECLI_GITHUB_TOKEN="<your GitHub personal access token>"
updatecli diff --config updatecli.d --values values.yaml
updatecli compose diff --file ../../update-compose.yaml
```

* `--config` can accept either a specific file or a directory containing manifest.

### Run Updatecli in apply mode

IMPORTANT: You can easily test on your personal fork by providing a different `values.yaml` with your specific parameters.

```
export UPDATECLI_GITHUB_ACTOR="<your Github username>"
export UPDATECLI_GITHUB_TOKEN="<your GitHub personal access token>"
updatecli apply --config updatecli.d --values values.yaml
updatecli compose apply --file ../../update-compose.yaml
```

* `--config` can accept either a specific file or a directory containing manifest.
8 changes: 8 additions & 0 deletions .github/updatecli/update-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
policies:
- name: Local Policies
config:
- updatecli.d
values:
- values.d/scm.yaml
- values.d/apps.yaml

83 changes: 83 additions & 0 deletions .github/updatecli/updatecli.d/apps/containers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#
# This policy updates container image tags defined in files app.yaml
# containers to monitor must be specified in the values file:
# .github/updatecli/values.d/apps.yaml
#
# The app/container policy generates one update pipeline per app where an app can contain multiple containers
# To show generated pipeline you can run (from the root repository)
# updatecli manifest show --config .github/updatecli/updatecli.d/apps/containers.tpl --values .github/updatecli/values.d/scm.yaml --values .github/updatecli/values.d/apps.yaml
# To test what this policy would change
# updatecli diff --config .github/updatecli/updatecli.d/apps/containers.tpl --values .github/updatecli/values.d/scm.yaml --values .github/updatecli/values.d/apps.yaml

{{ $github := .github }}

{{ range $id, $app := .apps }}
---
name: 'deps: bump container {{ $id }} tag'
pipelineid: 'containers/{{ $id }}'
sources:
{{ range $i, $container := $app }}
{{ $container.image }}:
name: 'Get latest tag for {{ $container.image }}'
kind: 'dockerimage'
spec:
image: '{{ $container.image }}'
{{ if $container.tagfilter }}
tagfilter: '{{ $container.tagfilter }}'
{{ end }}
{{ if $container.versionfilter }}
versionfilter:
{{ $container.versionfilter | toYaml | indent 8 }}
{{ end }}
{{ end }}

targets:
{{ range $i, $container := $app }}
{{ if eq $i 0 }}
manifest:
name: 'Update {{ $id }} /manifest.yaml'
kind: 'yaml'
sourceid: '{{ $container.image }}'
scmid: 'kubernetes-marketplace'
spec:
file: '{{ $id }}/manifest.yaml'
key: '$.version'
{{ end }}

{{ $container.image }}:
name: 'Update {{ $id }}/app.yaml'
kind: 'file'
scmid: 'kubernetes-marketplace'
disablesourceinput: true
spec:
file: '{{ $id }}/app.yaml'
matchpattern: '(?m)image: {{ $container.image }}:(.*)'
replacepattern: 'image: {{ $container.image }}:{{ "{{" }} source "{{ $container.image }}" {{ "}}" }}'
{{ end }}

# Define git repository configuration to know where to push changes
# Values are templated and provided via the values.yaml so we can easily
# adapt to the repository owner.
scms:
kubernetes-marketplace:
kind: "github"
spec:
user: "{{ $github.user }}"
email: "{{ $github.email }}"
owner: "{{ $github.owner }}"
repository: "{{ $github.repository }}"
branch: "{{ $github.branch }}"
username: '{{ requiredEnv "UPDATECLI_GITHUB_ACTOR" }}'
token: '{{ requiredEnv "UPDATECLI_GITHUB_TOKEN" }}'

actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: "kubernetes-marketplace"
spec:
title: 'deps: bump container tag for {{ $id }}'
usetitleforautomerge: true
mergemethod: squash
labels:
- enhancement
{{ end }}
10 changes: 5 additions & 5 deletions .github/updatecli/updatecli.d/argocd.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bump CIVO marketplace Argocd version"
name: "deps: bump CIVO marketplace Argocd version"
pipelineid: argocd

sources:
Expand All @@ -10,7 +10,7 @@ sources:
scmid: argo-helm
spec:
file: charts/argo-cd/Chart.yaml
key: version
key: $.version

# Monitor the appVersion in the Chart.yaml file from the argocd git repository referenced by scmid
appVersion:
Expand All @@ -19,7 +19,7 @@ sources:
scmid: argo-helm
spec:
file: charts/argo-cd/Chart.yaml
key: appVersion
key: $.appVersion

app:
# Using the githubrelease allows us to retrieve the changelog information
Expand Down Expand Up @@ -56,7 +56,7 @@ targets:
scmid: kubernetes-marketplace
spec:
file: argocd/manifest.yaml
key: version
key: $.version
sourceid: app

install:
Expand Down Expand Up @@ -97,7 +97,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Argocd Helm chart to {{ source "chart" }}'
title: 'deps: bump Argocd Helm chart to {{ source "chart" }}'
spec:
description: For full list of changes please check ArtifactHub [changelog](https://artifacthub.io/packages/helm/argo/argo-cd?modal=changelog)
usetitleforautomerge: true
Expand Down
6 changes: 3 additions & 3 deletions .github/updatecli/updatecli.d/cert-manager.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bump CIVO marketplace cert-manager version"
name: "deps: bump cert-manager version"
pipelineid: certmanager

sources:
Expand All @@ -23,7 +23,7 @@ targets:
scmid: kubernetes-marketplace
spec:
file: cert-manager/manifest.yaml
key: version
key: $.version
sourceid: app

install:
Expand Down Expand Up @@ -55,7 +55,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Cert-manager Helm chart to {{ source "app" }}'
title: 'deps: bump cert-manager Helm chart to {{ source "app" }}'
spec:
usetitleforautomerge: true
mergemethod: squash
Expand Down
6 changes: 3 additions & 3 deletions .github/updatecli/updatecli.d/epinio.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bump CIVO marketplace Epinio version"
name: "deps: bump Epinio version"
pipelineid: epinio

sources:
Expand Down Expand Up @@ -27,7 +27,7 @@ targets:
- addprefix: v
spec:
file: epinio/manifest.yaml
key: version
key: $.version
sourceid: chart

install:
Expand Down Expand Up @@ -59,7 +59,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Epinio Helm chart to {{ source "chart" }}'
title: 'deps: bump Epinio Helm chart to {{ source "chart" }}'
spec:
usetitleforautomerge: true
mergemethod: squash
Expand Down
4 changes: 2 additions & 2 deletions .github/updatecli/updatecli.d/jenkins.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Bump Jenkins version
name: "deps: Bump Jenkins version"
pipelineid: jenkins

# Define git repository configuration to know where to push changes
Expand Down Expand Up @@ -63,7 +63,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Jenkins Helm chart to {{ source "version" }}'
title: 'deps: bump Jenkins Helm chart to {{ source "version" }}'
spec:
usetitleforautomerge: true
description: |
Expand Down
6 changes: 3 additions & 3 deletions .github/updatecli/updatecli.d/keda.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bump CIVO marketplace Keda version"
name: "deps: bump Keda version"
pipelineid: keda

sources:
Expand Down Expand Up @@ -28,7 +28,7 @@ targets:
scmid: kubernetes-marketplace
spec:
file: keda/manifest.yaml
key: version
key: $.version
sourceid: app

install:
Expand Down Expand Up @@ -60,7 +60,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Keda Helm chart to {{ source "chart" }}'
title: 'deps: bump Keda Helm chart to {{ source "chart" }}'
spec:
usetitleforautomerge: true
mergemethod: squash
Expand Down
4 changes: 2 additions & 2 deletions .github/updatecli/updatecli.d/kubewarden.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bump Kubewarden Helm charts
name: "deps: bump Kubewarden Helm charts"
pipelineid: kubewarden

sources:
Expand Down Expand Up @@ -90,7 +90,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Kubewarden Helm chart'
title: 'deps: bump Kubewarden Helm chart'
spec:
usetitleforautomerge: true
mergemethod: squash
Expand Down
10 changes: 5 additions & 5 deletions .github/updatecli/updatecli.d/rancher.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Bump CIVO marketplace Rancher version"
name: "deps: bump Rancher version"
pipelineid: rancher

sources:
Expand All @@ -17,7 +17,7 @@ targets:
scmid: kubernetes-marketplace
spec:
file: rancher/manifest.yaml
key: version
key: $.version
sourceid: chart

install:
Expand All @@ -27,8 +27,8 @@ targets:
disablesourceinput: true
spec:
file: rancher/install.sh
matchpattern: '--version (v{0,1})(\d*.\d*.\d*)'
replacepattern: '--version {{ source "chart" }}'
matchpattern: 'RANCHER_VERSION=(.*)'
replacepattern: 'RANCHER_VERSION="{{ source "chart" }}"'

# Define git repository configuration to know where to push changes
# Values are templated and provided via the values.yaml so we can easily
Expand All @@ -49,7 +49,7 @@ actions:
kubernetes-marketplace:
kind: "github/pullrequest"
scmid: kubernetes-marketplace
title: 'Bump Rancher Helm chart to {{ source "chart" }}'
title: 'deps: bump Rancher Helm chart to {{ source "chart" }}'
spec:
usetitleforautomerge: true
mergemethod: squash
Expand Down
75 changes: 75 additions & 0 deletions .github/updatecli/values.d/apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# The "apps" value is used by the Updatecli policy named "updatecli.d/apps/containers.tpl"
# to automate docker image tag
# apps is a map of container's array
# The map id represents the directory name for a specific app.yaml file
# the container array represents the container that needs to be updated for a specific app.yaml
# container image specifies the container image that needs to be updated in the file <id>/app.yaml
# The container tagfilter allows to restrict tags retrieved from a remote registry by using a regular expression.
# container versionfilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
#
# Please note that the version of the first container will be used as the manifest version in the file manifest.yaml
apps:
ferretdb:
- image: ghcr.io/ferretdb/ferretdb
versionfilter:
kind: semver
- image: postgres
tagfilter: '^(\d*).(\d*)$'
versionfilter:
kind: semver
ghost:
- image: ghost
versionfilter:
kind: semver
strict: true
joomla:
- image: joomla
versionfilter:
kind: semver
keycloak:
- image: quay.io/keycloak/keycloak
versionfilter:
kind: semver
kubesphere:
- image: kubesphere/ks-installer
versionfilter:
kind: semver
mariadb:
- image: mariadb
versionfilter:
kind: semver
pattern: '*'
nextcloud:
- image: nextcloud
versionfilter:
kind: semver
postgresql:
- image: postgres
tagfilter: '^(\d*).(\d*)$'
versionfilter:
kind: semver
rabbitmq:
- image: rabbitmq
tagfilter: '^(\d*)\.(\d*)\.(\d*)-management$'
versionfilter:
kind: semver
# for the semver constraint to work, we must explicitely mention
# that we want to include pre-release using the pattern >=0.0.0-0
pattern: '>=0.0.0-0'
redis:
- image: redis
tagfilter: '^(\d*).(\d*)-alpine$'
volcano:
- image: volcanosh/vc-webhook-manager
tagfilter: '^v(\d*).(\d*).(\d*)$'
versionfilter:
kind: semver
- image: volcanosh/vc-scheduler
tagfilter: '^v(\d*).(\d*).(\d*)$'
versionfilter:
kind: semver
- image: volcanosh/vc-controller-manager
tagfilter: '^v(\d*).(\d*).(\d*)$'
versionfilter:
kind: semver

Loading

0 comments on commit ad705a6

Please sign in to comment.