tweak a new release system

This commit is contained in:
kjeld Schouten-Lebbing
2022-03-30 12:26:37 +02:00
parent e0ef82eb53
commit a24a4d76c9
6 changed files with 174 additions and 111 deletions
-59
View File
@@ -1,59 +0,0 @@
name: "Apps: Release"
on:
push:
branches:
- 'master'
tags-ignore:
- '**'
jobs:
release:
runs-on: ubuntu-latest
concurrency: gitpush
container:
image: ghcr.io/truecharts/devcontainer:v2.2.1@sha256:4ace13c049bf00f85c63e0070f86b71656a7c3b2113aa3e21c3107f3d1f7bf87
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
name: Checkout
with:
fetch-depth: 100
token: ${{ secrets.BOT_TOKEN }}
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
name: Checkout
with:
fetch-depth: 1
ref: gh-pages
token: ${{ secrets.BOT_TOKEN }}
path: .cr-index
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
fetch-depth: 1
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
fetch-depth: 1
repository: truecharts/dh_catalog
token: ${{ secrets.BOT_TOKEN }}
path: dh_catalog
- name: build-and-run
run: |
tools/build-release.sh -p --config .github/cr.yaml --skip-existing
env:
CR_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Commit and Push new docs
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Commit released Helm Chart and docs for TrueCharts" || exit 0
git push
-43
View File
@@ -1,43 +0,0 @@
name: "Apps: release-test"
on:
pull_request:
branches:
- '**'
tags-ignore:
- '**'
paths:
- 'charts/**'
- '.github/workflows/apps.test.yaml'
- '.github/ct-install.yaml'
- '.github/ct-lint.yaml'
jobs:
release-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/truecharts/devcontainer:v2.2.1@sha256:4ace13c049bf00f85c63e0070f86b71656a7c3b2113aa3e21c3107f3d1f7bf87
steps:
- name: Cache helm repo cache
id: cache
uses: actions/cache@4b0cf6cc4619e737324ddfcec08fff2413359514 # tag=v3
with:
key: helmrepocache-${{ github.sha }}
path: |
~/.cache/helm/repository
~/.config/helm/repositories.yaml
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
name: Checkout
with:
fetch-depth: 100
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
repository: truecharts/catalog
path: catalog
- name: build-and-run
run: |
tools/build-release.sh --config .github/cr.yaml
+33
View File
@@ -0,0 +1,33 @@
name: "SCALE: catalog-tests"
on:
workflow_call:
inputs:
checkoutCommit:
required: true
type: string
chartChangesDetected:
required: true
type: string
jobs:
release-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/truecharts/devcontainer:v2.2.1@sha256:4ace13c049bf00f85c63e0070f86b71656a7c3b2113aa3e21c3107f3d1f7bf87
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
name: Checkout
with:
fetch-depth: 100
ref: ${{ inputs.checkoutCommit }}
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
repository: truecharts/catalog
path: catalog
- name: build-and-run
run: |
tools/build-release.sh
+117
View File
@@ -0,0 +1,117 @@
name: "Charts: Release"
concurrency: helm-release
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "charts/**"
jobs:
release:
runs-on: ubuntu-latest
container:
image: ghcr.io/truecharts/devcontainer:v2.2.1@sha256:4ace13c049bf00f85c63e0070f86b71656a7c3b2113aa3e21c3107f3d1f7bf87
concurrency: gitpush
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
fetch-depth: 0
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
fetch-depth: 1
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
- name: Checkout
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # tag=v3
with:
fetch-depth: 1
repository: truecharts/dh_catalog
token: ${{ secrets.BOT_TOKEN }}
path: dh_catalog
- name: Install Kubernetes tools
uses: yokawasa/action-setup-kube-tools@v0.8.0
with:
setup-tools: |
helmv3
yq
helm: "3.8.0"
yq: "4.16.2"
- name: Install helm-docs
run: |
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: Collect changes
id: collect-changes
uses: ./.github/actions/collect-changes
- name: Generate README for changed charts
run: |
chart_runner(){
IFS='/' read -r -a chart_parts <<< "${1}"
if [ -f "charts/${chart_parts[0]}"/"${chart_parts[1]}/Chart.yaml" ]; then
./.github/scripts/gen-helm-docs.sh "${chart_parts[0]}" "${chart_parts[1]}"
fi
}
export -f chart_runner
CHARTS=(${{ steps.collect-changes.outputs.addedOrModifiedCharts }})
parallel -j 8 chart_runner '2>&1' ::: ${CHARTS[@]}
- name: build catalogs and docs
if: |
steps.collect-changes.outputs.changesDetected == 'true'
run: |
tools/build-release.sh -p
- name: Create commit
id: create-commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: charts/**/
commit_message: "chore: Auto-update chart README [skip ci]"
commit_user_name: truecharts-bot
commit_user_email: bot@truecharts.org
commit_author: truecharts-bot <bot@truecharts.org>
- name: Save commit hash
id: save-commit-hash
run: |
if [ "${{ steps.create-commit.outputs.changes_detected || 'unknown' }}" == "true" ]; then
echo '::set-output name=commit_hash::${{ steps.create-commit.outputs.commit_hash }}'
else
echo "::set-output name=commit_hash::${GITHUB_SHA}"
fi
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: ${{ steps.save-commit-hash.outputs.commit_hash }}
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "truecharts-bot"
git config user.email "bot@truecharts.org"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.3.0
with:
charts_dir: charts/*
charts_repo_url: https://charts.truecharts.org
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
CR_SKIP_EXISTING: "true"
+11
View File
@@ -45,3 +45,14 @@ jobs:
with:
checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }}
chartChangesDetected: ${{ needs.pr-metadata.outputs.addedOrModified }}
catalog-test:
uses: ./.github/workflows/catalog-test.yaml
needs:
- pr-metadata
# - charts-changelog
- charts-lint
- charts-test
with:
checkoutCommit: ${{ needs.charts-changelog.outputs.commitHash }}
chartChangesDetected: ${{ needs.pr-metadata.outputs.addedOrModified }}
+13 -9
View File
@@ -52,7 +52,7 @@ main() {
copy_general_docs
if [[ -n "${changed_charts[*]}" ]]; then
rm -rf .cr-release-packages
rm -rf .cr-release-packages
mkdir -p .cr-release-packages
prep_helm
@@ -62,9 +62,9 @@ main() {
pre_commit
if [ "${production}" == "true" ]; then
gen_dh_cat
release_charts
update_index
upload_index
#release_charts
#update_index
#upload_index
fi
validate_catalog
if [ "${production}" == "true" ]; then
@@ -86,14 +86,18 @@ chart_runner(){
train=$(basename $(dirname "${1}"))
SCALESUPPORT=$(cat ${1}/Chart.yaml | yq '.annotations."truecharts.org/SCALE-support"' -r)
helm dependency update "${1}" --skip-refresh || (sleep 10 && helm dependency update "${1}" --skip-refresh) || (sleep 10 && helm dependency update "${1}" --skip-refresh)
helm_sec_scan "${1}" "${chartname}" "$train" "${chartversion}" || echo "helm-chart security-scan failed..."
container_sec_scan "${1}" "${chartname}" "$train" "${chartversion}" || echo "container security-scan failed..."
sec_scan_cleanup "${1}" "${chartname}" "$train" "${chartversion}" || echo "security-scan cleanup failed..."
if [ "${production}" == "true" ]; then
helm_sec_scan "${1}" "${chartname}" "$train" "${chartversion}" || echo "helm-chart security-scan failed..."
container_sec_scan "${1}" "${chartname}" "$train" "${chartversion}" || echo "container security-scan failed..."
sec_scan_cleanup "${1}" "${chartname}" "$train" "${chartversion}" || echo "security-scan cleanup failed..."
fi
sync_tag "${1}" "${chartname}" "$train" "${chartversion}" || echo "Tag sync failed..."
if [ "${production}" == "true" ]; then
create_changelog "${1}" "${chartname}" "$train" "${chartversion}" || echo "changelog generation failed..."
generate_docs "${1}" "${chartname}" "$train" "${chartversion}" || echo "Docs generation failed..."
copy_docs "${1}" "${chartname}" "$train" "${chartversion}" || echo "Docs Copy failed..."
package_chart "${1}"
#copy_docs "${1}" "${chartname}" "$train" "${chartversion}" || echo "Docs Copy failed..."
#package_chart "${1}"
fi
if [[ "${SCALESUPPORT}" == "true" ]]; then
clean_apps "${1}" "${chartname}" "$train" "${chartversion}"
copy_apps "${1}" "${chartname}" "$train" "${chartversion}"