From 8003e17a761e06a3ddf3dcd97583a77cae719ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=B4=87=CA=80=C9=B4=E1=B4=85=20S=E1=B4=84=CA=9C?= =?UTF-8?q?=E1=B4=8F=CA=80=C9=A2=E1=B4=87=CA=80s?= Date: Thu, 3 Feb 2022 19:59:23 +0100 Subject: [PATCH] ci: Restructure PR validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs --- .github/ct-lint.yaml | 2 - .../scripts}/check-releasenotes.sh | 0 {hack => .github/scripts}/gen-helm-docs.sh | 0 .../scripts}/renovate-releasenotes.sh | 0 .github/workflows/charts-update-readme.yaml | 51 +++++++++++++------ 5 files changed, 36 insertions(+), 17 deletions(-) rename {hack => .github/scripts}/check-releasenotes.sh (100%) rename {hack => .github/scripts}/gen-helm-docs.sh (100%) rename {hack => .github/scripts}/renovate-releasenotes.sh (100%) diff --git a/.github/ct-lint.yaml b/.github/ct-lint.yaml index 9e8051d5..d096911c 100644 --- a/.github/ct-lint.yaml +++ b/.github/ct-lint.yaml @@ -10,5 +10,3 @@ chart-repos: - k8s-at-home-libraries=https://library-charts.k8s-at-home.com - k8s-at-home=https://k8s-at-home.com/charts - jetstack=https://charts.jetstack.io -additional-commands: -- ./hack/check-releasenotes.sh {{ .Path }} diff --git a/hack/check-releasenotes.sh b/.github/scripts/check-releasenotes.sh similarity index 100% rename from hack/check-releasenotes.sh rename to .github/scripts/check-releasenotes.sh diff --git a/hack/gen-helm-docs.sh b/.github/scripts/gen-helm-docs.sh similarity index 100% rename from hack/gen-helm-docs.sh rename to .github/scripts/gen-helm-docs.sh diff --git a/hack/renovate-releasenotes.sh b/.github/scripts/renovate-releasenotes.sh similarity index 100% rename from hack/renovate-releasenotes.sh rename to .github/scripts/renovate-releasenotes.sh diff --git a/.github/workflows/charts-update-readme.yaml b/.github/workflows/charts-update-readme.yaml index 48e3d91c..51618934 100644 --- a/.github/workflows/charts-update-readme.yaml +++ b/.github/workflows/charts-update-readme.yaml @@ -11,13 +11,36 @@ on: type: string outputs: commitHash: - description: "The commit hash to use in later jobs" + description: "The commit hash from the README.md upate" value: ${{ jobs.generate-readme.outputs.commitHash }} jobs: + validate-chart: + name: Validate chart.yaml + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Check changelog annotations + if: inputs.isRenovatePR != 'true' + run: | + CHARTS=(${{ inputs.modifiedCharts }}) + for i in "${CHARTS[@]}" + do + printf "Checking release notes for chart %s\n" "${i}" + IFS='/' read -r -a chart_parts <<< "$i" + ./.github/scripts/check-releasenotes.sh "charts/${chart_parts[0]}/${chart_parts[1]}" + echo "" + done + generate-readme: name: Generate chart README files runs-on: ubuntu-latest + needs: + - validate-chart outputs: commitHash: ${{ steps.store-commit-hash.outputs.commit_hash }} steps: @@ -38,18 +61,17 @@ jobs: wget -O /tmp/helm-docs.deb https://github.com/k8s-at-home/helm-docs/releases/download/v0.1.1/helm-docs_0.1.1_Linux_x86_64.deb sudo dpkg -i /tmp/helm-docs.deb - # - name: Annotate Charts.yaml for Renovate PR's - # run: | - # export DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}') - # CHARTS=(${{ inputs.modifiedCharts }}) - # for i in "${CHARTS[@]}" - # do - # IFS='/' read -r -a chart_parts <<< "$i" - # if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then - # ./hack/renovate-releasenotes.sh "charts/${chart_parts[0]}"/"${chart_parts[1]}" - # fi - # echo "" - # done + - name: Annotate Charts.yaml for Renovate PR's + if: inputs.isRenovatePR == 'true' + run: | + export DEFAULT_BRANCH=$(git remote show origin | awk '/HEAD branch/ {print $NF}') + CHARTS=(${{ inputs.modifiedCharts }}) + for i in "${CHARTS[@]}" + do + IFS='/' read -r -a chart_parts <<< "$i" + ./.github/scripts/renovate-releasenotes.sh "charts/${chart_parts[0]}/${chart_parts[1]}" + echo "" + done - name: Generate README for changed charts run: | @@ -57,10 +79,9 @@ jobs: for i in "${CHARTS[@]}" do printf "Rendering README for chart %s\n" "${i}" - echo " ${i}" IFS='/' read -r -a chart_parts <<< "$i" if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then - ./hack/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}" + ./.github/scripts/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}" fi echo "" done