Skip to content

Commit

Permalink
Initial update for Vector charts
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Gilbert <[email protected]>
  • Loading branch information
spencergilbert committed Jul 30, 2021
1 parent 2f43af8 commit 13b6e0c
Show file tree
Hide file tree
Showing 84 changed files with 3,210 additions and 520 deletions.
5 changes: 5 additions & 0 deletions .github/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
chart-repos:
- timberio=https://packages.timber.io/helm/latest
check-version-increment: true
debug: true
helm-extra-args: --timeout 300s
25 changes: 25 additions & 0 deletions .github/kubeval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# Credit: https://github.com/DataDog/helm-charts/blob/master/.github/kubeval.sh
set -euo pipefail

KUBEVAL_VERSION="0.15.0"
SCHEMA_LOCATION="https://kubernetesjsonschema.dev/"
OS=$(uname)

CHANGED_CHARTS=${CHANGED_CHARTS:-${1:-}}
if [ -n "$CHANGED_CHARTS" ];
then
CHART_DIRS=$CHANGED_CHARTS
else
CHART_DIRS=$(ls -d charts/*)
fi

# install kubeval
curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-${OS}-amd64.tar.gz
tar -xf /tmp/kubeval.tar.gz kubeval

# validate charts
for CHART_DIR in ${CHART_DIRS}; do
echo "Running kubeval for folder: '$CHART_DIR'"
helm dep up "${CHART_DIR}" && helm template --values "${CHART_DIR}"/ci/kubeval.yaml "${CHART_DIR}" | ./kubeval --strict --ignore-missing-schemas --kubernetes-version "${KUBERNETES_VERSION#v}" --schema-location "${SCHEMA_LOCATION}"
done
87 changes: 87 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Credit: https://github.com/DataDog/helm-charts/blob/master/.github/workflows/ci.yaml
name: Lint and Test Charts

on:
pull_request:
paths:
- 'charts/**'

jobs:
changed:
runs-on: ubuntu-latest
outputs:
charts: ${{ steps.list-changed.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed)
if [[ -n "$changed" ]]; then
echo -n "Charts changed:"
echo "$changed"
echo "::set-output name=changed::$changed"
else
echo "PR without any chart changes - failing"
exit 1
fi
lint-chart:
runs-on: ubuntu-latest
needs:
- changed
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (lint)
run: ct lint -- config .github/ct.yaml

kubeval-chart:
runs-on: ubuntu-latest
needs:
- changed
strategy:
matrix:
# When changing versions here, check that the version exists at: https://github.com/instrumenta/kubernetes-json-schema
k8s:
- v1.14.10
- v1.16.4
- v1.18.1
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Add timberio helm repo
run: helm repo add timberio https://packages.timber.io/helm/latest && helm repo update
- name: Run kubeval
env:
KUBERNETES_VERSION: ${{ matrix.k8s }}
CHANGED_CHARTS: ${{needs.changed.outputs.charts}}
run: .github/kubeval.sh

install-chart:
runs-on: ubuntu-latest
needs:
- lint-chart
- kubeval-chart
strategy:
matrix:
k8s:
- v1.14.10
- v1.16.9
- v1.18.4
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind ${{ matrix.k8s }}
uses: helm/kind-action@main
with:
node_image: kindest/node:${{ matrix.k8s }}
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (install)
run: ct install --config .github/ct.yaml --excluded-charts vector-shared
27 changes: 27 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Credit: https://github.com/DataDog/helm-charts/blob/master/.github/workflows/release.yaml
name: Release Charts

on:
push:
branches:
- main
paths:
- 'charts/**'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: action/checkout@v1
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Add repo
run: |
helm repo add timberio https://packages.timber.io/helm/latest
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
Loading

0 comments on commit 13b6e0c

Please sign in to comment.