Add Chart Release System
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
name: "Charts: Tests"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
catalog-tests:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ixsystems/catalog_validation:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
name: Checkout
|
||||
- name: Validate catalog format
|
||||
run: |
|
||||
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
|
||||
|
||||
|
||||
common-lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.0
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Set up chart-testing
|
||||
uses: helm/chart-testing-action@v2.0.1
|
||||
- name: Run chart-testing (lint)
|
||||
id: lint
|
||||
run: ct lint --config .github/ct.yaml --charts 'library/common'
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.1.0
|
||||
|
||||
common-unittest:
|
||||
runs-on: ubuntu-latest
|
||||
needs: common-lint
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Dev tools
|
||||
run: sudo apt-get update && sudo apt-get install -y jq libjq-dev
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.0
|
||||
|
||||
- name: Install Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.7
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
|
||||
bundle install
|
||||
- name: Run tests
|
||||
run: |
|
||||
bundle exec m -r .test/charts
|
||||
|
||||
|
||||
chart-tests:
|
||||
needs: [common-lint, common-unittest, catalog-tests]
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Install Helm
|
||||
run: /bin/bash -c "curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fetch base branch history
|
||||
run: git fetch origin master:master
|
||||
|
||||
- name: Setup catalog validation
|
||||
run: |
|
||||
sudo apt update > /dev/null 2>&1
|
||||
sudo apt install -y python3-all-dev python3-pip python3-setuptools > /dev/null 2>&1
|
||||
git clone https://github.com/truenas/catalog_validation
|
||||
sudo pip3 install --disable-pip-version-check --exists-action w -r catalog_validation/requirements.txt > /dev/null 2>&1
|
||||
sudo pip3 install -U catalog_validation/.
|
||||
|
||||
- name: Validate changed charts
|
||||
run: /bin/bash -c "PWD=${pwd}; sudo /usr/local/bin/charts_validate deploy --path $PWD"
|
||||
@@ -0,0 +1,133 @@
|
||||
name: "Charts: Release"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags-ignore:
|
||||
- '**'
|
||||
paths:
|
||||
- 'charts/**'
|
||||
- '!charts/**/README.md'
|
||||
- 'library/**'
|
||||
- '!library/**/README.md'
|
||||
|
||||
jobs:
|
||||
copy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout-Master
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: 'master'
|
||||
path: 'master'
|
||||
- name: Checkout-Charts
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: 'charts'
|
||||
path: 'charts'
|
||||
|
||||
- name: Generate Helm Structure
|
||||
run: |
|
||||
cd master
|
||||
rm -Rf ../charts/charts/*
|
||||
for chart in charts/*; do
|
||||
if [ -d "${chart}" ]; then
|
||||
maxversion=$(ls -l ${chart} | grep ^d | awk '{print $9}' | tail -n 1)
|
||||
chartname=$(basename ${chart})
|
||||
echo "Processing ${chart} version ${maxversion}"
|
||||
mv ${chart}/${maxversion} ../charts/charts/${chartname}
|
||||
fi
|
||||
done
|
||||
mv library/* ../charts/charts/
|
||||
ls ../charts/charts/
|
||||
cd ..
|
||||
|
||||
- name: Commit and push updated charts
|
||||
run: |
|
||||
cd charts
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git add --all
|
||||
git commit -sm "Publish Chart updates" || exit 0
|
||||
git push
|
||||
|
||||
pre-release:
|
||||
needs: copy
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Block concurrent jobs
|
||||
uses: softprops/turnstyle@v1
|
||||
with:
|
||||
continue-after-seconds: 180
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
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.GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: 'charts'
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.0
|
||||
|
||||
- name: Run chart-releaser
|
||||
uses: helm/chart-releaser-action@v1.1.0
|
||||
with:
|
||||
charts_repo_url: https://charts.truecharts.org/
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
# Update the generated timestamp in the index.yaml
|
||||
# needed until https://github.com/helm/chart-releaser/issues/90
|
||||
# or helm/chart-releaser-action supports this
|
||||
post-release:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Block concurrent jobs
|
||||
uses: softprops/turnstyle@v1
|
||||
with:
|
||||
continue-after-seconds: 180
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "gh-pages"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
- name: Commit and push timestamp updates
|
||||
run: |
|
||||
if [[ -f index.yaml ]]; then
|
||||
git pull
|
||||
export generated_date=$(date --utc +%FT%T.%9NZ)
|
||||
sed -i -e "s/^generated:.*/generated: \"$generated_date\"/" index.yaml
|
||||
git add index.yaml
|
||||
git commit -sm "Update generated timestamp [ci-skip]" || exit 0
|
||||
git push
|
||||
fi
|
||||
@@ -1,30 +0,0 @@
|
||||
name: Charts-CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
deploy-charts:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Install Helm
|
||||
run: /bin/bash -c "curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fetch base branch history
|
||||
run: git fetch origin master:master
|
||||
|
||||
- name: Setup catalog validation
|
||||
run: |
|
||||
sudo apt update > /dev/null 2>&1
|
||||
sudo apt install -y python3-all-dev python3-pip python3-setuptools > /dev/null 2>&1
|
||||
git clone https://github.com/truenas/catalog_validation
|
||||
sudo pip3 install --disable-pip-version-check --exists-action w -r catalog_validation/requirements.txt > /dev/null 2>&1
|
||||
sudo pip3 install -U catalog_validation/.
|
||||
|
||||
- name: Validate changed charts
|
||||
run: /bin/bash -c "PWD=${pwd}; sudo /usr/local/bin/charts_validate deploy --path $PWD"
|
||||
@@ -1,17 +0,0 @@
|
||||
name: format_validation
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ixsystems/catalog_validation:latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
name: Checkout
|
||||
- name: Validate catalog format
|
||||
run: |
|
||||
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
|
||||
Reference in New Issue
Block a user