From b93c4199f7098ba640da0f232c28620aeb6276f5 Mon Sep 17 00:00:00 2001 From: Bernd Schorgers Date: Tue, 11 Feb 2025 15:05:55 +0100 Subject: [PATCH] feat(app-template): Release version 3.7.1 --- .../charts-release-ghpages/action.yaml | 41 +++++++++---------- .github/workflows/charts-release-steps.yaml | 30 ++++++++++++++ .github/workflows/charts-release.yaml | 10 ++++- charts/library/common/.helmignore | 2 +- charts/other/app-template/.helmignore | 8 +++- charts/other/app-template/Chart.yaml | 10 +++-- charts/other/app-template/README.md | 4 +- .../schemas/helmrelease-helm-v2.schema.json | 2 +- .../helmrelease-helm-v2beta2.schema.json | 2 +- charts/other/app-template/values.schema.json | 2 +- 10 files changed, 77 insertions(+), 34 deletions(-) diff --git a/.github/actions/charts-release-ghpages/action.yaml b/.github/actions/charts-release-ghpages/action.yaml index eec10780..86267d11 100644 --- a/.github/actions/charts-release-ghpages/action.yaml +++ b/.github/actions/charts-release-ghpages/action.yaml @@ -33,27 +33,27 @@ runs: pattern: ${{ inputs.artifactPrefix }}${{ inputs.artifactPattern }} - name: Copy artifacts to gh-pages structure - shell: bash - working-directory: artifacts - env: - ARTIFACT_PREFIX: ${{ inputs.artifactPrefix }} - TARGET_FOLDER: ${{ inputs.targetFolder }} - run: | - while IFS= read -d $'\0' -r ARTIFACT ; do - echo ${ARTIFACT} - prefix_removed_chart=${ARTIFACT/#$ARTIFACT_PREFIX} - DELIMITER='__' - s=${prefix_removed_chart}${DELIMITER} - ARTIFACT_PATH_PARTS=(); - while [[ $s ]]; do - ARTIFACT_PATH_PARTS+=( "${s%%"${DELIMITER}"*}" ); - s=${s#*"${DELIMITER}"}; - done; + uses: actions/github-script@v7 + with: + script: | + const dstFolder = "${{ inputs.targetFolder }}"; + const artifactPrefix = "${{ inputs.artifactPrefix }}"; - CHART_FOLDER=${ARTIFACT_PATH_PARTS[0]} - mkdir -p "${TARGET_FOLDER}/${CHART_FOLDER}" - cp ${ARTIFACT}/* ${TARGET_FOLDER}/${CHART_FOLDER}/ - done < <(find . -mindepth 1 -maxdepth 1 -type d -print0) + baseDir = process.cwd(); + artifactsDir = `${baseDir}/artifacts`; + + const globber = await glob.create(`${artifactsDir}/${artifactPrefix}*/*.tgz`); + for await (const file of globber.globGenerator()) { + relativePath = file.startsWith(artifactsDir) ? file.slice(artifactsDir.length) : file; + artifactFolder = relativePath.split('/')[1]; + artifactFolderStrippedPrefix = artifactFolder.startsWith(artifactPrefix) ? artifactFolder.slice(artifactPrefix.length) : artifactFolder; + chartType = artifactFolderStrippedPrefix.split('__')[0]; + targetFolder = `${baseDir}/${dstFolder}/${chartType}`; + + console.log(`Copying ${file} to ${targetFolder}/`); + await io.mkdirP(targetFolder); + await io.cp(file, `${targetFolder}/`); + } - name: Update chart index shell: bash @@ -67,4 +67,3 @@ runs: repository: ${{ inputs.targetFolder }} branch: ${{ inputs.targetBranch }} file_pattern: "index.yaml **/*.tgz" - disable_globbing: true diff --git a/.github/workflows/charts-release-steps.yaml b/.github/workflows/charts-release-steps.yaml index ba20f1be..d6e6c2d6 100644 --- a/.github/workflows/charts-release-steps.yaml +++ b/.github/workflows/charts-release-steps.yaml @@ -73,6 +73,36 @@ jobs: artifactPrefix: chart__ helmVersion: ${{ inputs.helmVersion }} + tag-charts: + name: Tag charts + runs-on: ubuntu-22.04 + needs: + - package-charts + strategy: + matrix: + charts: ${{ fromJSON(inputs.charts) }} + fail-fast: false + steps: + - name: Checkout source branch + if: ${{ !contains(fromJSON(inputs.excludedChartsRelease), matrix.charts) }} + uses: actions/checkout@v4 + + - name: Grab chart details + id: chart-details + shell: bash + env: + ROOT_DIR: charts + CHART_DIR: "${{ matrix.charts }}" + run: | + PARENT_DIR=$(basename $(dirname "${ROOT_DIR}/${CHART_DIR}")) + echo "name=$(yq '.name' ${ROOT_DIR}/${CHART_DIR}/Chart.yaml)" >> "$GITHUB_OUTPUT" + echo "version=$(yq '.version' ${ROOT_DIR}/${CHART_DIR}/Chart.yaml)" >> "$GITHUB_OUTPUT" + + - name: Create tag + uses: EndBug/latest-tag@latest + with: + ref: ${{ steps.chart-details.outputs.name }}-${{ steps.chart-details.outputs.version }} + release-charts-to-github-pages: name: Release charts to GitHub Pages runs-on: ubuntu-22.04 diff --git a/.github/workflows/charts-release.yaml b/.github/workflows/charts-release.yaml index 5e3ec505..1be7bf88 100644 --- a/.github/workflows/charts-release.yaml +++ b/.github/workflows/charts-release.yaml @@ -8,7 +8,6 @@ on: push: branches: - main - - rework-publishing-ci # TODO: Remove this paths: - "charts/**" @@ -76,7 +75,14 @@ jobs: needs: - prepare - release-library-charts - if: ${{ needs.prepare.outputs.applicationChartsToRelease != '[]' }} + if: >- + ${{ + always() && + needs.prepare.outputs.applicationChartsToRelease != '[]' && + ( + contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + ) + }} uses: ./.github/workflows/charts-release-steps.yaml permissions: pages: write diff --git a/charts/library/common/.helmignore b/charts/library/common/.helmignore index 8875311d..914d5456 100644 --- a/charts/library/common/.helmignore +++ b/charts/library/common/.helmignore @@ -29,5 +29,5 @@ OWNERS schemas/ # Test files -test/ +test-chart/ unittests/ diff --git a/charts/other/app-template/.helmignore b/charts/other/app-template/.helmignore index ab04375e..a22bbd20 100644 --- a/charts/other/app-template/.helmignore +++ b/charts/other/app-template/.helmignore @@ -26,5 +26,9 @@ OWNERS # helm-docs templates *.gotmpl -# helm unit tests -tests/ +# Schema files +schemas/ + +# Test files +test-chart/ +unittests/ diff --git a/charts/other/app-template/Chart.yaml b/charts/other/app-template/Chart.yaml index fa45f00c..972a89e5 100644 --- a/charts/other/app-template/Chart.yaml +++ b/charts/other/app-template/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: A common powered chart template. This can be useful for small projects that don't have their own chart. name: app-template -version: 3.7.0 +version: 3.7.1 kubeVersion: ">=1.22.0-0" maintainers: - name: bjw-s @@ -10,12 +10,16 @@ maintainers: dependencies: - name: common repository: https://bjw-s.github.io/helm-charts - version: 3.7.0 + version: 3.7.1 annotations: artifacthub.io/changes: |- + - kind: fixed + description: |- + Values schema is now dereferenced before packaging so it no longer relies on + internet connectivity to validate the schema. - kind: changed description: | - Updated library version to 3.7.0. + Updated library version to 3.7.1. links: - name: Upgrade instructions from v2.x url: https://bjw-s.github.io/helm-charts/docs/app-template/#from-2xx-to-30x diff --git a/charts/other/app-template/README.md b/charts/other/app-template/README.md index 083cf2db..9301550e 100644 --- a/charts/other/app-template/README.md +++ b/charts/other/app-template/README.md @@ -1,6 +1,6 @@ # app-template -![Version: 3.7.0](https://img.shields.io/badge/Version-3.7.0-informational?style=flat-square) +![Version: 3.7.1](https://img.shields.io/badge/Version-3.7.1-informational?style=flat-square) 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 | |------------|------|---------| -| https://bjw-s.github.io/helm-charts | common | 3.7.0 | +| https://bjw-s.github.io/helm-charts | common | 3.7.1 | ## Installing the Chart diff --git a/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json b/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json index b29a20fa..2faa89ae 100644 --- a/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json +++ b/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json @@ -726,7 +726,7 @@ "values": { "description": "Values holds the values for this Helm release.", "x-kubernetes-preserve-unknown-fields": true, - "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.0/charts/library/common/values.schema.json" + "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.1/charts/library/common/values.schema.json" }, "valuesFrom": { "description": "ValuesFrom holds references to resources containing Helm values for this HelmRelease,\nand information about how they should be merged.", diff --git a/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json b/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json index b798c398..2c21d8f7 100644 --- a/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json +++ b/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json @@ -727,7 +727,7 @@ "values": { "description": "Values holds the values for this Helm release.", "x-kubernetes-preserve-unknown-fields": true, - "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.0/charts/library/common/values.schema.json" + "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.1/charts/library/common/values.schema.json" }, "valuesFrom": { "description": "ValuesFrom holds references to resources containing Helm values for this HelmRelease, and information about how they should be merged.", diff --git a/charts/other/app-template/values.schema.json b/charts/other/app-template/values.schema.json index 8abba354..ada72e14 100644 --- a/charts/other/app-template/values.schema.json +++ b/charts/other/app-template/values.schema.json @@ -1,3 +1,3 @@ { - "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.0/charts/library/common/values.schema.json" + "$ref": "https://raw.githubusercontent.com/bjw-s/helm-charts/common-3.7.1/charts/library/common/values.schema.json" }