Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Migrate pod-init into operator chart, add testing #3

Migrate pod-init into operator chart, add testing

Migrate pod-init into operator chart, add testing #3

name: Lint Helm charts
on:
push:
branches: [ "main", "nhudson/TEM-2034" ]
paths:
- 'charts/**'
pull_request:
branches: [ "main" ]
paths:
- 'charts/**'
jobs:
find_directories:
name: Find changed helm charts
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.find_directories.outputs.build_matrix }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Check out the coredb repo to reuse some actions
uses: actions/checkout@v4
with:
repository: tembo-io/tembo
path: ./.tembo
ref: 84664df742ce9774a3029e08111940f9f1fb345e
- name: Find directories with Chart.yaml that changed
id: find_directories
uses: ./.tembo/.github/actions/find-changed-directories
with:
contains_the_file: Chart.yaml
changed_relative_to_branch: ${{ github.base_ref || 'not-a-branch' }}
ignore_dirs: ".tembo"
lint:
name: Lint charts
runs-on: ubuntu-latest
needs:
- find_directories
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_directories.outputs.directories) }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Helm lint
run: helm lint ${{ matrix.path }}
lint-ct:
name: Lint using chart-testing
runs-on: ubuntu-latest
needs:
- find_directories
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@v4 #
with:
python-version: 3.x
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- name: Install just
uses: extractions/setup-just@v1
- run: just helm-repo
# - name: Run chart-testing (list-changed)
# id: list-changed
# run: |
# changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
# if [[ -n "$changed" ]]; then
# echo "changed=true" >> $GITHUB_OUTPUT
# fi
- name: Run chart-testing linter
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --config ct.yaml
test:
name: Test using chart-testing
runs-on: ubuntu-latest
needs: lint-ct
# if: needs.lint-ct.outputs.changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.6.1
- uses: extractions/setup-just@v1
- run: just helm-repo
- name: Install kind cluster
uses: helm/kind-action@v1.8.0
with:
install_only: true
- name: Start kind cluster
run: just start-kind
- name: Run helm chart tests
run: ct install --config ct.yaml
release-chart:
runs-on: ubuntu-latest
needs: test
if: contains(github.ref, 'nhudson/TEM-2034')
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: 'code'
- name: Set up Helm
uses: azure/setup-helm@v3.5
with:
version: 3.13.2
- name: Package Helm Chart
run: |
cd code/charts/tembo-operator
helm package .
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: 'gh-pages'
path: 'gh-pages'
- name: Update Helm repo index
run: |
mv code/charts/tembo-operator/*.tgz gh-pages/
cd gh-pages
helm repo index . --url https://tembo-io.github.io/tembo-stacks
- name: Commit and Push
run: |
cd gh-pages
git config user.name "tembo-service-user"
git config user.email "admin+github@tembo.io"
git add .
git commit -m "Update Helm chart"
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.SERVICE_USER_GITHUB_SSH_KEY }}