Skip to content

Add pi-hole to testing cluster #475

Add pi-hole to testing cluster

Add pi-hole to testing cluster #475

name: "helm-charts/test"
on: pull_request
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch history
run: git fetch --prune --unshallow
- name: Install Chart Tester
uses: helm/[email protected]
- name: Add WyriHaximusNet repo
run: helm repo add WyriHaximusNet https://helm.wyrihaximus.net/
- name: Lint charts
id: lint
run: ct lint --all
test:
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
k8s:
# - "1.23"
# - "1.24"
# - "1.25"
# - "1.26"
# - "1.27"
# - "1.28"
# - "1.29"
# - "1.30"
- "1.31"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch history
run: git fetch --prune --unshallow
- name: Create kind cluster
uses: helm/[email protected]
with:
installLocalPathProvisioner: true # Only build a kind cluster if there are chart changes to test.
node_image: "kindest/node:v${{ matrix.k8s }}.0"
config: etc/kind.yaml
- run: kubectl get nodes
- run: kubectl get pods -A
- run: kubectl get svc -A
- name: Install PiHole
uses: evryfs/[email protected]
with:
repo: https://mojo2600.github.io/pihole-kubernetes/
chart: pihole
helm: 'helm' # optional, default value is 'helm'
args: '--wait --atomic --timeout 13m --namespace=pihole --create-namespace' #optional, default value is '--wait --timeout 2m' in order to wait for the chart-install to stabilize into ready state
- run: kubectl get pods -A
- run: kubectl get svc -A
- name: Create postgresql URL
id: pihole
run: |
echo ::set-output name=hostname::$(echo "pihole-helm-charts-${{ github.run_number }}.pihole/pihole" | base64)
- name: Install postgresql
uses: evryfs/[email protected]
with:
repo: https://charts.bitnami.com/bitnami
chart: postgresql
helm: 'helm' # optional, default value is 'helm'
args: '--wait --atomic --timeout 13m' #optional, default value is '--wait --timeout 2m' in order to wait for the chart-install to stabilize into ready state
- run: kubectl get pods -A
- run: kubectl get svc -A
- name: Get PG password
id: postgresql_password
run: |
echo ::set-output name=password::$(echo "$(kubectl get secret --namespace default postgresql-helm-charts-${{ github.run_number }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)")
- name: Create postgresql URL
id: postgresql
run: |
echo ::set-output name=url::$(echo "postgresql://postgres:${{ steps.postgresql_password.outputs.password }}@postgresql-helm-charts-${{ github.run_number }}.default/postgres")
- name: Add WyriHaximusNet repo
run: helm repo add WyriHaximusNet https://helm.wyrihaximus.net/
- name: Install Chart Tester
uses: helm/[email protected]
- name: Run 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: Prepare library charts
run: |
cp charts/commons/library-ci/*.yaml charts/commons/templates/
cp charts/cron-jobs/library-ci/*.yaml charts/cron-jobs/templates/
cp charts/horizontal-pod-autoscalers/library-ci/*.yaml charts/horizontal-pod-autoscalers/templates/
cp charts/pi-hole-exporter/library-ci/*.yaml charts/pi-hole-exporter/templates/
sed -i '$ d' charts/commento/ci/postgresql-values.yaml
echo -e " manual: \"${{ steps.postgresql.outputs.url }}\"\r\n" >> charts/commento/ci/postgresql-values.yaml
sed -i '$ d' charts/commentoplusplus/ci/postgresql-values.yaml
echo -e " manual: \"${{ steps.postgresql.outputs.url }}\"\r\n" >> charts/commentoplusplus/ci/postgresql-values.yaml
sed -i 's/library/application/g' charts/commons/Chart.yaml
sed -i 's/library/application/g' charts/cron-jobs/Chart.yaml
sed -i 's/library/application/g' charts/horizontal-pod-autoscalers/Chart.yaml
rm -Rf charts/commento
rm -Rf charts/commentoplusplus
echo -e " PIHOLE_HOSTNAME: \"${{ steps.pihole.outputs.hostname }}\"\r\n" >> charts/commentoplusplus/ci/postgresql-values.yaml
- run: kubectl get pods -A
- run: kubectl get svc -A
- name: Test Changed Charts
if: steps.list-changed.outputs.changed == 'true'
run: ct install
- name: Test All Charts
if: steps.list-changed.outputs.changed != 'true'
run: ct install --all
- run: kubectl get pods -A
- run: kubectl get svc -A