Skip to content

Don't explicitly set app version and version in release job #269

Don't explicitly set app version and version in release job

Don't explicitly set app version and version in release job #269

Workflow file for this run

---
name: Test
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
test-kind:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- name: 'Scenario: with default options'
testdir: 'default-data'
- name: 'Scenario: with all-in-one image'
testdir: 'with-all-in-one-image'
- name: 'Scenario: with extra mounts'
testdir: 'with-extra-mounts'
- name: 'Scenario: with templated annotations'
testdir: 'with-templated-annotations'
env:
KRAKEND_NS: krakend-test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Install helm'
uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Install kind'
uses: helm/kind-action@v1.10.0
- name: Install jq
run: |
sudo apt-get update
sudo apt-get install jq
- name: 'Get k8s nodes'
run: |
kubectl get nodes
- name: 'Create namespace'
run: |
kubectl create namespace $KRAKEND_NS
- name: 'Build image if needed'
if: matrix.config.testdir == 'with-all-in-one-image'
run: |
docker build -t krakend-test:latest -f tests/${{ matrix.config.testdir }}/Dockerfile tests/${{ matrix.config.testdir }}
- name: 'Load image if needed'
if: matrix.config.testdir == 'with-all-in-one-image'
run: |
kind load docker-image --name chart-testing krakend-test:latest
# We copy our license file (which is just the apache license) into a secret with a sole key named LICENSE.
# This will be bind mounted into the krakend container as /etc/krakend/LICENSE.
# We're not testing the functionality of loading an actual krakend license here, just that the extra mount works.
- name: 'Create license secret'
run: |
kubectl create secret generic krakend-license --from-file=LICENSE=LICENSE --namespace $KRAKEND_NS
if: matrix.config.testdir == 'with-extra-mounts'
- name: Install chart
run: |
helm install krakend-test ./ --wait --namespace $KRAKEND_NS --values tests/${{ matrix.config.testdir }}/values.yaml
- name: Wait for krakend deployment
run: |
kubectl wait --namespace $KRAKEND_NS --for=condition=available deployment krakend-test
- name: Port forward service for testing
run: |
kubectl port-forward --namespace $KRAKEND_NS service/krakend-test 8081:80 &
- name: Test that status is OK
run: |
curl -s http://localhost:8081/__health | jq -e '.status == "ok"'
- name: Test that response is correct
run: |
curl -s http://localhost:8081/test | jq -e '.version == "deficient"'
if: matrix.config.testdir != 'with-all-in-one-image'
- name: Test that response is correct
run: |
curl -s http://localhost:8081/directories/1 | jq -e '.version == "flavorless"'
if: matrix.config.testdir == 'with-all-in-one-image'
helm-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- name: 'Scenario: with default options'
testdir: 'default-data'
- name: 'Scenario: with all-in-one image'
testdir: 'with-all-in-one-image'
- name: 'Scenario: with extra mounts'
testdir: 'with-extra-mounts'
- name: 'Scenario: with templated annotations'
testdir: 'with-templated-annotations'
env:
KRAKEND_NS: krakend-test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: 'Install helm'
uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: lint
run: |
helm lint --values tests/${{ matrix.config.testdir }}/values.yaml .