seperate test and release workflows for apps

This commit is contained in:
kjeld Schouten-Lebbing 2021-07-01 11:14:51 +02:00
parent d587ae9b09
commit 8eb0eed132
No known key found for this signature in database
GPG Key ID: 4CDAD4A532BC1EDB
2 changed files with 168 additions and 101 deletions

163
.github/workflows/apps.release.yaml vendored Normal file
View File

@ -0,0 +1,163 @@
name: "Apps: Release"
on:
push:
branches:
- 'master'
tags-ignore:
- '**'
paths:
- 'charts/**/chart.yaml'
- 'charts/**/Chart.yaml'
- '.github/workflows/apps.yaml'
- '.github/ct-install.yaml'
- '.github/ct-lint.yaml'
- '.github/cr.yaml'
jobs:
catalog-release:
runs-on: ubuntu-latest
needs: pre-release
container:
image: ixsystems/catalog_validation:latest
steps:
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
with:
continue-after-seconds: 180
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- uses: actions/checkout@v2
name: Checkout
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.5.3
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
path: master
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
- name: Remove if release already exists
run: |
for train in stable incubator develop non-free deprecated
do
for chart in master/charts/${train}/*; do
if [ -d "${chart}/SCALE" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "Processing... cleanup-existing... Chart: ${chartname} - Version: ${maxchartversion}"
rm -Rf catalog/${train}/${chartname}/${maxchartversion} || echo "Chart release ${chartname} with version ${maxchartversion} does not exist yet... Skipping..."
rm -Rf catalog/${train}/${chartname}/item.yaml || echo "No old catalog item.yaml found for ${chartname}"
else
echo "Skipping chart ${chart}, no correct SCALE compatibility layer detected"
fi
done
done
- name: fetch dependencies
run: |
for train in stable incubator develop non-free deprecated
do
for chart in master/charts/${train}/*; do
if [ -d "${chart}" ]; then
cd ${chart}
helm dependency update
cd -
fi
done
done
- name: Apply SCALE Patches
run: |
for train in stable incubator develop non-free deprecated
do
for chart in master/charts/${train}/*; do
if [ -d "${chart}/SCALE" ]; then
chartname=$(basename ${chart})
echo "Processing... Applying SCALE patch... Chart: ${chartname} - Version: ${maxfolderversion}"
mv ${chart}/SCALE/item.yaml ${chart}/
mv ${chart}/SCALE/ix_values.yaml ${chart}/
mv ${chart}/SCALE/questions.yaml ${chart}/
cp -rf ${chart}/SCALE/templates/* ${chart}/templates || echo "ignoring templates directory..."
rm -rf ${chart}/SCALE
mv ${chart}/values.yaml ${chart}/test_values.yaml
touch ${chart}/values.yaml
description=$(cat ${chart}/Chart.yaml | grep "^description: " | sed -r 's/^description: //')
echo "${description}" >> ${chart}/app-readme.md
else
echo "Skipping chart ${chart}, no correct SCALE compatibility layer detected"
fi
done
done
- name: Add Chart release
run: |
for train in stable incubator develop non-free deprecated
do
for chart in master/charts/${train}/*; do
if [ -f "${chart}/item.yaml" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "Processing... Copying charts... Chart: ${chartname} - Version: ${maxchartversion}"
mkdir -p catalog/${train}/${chartname}/${maxchartversion}
cp -Rf ${chart}/* catalog/${train}/${chartname}/${maxchartversion}/
mv catalog/${train}/${chartname}/${maxchartversion}/item.yaml catalog/${train}/${chartname}/item.yaml
else
echo "Skipping, chart ${chart} does not contain SCALE compatibility layer..."
fi
done
done
- name: Validate catalog format
run: |
cd catalog
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
- name: Commit and Push new App releases
if: ${{ needs.pre-release.outputs.release == 'true' }}
run: |
cd catalog
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Commit new App releases for TrueCharts" || exit 0
git push
helm-release:
needs: pre-release
runs-on: ubuntu-latest
steps:
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
with:
continue-after-seconds: 180
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
- name: Configure Git
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.5.3
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
with:
config: .github/cr.yaml
charts_dir: charts/*
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"

View File

@ -1,18 +1,6 @@
name: "Apps: Test & Release"
on:
push:
branches:
- 'master'
tags-ignore:
- '**'
paths:
- 'charts/**/chart.yaml'
- 'charts/**/Chart.yaml'
- '.github/workflows/apps.yaml'
- '.github/ct-install.yaml'
- '.github/ct-lint.yaml'
- '.github/cr.yaml'
pull_request:
branches:
- '**'
@ -23,7 +11,6 @@ on:
- '.github/workflows/apps.yaml'
- '.github/ct-install.yaml'
- '.github/ct-lint.yaml'
- '.github/cr.yaml'
jobs:
changes:
@ -198,36 +185,15 @@ jobs:
- name: complete message
run: echo "App Tests Completed Successfully"
pre-release:
needs: [app-tests]
catalog-test:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.prep.outputs.release }}
timeout-minutes: 5
steps:
- name: Prepare
id: prep
run: |
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=release::false
else
echo ::set-output name=release::true
fi
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
if: steps.prep.outputs.release == 'true'
with:
continue-after-seconds: 180
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
catalog-release:
runs-on: ubuntu-latest
needs: pre-release
container:
image: ixsystems/catalog_validation:latest
steps:
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
with:
continue-after-seconds: 180
- uses: actions/checkout@v2
name: Checkout
- name: Install Helm
@ -235,28 +201,11 @@ jobs:
with:
version: v3.5.3
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'true' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
path: master
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'true' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'false' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
path: master
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'false' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
@ -333,48 +282,3 @@ jobs:
run: |
cd catalog
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
- name: Commit and Push new App releases
if: ${{ needs.pre-release.outputs.release == 'true' }}
run: |
cd catalog
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Commit new App releases for TrueCharts" || exit 0
git push
helm-release:
needs: pre-release
runs-on: ubuntu-latest
if: needs.pre-release.outputs.release == 'true'
steps:
- name: Block concurrent jobs
uses: softprops/turnstyle@v1
with:
continue-after-seconds: 180
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
- name: Configure Git
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.5.3
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.2.1
with:
config: .github/cr.yaml
charts_dir: charts/*
env:
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"