feat(common): Release common library 3.7.1 (#383)

Co-authored-by: Aisling McGinn <me@aisling.dev>
This commit is contained in:
Bernd Schorgers 2025-02-11 13:23:27 +01:00 committed by GitHub
parent c94a28baa3
commit 433f6d132b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
146 changed files with 232 additions and 222 deletions

View file

@ -3,75 +3,44 @@ name: "Charts: Lint"
on:
workflow_call:
inputs:
checkoutCommit:
required: true
type: string
isRenovatePR:
required: true
default: "false"
type: string
chartsToLint:
charts:
description: >
A JSON encoded array of charts to lint
required: true
type: string
overrideDeps:
description: >
A JSON encoded array of dependencies to override before linting
type: string
required: false
Json encoded list of Helm charts to release.
Defaults to releasing everything.
default: "[]"
env:
HELM_VERSION: 3.11.2
required: true
type: string
helmVersion:
description: >
Helm version to use.
default: "3.11.2"
required: false
type: string
jobs:
lint-chart:
if: ${{ inputs.chartsToLint != '[]' }}
if: ${{ inputs.charts != '[]' && inputs.charts != '' }}
name: Lint chart
strategy:
matrix:
chart: ${{ fromJSON(inputs.chartsToLint) }}
chart: ${{ fromJSON(inputs.charts) }}
fail-fast: false
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Verify chart version
uses: bjw-s/helm-charts-actions/verify-chart-version@main
id: verify-chart-version
with:
chart: "charts/${{ matrix.chart }}"
- name: Verify chart changelog
uses: bjw-s/helm-charts-actions/verify-chart-changelog@main
if: inputs.isRenovatePR != 'true'
id: verify-chart-changelog
with:
chart: "charts/${{ matrix.chart }}"
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.11.1
uses: yokawasa/action-setup-kube-tools@v0.11.2
with:
setup-tools: |
helmv3
helm: "${{ env.HELM_VERSION }}"
helm: "${{ inputs.helmVersion }}"
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
uses: helm/chart-testing-action@v2.7.0
- name: Override chart dependencies
uses: ./.github/actions/override-chart-deps
if: ${{ inputs.overrideDeps != '[]' }}
with:
chart: ${{ matrix.chart }}
overrides: ${{ inputs.overrideDeps }}
- name: Dereference JSON schema before packaging
- name: Dereference JSON schema
uses: bjw-s/helm-charts-actions/dereference-json-schema@main
with:
schemaFile: "charts/${{ matrix.chart }}/values.schema.json"

View file

@ -8,12 +8,13 @@ on:
push:
branches:
- main
- rework-publishing-ci # TODO: Remove this
paths:
- "charts/**"
jobs:
prepare-release:
name: Prepare data required for release
prepare:
name: Prepare data required for workflow
runs-on: ubuntu-22.04
outputs:
repoConfiguration: ${{ steps.repo-config.outputs.config }}
@ -56,8 +57,8 @@ jobs:
release-library-charts:
name: Release library charts
needs:
- prepare-release
if: ${{ needs.prepare-release.outputs.libraryChartsToRelease != '[]' }}
- prepare
if: ${{ needs.prepare.outputs.libraryChartsToRelease != '[]' }}
uses: ./.github/workflows/charts-release-steps.yaml
permissions:
pages: write
@ -65,17 +66,17 @@ jobs:
contents: write
packages: write
with:
charts: ${{ needs.prepare-release.outputs.libraryChartsToRelease }}
excludedChartsRelease: ${{ toJSON(fromJSON(needs.prepare-release.outputs.repoConfiguration).excluded-charts-release) }}
charts: ${{ needs.prepare.outputs.libraryChartsToRelease }}
excludedChartsRelease: ${{ toJSON(fromJSON(needs.prepare.outputs.repoConfiguration).excluded-charts-release) }}
ghPagesBranch: gh-pages
publishToOciRegistry: false
release-other-charts:
name: Release other charts
needs:
- prepare-release
- prepare
- release-library-charts
if: ${{ needs.prepare-release.outputs.applicationChartsToRelease != '[]' }}
if: ${{ needs.prepare.outputs.applicationChartsToRelease != '[]' }}
uses: ./.github/workflows/charts-release-steps.yaml
permissions:
pages: write
@ -83,6 +84,6 @@ jobs:
contents: write
packages: write
with:
charts: ${{ needs.prepare-release.outputs.applicationChartsToRelease }}
excludedChartsRelease: ${{ toJSON(fromJSON(needs.prepare-release.outputs.repoConfiguration).excluded-charts-release) }}
charts: ${{ needs.prepare.outputs.applicationChartsToRelease }}
excludedChartsRelease: ${{ toJSON(fromJSON(needs.prepare.outputs.repoConfiguration).excluded-charts-release) }}
ghPagesBranch: gh-pages

View file

@ -3,55 +3,56 @@ name: "Charts: Test"
on:
workflow_call:
inputs:
checkoutCommit:
required: true
type: string
chartsToTest:
charts:
description: >
A JSON encoded array of charts to lint
type: string
required: true
overrideDeps:
description: >
A JSON encoded array of dependencies to override before testing
type: string
required: false
Json encoded list of Helm charts to release.
Defaults to releasing everything.
default: "[]"
env:
HELM_VERSION: 3.11.2
required: true
type: string
helmVersion:
description: >
Helm version to use.
default: "3.11.2"
required: false
type: string
jobs:
install-chart:
name: Install chart
runs-on: ubuntu-22.04
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
if: ${{ inputs.charts != '[]' && inputs.charts != '' }}
strategy:
matrix:
chart: ${{ fromJSON(inputs.chartsToTest) }}
chart: ${{ fromJSON(inputs.charts) }}
k8s_version:
[
"v1.26.15",
"v1.27.13",
"v1.28.9",
"v1.29.4",
"v1.30.0",
"v1.29.13",
"v1.30.9",
"v1.31.5",
"v1.32.1",
]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Validate prerequisite folders
working-directory: "charts/${{ matrix.chart }}"
run: |
CHART_TYPE=$(yq '.type // "application"' Chart.yaml)
if [[ ("${CHART_TYPE}" == "library") && (! -d "test-chart") ]]; then
echo "Library charts require a \"test-chart\" directory to run tests"
exit 1
fi
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.11.1
uses: yokawasa/action-setup-kube-tools@v0.11.2
with:
setup-tools: |
helmv3
kubectl
helm: "${{ env.HELM_VERSION }}"
helm: "${{ inputs.helmVersion }}"
kubectl: "${{ matrix.k8s_version }}"
- uses: actions/setup-python@v5
@ -70,17 +71,20 @@ jobs:
run: |
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true
- name: Override chart dependencies
uses: ./.github/actions/override-chart-deps
if: ${{ inputs.overrideDeps != '[]' }}
- name: Dereference JSON schema
uses: bjw-s/helm-charts-actions/dereference-json-schema@main
with:
chart: ${{ matrix.chart }}
overrides: ${{ inputs.overrideDeps }}
schemaFile: "charts/${{ matrix.chart }}/values.schema.json"
outputFile: "charts/${{ matrix.chart }}/values.schema.json"
allowFileNotFound: true
- name: Run chart-testing (install)
working-directory: "charts/${{ matrix.chart }}"
# TODO: Awaiting https://github.com/actions/checkout/issues/1607
run: |
if [ -d "test-chart" ]; then
cd "test-chart"
fi
ct install --config "$GITHUB_WORKSPACE/.ci/ct/ct.yaml" --charts .
install_success:
@ -106,38 +110,53 @@ jobs:
unittest-chart:
name: Unit-test chart
runs-on: ubuntu-22.04
if: ${{ inputs.chartsToTest != '[]' && inputs.chartsToTest != '' }}
if: ${{ inputs.charts != '[]' && inputs.charts != '' }}
strategy:
matrix:
chart: ${{ fromJSON(inputs.chartsToTest) }}
chart: ${{ fromJSON(inputs.charts) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.checkoutCommit }}
- name: Validate prerequisite folders
working-directory: "charts/${{ matrix.chart }}"
run: |
CHART_TYPE=$(yq '.type // "application"' Chart.yaml)
if [[ ("${CHART_TYPE}" == "library") && (! -d "test-chart") ]]; then
echo "Library charts require a \"test-chart\" directory to run tests"
exit 1
fi
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.11.1
uses: yokawasa/action-setup-kube-tools@v0.11.2
with:
setup-tools: |
helmv3
helm: "${{ env.HELM_VERSION }}"
helm: "${{ inputs.helmVersion }}"
- name: Override chart dependencies
uses: ./.github/actions/override-chart-deps
if: ${{ inputs.overrideDeps != '[]' }}
- name: Dereference JSON schema
uses: bjw-s/helm-charts-actions/dereference-json-schema@main
with:
chart: ${{ matrix.chart }}
overrides: ${{ inputs.overrideDeps }}
schemaFile: "charts/${{ matrix.chart }}/values.schema.json"
outputFile: "charts/${{ matrix.chart }}/values.schema.json"
allowFileNotFound: true
- name: Run tests
working-directory: "charts/${{ matrix.chart }}"
run: |
if [[ -d "test-chart" ]]; then
cd "test-chart"
fi
if [[ ! -d "unittests" ]]; then
echo "No unit tests found for chart ${{ matrix.chart }}"
exit 0
fi
helm plugin install https://github.com/helm-unittest/helm-unittest.git
helm dep update
helm unittest -f "tests/**/*_test.yaml" .
helm unittest -f "unittests/**/*_test.yaml" .
unittest_success:
needs:

View file

@ -13,35 +13,85 @@ concurrency:
cancel-in-progress: true
jobs:
pr-metadata:
uses: ./.github/workflows/pr-metadata.yaml
prepare:
name: Prepare data required for workflow
runs-on: ubuntu-22.04
outputs:
repoConfiguration: ${{ steps.repo-config.outputs.config }}
addedOrModifiedFiles: ${{ steps.added-modified-files.outputs.all_changed_files }}
chartsToLint: ${{ steps.charts-to-lint.outputs.filteredCharts }}
chartsToInstall: ${{ steps.charts-to-install.outputs.filteredCharts }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Grab repository configuration
id: repo-config
shell: bash
run: |
echo "config=$(yq '.' '.ci/repo-config.yaml' -o json -I=0)" >> "$GITHUB_OUTPUT"
- name: Get all added or modified files
id: added-modified-files
uses: tj-actions/changed-files@v45
- name: Get changed charts
id: changed-charts
uses: tj-actions/changed-files@v45
with:
matrix: true
path: charts
dir_names: true
dir_names_max_depth: 2
- name: Determine charts to lint
id: charts-to-lint
uses: actions/github-script@v7
with:
script: |
var changedCharts = ${{ steps.changed-charts.outputs.all_changed_files }};
var chartsToFilter = ${{ toJSON(fromJSON(steps.repo-config.outputs.config).excluded-charts-lint) }};
let filteredCharts = changedCharts.filter(item => chartsToFilter.indexOf(item) < 0);
core.setOutput("filteredCharts", filteredCharts);
- name: Determine charts to install
id: charts-to-install
uses: actions/github-script@v7
with:
script: |
var changedCharts = ${{ steps.changed-charts.outputs.all_changed_files }};
var chartsToFilter = ${{ toJSON(fromJSON(steps.repo-config.outputs.config).excluded-charts-install) }};
let filteredCharts = changedCharts.filter(item => chartsToFilter.indexOf(item) < 0);
core.setOutput("filteredCharts", filteredCharts);
pre-commit-check:
uses: ./.github/workflows/pre-commit-check.yaml
name: Perform Pre-Commit check
runs-on: ubuntu-22.04
needs:
- pr-metadata
with:
modifiedFiles: ${{ needs.pr-metadata.outputs.addedOrModifiedFiles }}
- prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run against changes
uses: pre-commit/action@v3.0.1
with:
extra_args: --files ${{ needs.prepare.outputs.addedOrModifiedFiles }} --config .ci/pre-commit/config.yaml
charts-lint:
name: Lint charts
uses: ./.github/workflows/charts-lint.yaml
needs:
- pr-metadata
- prepare
with:
checkoutCommit: ${{ github.sha }}
chartsToLint: ${{ needs.pr-metadata.outputs.chartsToLint }}
isRenovatePR: ${{ needs.pr-metadata.outputs.isRenovatePR }}
charts: ${{ needs.prepare.outputs.chartsToLint }}
charts-test:
name: Test charts
uses: ./.github/workflows/charts-test.yaml
needs:
- pr-metadata
- prepare
with:
checkoutCommit: ${{ github.sha }}
chartsToTest: |-
${{
(
(needs.pr-metadata.outputs.commonLibraryUpdated=='true') &&
'["library/common-test"]'
) || needs.pr-metadata.outputs.chartsToInstall
}}
charts: ${{ needs.prepare.outputs.chartsToInstall }}

View file

@ -1,23 +0,0 @@
name: "Pre-commit consistency check"
on:
workflow_call:
inputs:
modifiedFiles:
description: >
A JSON encoded array of files to check
required: true
type: string
jobs:
pre-commit-check:
name: Run pre-commit checks
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run against changes
uses: pre-commit/action@v3.0.1
with:
extra_args: --files ${{ join(fromJson(inputs.modifiedFiles), ' ') }} --config .ci/pre-commit/config.yaml