Skip to content

Commit

Permalink
Merge pull request #2 from paul-gilber/helm-checks
Browse files Browse the repository at this point in the history
Helm checks
  • Loading branch information
paul-gilber committed Nov 7, 2023
2 parents 64ffedd + f647b8c commit 89009a2
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 179 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"Tim-Koehler.helm-intellisense",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"redhat.vscode-openshift-extension-pack",
"redhat.vscode-openshift-connector"
"redhat.vscode-openshift-connector",
"github.vscode-github-actions"
]
}
},
Expand Down
9 changes: 0 additions & 9 deletions .github/actions/container-structure-test/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions .github/actions/container-structure-test/action.yml

This file was deleted.

This file was deleted.

17 changes: 13 additions & 4 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ documentation:
# to any changes within docs folder
- docs/**

# Add `helm-charts` label
helm-charts:
# to any changes within `charts` directory
- charts/**
# Add `helm-chart-templates` label
helm-chart-templates:
# to any changes within of helm chart templates
- charts/*/templates
# to any changes within of helm chart subcharts
- charts/*/charts
# to any changes within of helm chart Chart.yaml
- charts/*/Chart.yaml

# Add `helm-chart-values` label
helm-chart-values:
# to any changes of default helm chart values
- charts/*/values.yaml

# Add `devcontainer` label
devcontainer:
Expand Down
40 changes: 0 additions & 40 deletions .github/release-drafter.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/release.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/release-drafter.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Validate Helm Charts

# Events that trigger workflows: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
push: # By default, a workflow only runs when a pull_request event's activity type is opened, synchronize, or reopened

# Set Workflow-level permissions: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: read

# Set Workflow-level environment variables
env:
CHARTS_ROOT: "./charts"

jobs:
validate-template:
strategy:
matrix:
chart: [demoapp-backend, demoapp-frontend]
value: [values.yaml]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout

- name: Set helm chart path
run: |
echo "CHART_PATH=${{ env.CHARTS_ROOT }}/${{ matrix.chart }}" >> $GITHUB_ENV
- name: Update dependencies
run: |
cd "${{ env.CHART_PATH }}"
helm dependency update .
# Helm is pre-installed in GitHub-hosted runners: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#package-management
- name: Helm Template
run: |
cd "${{ env.CHART_PATH }}"
helm template . --values "${{ matrix.value }}"
validate-k3s:
needs: validate-template
strategy:
matrix:
chart: [demoapp-backend, demoapp-frontend]
value: [values.yaml]
# k3s releases: https://github.com/k3s-io/k3s/releases
# '' = stable version
k3s_version: [''] # , v1.28.2+k3s1, v1.27.7+k3s1, v1.26.10+k3s1]
runs-on: ubuntu-latest
env:
# Set KUBECONFIG path to default k3s location
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
steps:
- name: Setup k3s
run: |
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_VERSION=${{ matrix.k3s_version }} sh -
# Kubectl is pre-installed in GitHub-hosted runners: https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#tools
- name: Get Kubernetes Version
run: |
kubectl version
- name: Set helm chart path
run: |
echo "CHART_PATH=${{ env.CHARTS_ROOT }}/${{ matrix.chart }}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout

- name: Update dependencies
run: |
cd "${{ env.CHART_PATH }}"
helm dependency update .
- name: Helm Dry-run (Server)
run: |
cd "${{ env.CHART_PATH }}"
helm install ${{ matrix.chart }} . --dry-run=server
- name: Helm Install
run: |
cd "${{ env.CHART_PATH }}"
helm install ${{ matrix.chart }} . --wait --timeout 30s
# helm-dry-run-openshift:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"ms-vscode-remote.remote-containers",
"tim-koehler.helm-intellisense",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"redhat.vscode-openshift-connector"
"redhat.vscode-openshift-connector",
"github.vscode-github-actions"
]
}

0 comments on commit 89009a2

Please sign in to comment.