distributed: major refactoring, use common templates (#1520) #2859
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test charts" | |
on: | |
push: | |
paths-ignore: | |
- 'packages/**' | |
- 'index.yaml' | |
- '**.md' | |
branches: | |
- master | |
pull_request: | |
paths-ignore: | |
- 'packages/**' | |
- 'index.yaml' | |
- '**.md' | |
branches: | |
- master | |
env: | |
HELM_VERSION: 3.15.1 | |
jobs: | |
get-changed-charts: | |
name: Get changed charts | |
runs-on: ubuntu-22.04 | |
outputs: | |
charts: ${{ steps.charts-diff.outputs.charts }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run changed-files with dir_names | |
id: changed-charts | |
uses: tj-actions/changed-files@v44 | |
with: | |
files: | | |
charts/** | |
# This steps gets output of changes-charts step and filters out only chart names | |
# changed-charts output is space-separated list of changed paths | |
# this bash pipeline extracts unique chart names from the list | |
- name: Build charts diff | |
id: charts-diff | |
run: | | |
charts=$(echo "${{ steps.changed-charts.outputs.all_modified_files }}" | sed 's/ /\n/g' | grep -v 'common' | awk -F/ '{print $2}' | sort | uniq | jq -ncR '[inputs]') | |
echo "charts=$charts" >> $GITHUB_OUTPUT | |
install-chart: | |
name: Install chart | |
runs-on: ubuntu-22.04 | |
needs: get-changed-charts | |
if: ${{ needs.get-changed-charts.outputs.charts != '[""]' }} | |
strategy: | |
matrix: | |
chart: ${{ fromJSON(needs.get-changed-charts.outputs.charts) }} | |
k8s_version: ["v1.28.9", "v1.29.4", "v1.30.2"] | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Kubernetes tools | |
uses: yokawasa/[email protected] | |
with: | |
setup-tools: | | |
helmv3 | |
kubectl | |
helm: "${{ env.HELM_VERSION }}" | |
kubectl: "${{ matrix.k8s_version }}" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Create Kind cluster | |
uses: helm/kind-action@v1 | |
with: | |
node_image: kindest/node:${{ matrix.k8s_version }} | |
kubectl_version: ${{ matrix.k8s_version }} | |
- name: Remove node taints | |
run: | | |
kubectl taint --all=true nodes node.cloudprovider.kubernetes.io/uninitialized- || true | |
- name: Run chart-testing (install) | |
env: | |
LICENSE_KEY: ${{ secrets.ENTERPRISE_COMPONENTS_LICENSE_KEY }} | |
run: | | |
kubectl create namespace ${{ matrix.chart }}-testing | |
kubectl create secret -n=${{ matrix.chart }}-testing generic license --from-literal=key=$LICENSE_KEY | |
helm dep update charts/${{ matrix.chart }} | |
# Skip run for k8s stack chart as it fails CRD check | |
if [ "${{ matrix.chart }}" != "victoria-metrics-k8s-stack" ] && [ "${{ matrix.chart }}" != "victoria-metrics-distributed" ]; then | |
helm template charts/${{ matrix.chart }} \ | |
--namespace ${{ matrix.chart }}-testing \ | |
--values ./hack/helm/${{ matrix.chart }}/e2e/simple.yaml \ | |
--validate | kubectl apply -f - --dry-run=server | |
fi | |
ct install \ | |
--namespace ${{ matrix.chart }}-testing \ | |
--config .github/ci/ct.yaml \ | |
--charts "charts/${{ matrix.chart }}" \ | |
--helm-extra-set-args "--values ./hack/helm/${{ matrix.chart }}/e2e/simple.yaml" --skip-clean-up |