feat(common): Release v2.0.3 (#203)

Co-authored-by: JJGadgets <git@jjgadgets.tech>
Co-authored-by: bjw-s-bot[bot] <87358111+bjw-s-bot[bot]@users.noreply.github.com>
This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2023-10-07 17:17:56 +02:00 committed by Bernd Schorgers
parent f729651dbe
commit ed015ee74b
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
12 changed files with 245 additions and 46 deletions

View file

@ -75,7 +75,7 @@ jobs:
helm repo index . --url https://bjw-s.github.io/helm-charts/ helm repo index . --url https://bjw-s.github.io/helm-charts/
- name: Commit changes - name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit id: auto-commit
with: with:
repository: dest repository: dest

View file

@ -10,11 +10,6 @@ on:
default: "[]" default: "[]"
required: false required: false
type: string type: string
secrets:
BJWS_APP_ID:
required: true
BJWS_APP_PRIVATE_KEY:
required: true
env: env:
HELM_VERSION: 3.11.2 HELM_VERSION: 3.11.2

View file

@ -26,8 +26,8 @@ jobs:
name: Prepare data required for release name: Prepare data required for release
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
outputs: outputs:
libraryChartsToRelease: ${{ steps.collect-charts.outputs.chartsLibrary }} libraryChartsToRelease: ${{ steps.collect-charts.outputs.chartsLibraryToRelease }}
applicationChartsToRelease: ${{ steps.collect-charts.outputs.chartsApplication }} applicationChartsToRelease: ${{ steps.collect-charts.outputs.chartsApplicationToRelease }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
@ -40,6 +40,7 @@ jobs:
with: with:
repoConfigFile: ./.ci/repo-config.yaml repoConfigFile: ./.ci/repo-config.yaml
overrideCharts: "[${{ inputs.charts }}]" overrideCharts: "[${{ inputs.charts }}]"
requireHeadAheadOfBase: false
release-library-charts: release-library-charts:
name: Release Library charts to GitHub pages name: Release Library charts to GitHub pages
@ -50,6 +51,16 @@ jobs:
charts: "${{ needs.prepare.outputs.libraryChartsToRelease }}" charts: "${{ needs.prepare.outputs.libraryChartsToRelease }}"
secrets: inherit secrets: inherit
tag-library-charts:
name: Create git tags for library charts
uses: ./.github/workflows/tag-charts.yaml
needs:
- prepare
- release-library-charts
with:
charts: "${{ needs.prepare.outputs.libraryChartsToRelease }}"
secrets: inherit
release-application-charts: release-application-charts:
name: Release Application charts to GitHub pages name: Release Application charts to GitHub pages
uses: ./.github/workflows/charts-release-ghpages.yaml uses: ./.github/workflows/charts-release-ghpages.yaml
@ -60,6 +71,16 @@ jobs:
charts: "${{ needs.prepare.outputs.applicationChartsToRelease }}" charts: "${{ needs.prepare.outputs.applicationChartsToRelease }}"
secrets: inherit secrets: inherit
tag-application-charts:
name: Create git tags for application charts
uses: ./.github/workflows/tag-charts.yaml
needs:
- prepare
- release-application-charts
with:
charts: "${{ needs.prepare.outputs.applicationChartsToRelease }}"
secrets: inherit
release-github-oci: release-github-oci:
name: Release Application charts to GitHub Container Registry name: Release Application charts to GitHub Container Registry
uses: ./.github/workflows/charts-release-oci.yaml uses: ./.github/workflows/charts-release-oci.yaml

54
.github/workflows/tag-charts.yaml vendored Normal file
View file

@ -0,0 +1,54 @@
name: "Charts: Create git tag"
on:
workflow_call:
inputs:
charts:
description: >
Json encoded list of Helm charts to release.
Defaults to releasing everything.
default: "[]"
required: false
type: string
secrets:
BJWS_APP_ID:
required: true
BJWS_APP_PRIVATE_KEY:
required: true
env:
CHARTS_SRC_DIR: "charts"
jobs:
tag-charts:
name: Tag charts
runs-on: ubuntu-22.04
steps:
- name: Get GitHub API token
id: get-app-token
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.BJWS_APP_ID }}
private_key: ${{ secrets.BJWS_APP_PRIVATE_KEY }}
- name: Checkout chart sources
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
token: ${{ steps.get-app-token.outputs.token }}
fetch-depth: 0
- name: Create git tag for charts
shell: bash
run: |
CHARTS=( $(yq --null-input e '${{ inputs.charts }}[]' ) )
for CHART in "${CHARTS[@]}" ; do
mapfile -t CHART_PATH_PARTS < <(echo "$CHART" | tr '/' '\n')
CHART_TYPE=${CHART_PATH_PARTS[0]}
CHART_NAME=${CHART_PATH_PARTS[1]}
CHART_VERSION=$(yq e '.version' ${{ env.CHARTS_SRC_DIR }}/${CHART}/Chart.yaml)
git tag --force "${CHART_NAME}-${CHART_VERSION}"
done
git push --tags --force

View file

@ -38,6 +38,12 @@ tests:
image: image:
repository: ghcr.io/mendhak/http-https-echo repository: ghcr.io/mendhak/http-https-echo
tag: 30 tag: 30
second:
containers:
first-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 30
persistence: persistence:
data: data:
@ -54,37 +60,46 @@ tests:
second-container: second-container:
- path: /appdata/config - path: /appdata/config
readOnly: true readOnly: true
second:
first-container:
- path: /second-pod/config.yaml
readOnly: false
subPath: config.yaml
asserts: asserts:
- documentIndex: &DeploymentDoc 0 - documentIndex: &FirstDeploymentDoc 0
isKind: isKind:
of: Deployment of: Deployment
- documentIndex: *DeploymentDoc - documentIndex: *FirstDeploymentDoc
equal: equal:
path: spec.template.spec.containers[0].volumeMounts[0] path: spec.template.spec.containers[0].volumeMounts
value: value:
- mountPath: /globalTest
name: data name: data
mountPath: /globalTest - mountPath: /data/config.yaml
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[0].volumeMounts[1]
value:
name: data name: data
mountPath: /data/config.yaml
subPath: config.yaml subPath: config.yaml
- documentIndex: *DeploymentDoc - documentIndex: *FirstDeploymentDoc
equal: equal:
path: spec.template.spec.containers[1].volumeMounts[0] path: spec.template.spec.containers[1].volumeMounts
value: value:
- mountPath: /globalTest
name: data name: data
mountPath: /globalTest - mountPath: /appdata/config
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.containers[1].volumeMounts[1]
value:
name: data name: data
mountPath: /appdata/config
readOnly: true readOnly: true
- documentIndex: &SecondDeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *SecondDeploymentDoc
equal:
path: spec.template.spec.containers[0].volumeMounts
value:
- mountPath: /globalTest
name: data
- mountPath: /second-pod/config.yaml
name: data
subPath: config.yaml
- it: emptyDir should pass - it: emptyDir should pass
set: set:

View file

@ -0,0 +1,109 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: persistence volumes
templates:
- common.yaml
tests:
- it: no persistence should pass
asserts:
- documentIndex: &DeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
notExists:
path: spec.template.spec.volumes
- it: default should pass
set:
persistence:
config:
enabled: true
asserts:
- documentIndex: &DeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *DeploymentDoc
equal:
path: spec.template.spec.volumes
value:
- name: config
persistentVolumeClaim:
claimName: RELEASE-NAME-config
- it: advanced mount config should pass
set:
controllers:
main:
containers:
second-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 30
second:
containers:
first-container:
image:
repository: ghcr.io/mendhak/http-https-echo
tag: 30
persistence:
config:
enabled: true
existingClaim: test
advancedMounts:
main:
main:
- path: /config
readOnly: false
data:
type: configMap
name: myConfigMap
globalMounts:
- path: /globalTest
advancedMounts:
main:
main:
- path: /data/config.yaml
readOnly: false
subPath: config.yaml
second-container:
- path: /appdata/config
readOnly: true
second:
first-container:
- path: /second-pod/config.yaml
readOnly: false
subPath: config.yaml
no-mounts:
existingClaim: test
asserts:
- documentIndex: &FirstDeploymentDoc 0
isKind:
of: Deployment
- documentIndex: *FirstDeploymentDoc
equal:
path: spec.template.spec.volumes
value:
- name: config
persistentVolumeClaim:
claimName: test
- configMap:
name: myConfigMap
name: data
- name: no-mounts
persistentVolumeClaim:
claimName: test
- documentIndex: &SecondDeploymentDoc 1
isKind:
of: Deployment
- documentIndex: *SecondDeploymentDoc
equal:
path: spec.template.spec.volumes
value:
- configMap:
name: myConfigMap
name: data
- name: no-mounts
persistentVolumeClaim:
claimName: test

View file

@ -3,7 +3,7 @@ apiVersion: v2
name: common name: common
description: Function library for Helm charts description: Function library for Helm charts
type: library type: library
version: 2.0.2 version: 2.0.3
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
keywords: keywords:
- common - common
@ -16,7 +16,4 @@ annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: fixed - kind: fixed
description: |- description: |-
ServiceAccount could not be referenced without creating Volumes did not render correctly across multiple controllers
- kind: fixed
description: |-
Controllers without a type did not default to Deployment

View file

@ -1,6 +1,6 @@
# common # common
![Version: 2.0.2](https://img.shields.io/badge/Version-2.0.2-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![Version: 2.0.3](https://img.shields.io/badge/Version-2.0.3-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square)
Function library for Helm charts Function library for Helm charts
@ -27,7 +27,7 @@ Include this chart as a dependency in your `Chart.yaml` e.g.
# Chart.yaml # Chart.yaml
dependencies: dependencies:
- name: common - name: common
version: 2.0.2 version: 2.0.3
repository: https://bjw-s.github.io/helm-charts/ repository: https://bjw-s.github.io/helm-charts/
``` ```
@ -61,7 +61,7 @@ The following table contains an overview of available values and their descripti
| controllers.main.containers.main.image.pullPolicy | string | `nil` | image pull policy | | controllers.main.containers.main.image.pullPolicy | string | `nil` | image pull policy |
| controllers.main.containers.main.image.repository | string | `nil` | image repository | | controllers.main.containers.main.image.repository | string | `nil` | image repository |
| controllers.main.containers.main.image.tag | string | `nil` | image tag | | controllers.main.containers.main.image.tag | string | `nil` | image tag |
| controllers.main.containers.main.lifecycle | object | `{}` | Configure the lifecycle for the container | | controllers.main.containers.main.lifecycle | object | `{}` | [[ref](https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/)] |
| controllers.main.containers.main.nameOverride | string | `nil` | Override the container name | | controllers.main.containers.main.nameOverride | string | `nil` | Override the container name |
| controllers.main.containers.main.order | int | 99 | Override the default container order Containers get sorted alphanumerically by the `<order>-<identifier>` combination. | | controllers.main.containers.main.order | int | 99 | Override the default container order Containers get sorted alphanumerically by the `<order>-<identifier>` combination. |
| controllers.main.containers.main.probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) | | controllers.main.containers.main.probes | object | See below | [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/) |

View file

@ -18,10 +18,17 @@ Returns the value for volumes
{{- end -}} {{- end -}}
{{- if $persistenceEnabled -}} {{- if $persistenceEnabled -}}
{{- $hasglobalMounts := not (empty $persistenceValues.globalMounts) -}}
{{- $globalMounts := dig "globalMounts" list $persistenceValues -}}
{{- $hasAdvancedMounts := not (empty $persistenceValues.advancedMounts) -}}
{{- $advancedMounts := dig "advancedMounts" $controllerObject.identifier list $persistenceValues -}} {{- $advancedMounts := dig "advancedMounts" $controllerObject.identifier list $persistenceValues -}}
{{- if $advancedMounts -}}
{{- $_ := set $persistenceItemsToProcess $identifier $persistenceValues -}} {{ if or
{{- else -}} ($hasglobalMounts)
(and ($hasAdvancedMounts) (not (empty $advancedMounts)))
(and (not $hasglobalMounts) (not $hasAdvancedMounts))
-}}
{{- $_ := set $persistenceItemsToProcess $identifier $persistenceValues -}} {{- $_ := set $persistenceItemsToProcess $identifier $persistenceValues -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

View file

@ -304,7 +304,8 @@ controllers:
# -- Configure the Security Context for the container # -- Configure the Security Context for the container
securityContext: {} securityContext: {}
# -- Configure the lifecycle for the container # -- Configure the lifecycle event hooks for the container
# -- [[ref](https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/)]
lifecycle: {} lifecycle: {}
# -- Configure the path at which the file to which the containers termination message will be written. # -- Configure the path at which the file to which the containers termination message will be written.

View file

@ -2,7 +2,7 @@
apiVersion: v2 apiVersion: v2
description: A common powered chart template. This can be useful for small projects that don't have their own chart. description: A common powered chart template. This can be useful for small projects that don't have their own chart.
name: app-template name: app-template
version: 2.0.2 version: 2.0.3
kubeVersion: ">=1.22.0-0" kubeVersion: ">=1.22.0-0"
maintainers: maintainers:
- name: bjw-s - name: bjw-s
@ -10,12 +10,12 @@ maintainers:
dependencies: dependencies:
- name: common - name: common
repository: https://bjw-s.github.io/helm-charts repository: https://bjw-s.github.io/helm-charts
version: 2.0.2 version: 2.0.3
annotations: annotations:
artifacthub.io/changes: |- artifacthub.io/changes: |-
- kind: changed - kind: changed
description: | description: |
Updated library version to 2.0.2. Updated library version to 2.0.3.
links: links:
- name: Upgrade instructions from v1.x - name: Upgrade instructions from v1.x
url: https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template#from-1xx-to-20x url: https://github.com/bjw-s/helm-charts/tree/main/charts/other/app-template#from-1xx-to-20x

View file

@ -1,6 +1,6 @@
# app-template # app-template
![Version: 2.0.2](https://img.shields.io/badge/Version-2.0.2-informational?style=flat-square) ![Version: 2.0.3](https://img.shields.io/badge/Version-2.0.3-informational?style=flat-square)
A common powered chart template. This can be useful for small projects that don't have their own chart. A common powered chart template. This can be useful for small projects that don't have their own chart.
@ -12,7 +12,7 @@ Kubernetes: `>=1.22.0-0`
| Repository | Name | Version | | Repository | Name | Version |
|------------|------|---------| |------------|------|---------|
| https://bjw-s.github.io/helm-charts | common | 2.0.2 | | https://bjw-s.github.io/helm-charts | common | 2.0.3 |
## Installing the Chart ## Installing the Chart