Address miscellaneous issues throughout code base #1764
Workflow file for this run
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: e2e | |
on: | |
pull_request: | |
push: | |
branches: [ 'main', 'release/**' ] | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
jobs: | |
kind: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
- name: Setup Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Cache Docker layers | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | |
id: cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx-ghcache- | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: 1.20.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup Kubernetes | |
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0 | |
with: | |
version: v0.20.0 | |
cluster_name: kind | |
node_image: kindest/node:v1.27.3@sha256:3966ac761ae0136263ffdb6cfd4db23ef8a83cba8a463690e98317add2c9ba72 | |
- name: Setup Kustomize | |
uses: fluxcd/pkg/actions/kustomize@main | |
- name: Run tests | |
run: make test | |
- name: Check if working tree is dirty | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
git --no-pager diff | |
echo 'run make test and commit changes' | |
exit 1 | |
fi | |
- name: Build container image | |
run: | | |
make docker-build IMG=test/notification-controller:latest \ | |
BUILD_PLATFORMS=linux/amd64 \ | |
BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \ | |
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max \ | |
--load" | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Load test image | |
run: kind load docker-image test/notification-controller:latest | |
- name: Install CRDs | |
run: make install | |
- name: Run default status test | |
run: | | |
kubectl apply -f config/testdata/status-defaults | |
for crd in alert provider receiver ; do | |
RESULT=$(kubectl get ${crd} status-defaults -o go-template={{.status}}) | |
EXPECTED='map[observedGeneration:-1]' | |
if [ "${RESULT}" != "${EXPECTED}" ] ; then | |
echo -e "${RESULT}\n\ndoes not equal\n\n${EXPECTED} for CRD ${crd}" | |
exit 1 | |
fi | |
done | |
- name: Deploy controller | |
run: | | |
make dev-deploy IMG=test/notification-controller:latest | |
kubectl -n notification-system rollout status deploy/notification-controller --timeout=1m | |
env: | |
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin | |
- name: Run smoke tests | |
run: | | |
kubectl -n notification-system apply -f ./config/samples | |
kubectl -n notification-system wait provider/slack-provider-sample --for=condition=ready --timeout=1m | |
kubectl -n notification-system wait provider/generic-provider-sample --for=condition=ready --timeout=1m | |
kubectl -n notification-system wait alert/alert-sample --for=condition=ready --timeout=1m | |
kubectl -n notification-system wait receiver/receiver-sample --for=condition=ready --timeout=1m | |
- name: Logs | |
run: | | |
kubectl -n notification-system logs deploy/notification-controller | |
- name: Debug failure | |
if: failure() | |
run: | | |
kubectl -n notification-system get providers -oyaml | |
kubectl -n notification-system get alerts -oyaml | |
kubectl -n notification-system get receivers -oyaml | |
kubectl -n notification-system logs deploy/notification-controller |