chore(deps): update debian base images #261
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: Lint and test PR | |
on: pull_request | |
jobs: | |
docker-build: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build | |
uses: docker/build-push-action@v4 | |
with: | |
tags: ci.local/${{ github.repository }}/powerdns:ci | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
chart-lint: | |
name: Lint Helm charts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install helm/chart-testing | |
uses: helm/[email protected] | |
- name: Lint charts | |
run: ct --config .github/ct.yaml lint --all | |
chart-unittest: | |
name: Unit test Helm charts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install helm-unittest plugin | |
run: helm plugin install https://github.com/helm-unittest/helm-unittest | |
- name: Run unit tests | |
run: | | |
for chart in charts/*; do | |
if [ -d "$chart/tests/" ]; then | |
helm unittest $chart -3 | |
else | |
echo "::warning file=$chart,title=Skipping unit test for $chart::$chart does not have a tests/ folder" | |
fi | |
done | |
chart-install: | |
name: Installation test for Helm charts | |
runs-on: ubuntu-latest | |
needs: | |
# Reuse image cache: | |
- docker-build | |
# This test is expensive so only run it when cheap tests pass: | |
- chart-lint | |
- chart-unittest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
load: true # Bring image to the host so we can minikube load it later. | |
tags: ci.local/${{ github.repository }}/powerdns:ci | |
cache-from: type=gha | |
# No need to push anything to cache here. | |
# Install Minikube to test chart installation | |
- name: Install Minikube | |
uses: manusa/[email protected] | |
with: | |
minikube version: v1.29.0 | |
kubernetes version: v1.26.3 | |
github token: ${{ secrets.GITHUB_TOKEN }} | |
driver: docker | |
start args: "--container-runtime=containerd" | |
# Test chart installation with a stable image. | |
- name: Load image into minikube | |
run: | | |
minikube image load ci.local/${{ github.repository }}/powerdns:ci | |
- name: Install helm/chart-testing | |
uses: helm/[email protected] | |
- name: Test charts' installation path | |
run: | | |
ct install --all \ | |
--config .github/ct.yaml \ | |
--helm-extra-args "--timeout 1m" | |
# TODO: Upgrade path. | |
# I need to comment the upghrade path until we have a first release. | |
# Comment for the future me: | |
# This also failed because the port was used: set a strategy to recreate. | |
#- name: Test charts' upgrade path | |
# run: ct --config .github/ct.yaml install --upgrade --all | |
# Install charts with the e2e values (tested also in lint-charts job) | |
- name: Configure testing scenario | |
run: | | |
for CHART in charts/*; do | |
helm upgrade --install \ | |
"$(basename $CHART)" "$CHART" \ | |
--create-namespace --namespace e2e-staless-dns \ | |
--values "$CHART/ci/e2e-values.yaml" \ | |
--wait --timeout 60s | |
done | |
# In this first iteration, readineess probes may not be reliable. Here the CI will wait enough | |
# for powerdns to startup and for external-dns to have to to run (at least) 3 times | |
- name: Wait 30 seconds for everything to settle | |
run: sleep 30 | |
# Begin e2e test. | |
- name: Basic tests that are not e2e but allow me to test the CI | |
run: | | |
ip=$(minikube ip) | |
errors=0 | |
kubectl -n e2e-staless-dns get pods || ((errors++)) | |
curl -v "http://$ip" > /dev/null || ((errors++)) | |
dig test.es @$ip || ((errors++)) | |
dig test.dev @$ip || ((errors++)) | |
nslookup test.es $ip || ((errors++)) | |
nslookup test.dev $ip || ((errors++)) | |
exit $errors |