Skip to content

build(deps): Update golang Docker tag to v1.23.5 #203

build(deps): Update golang Docker tag to v1.23.5

build(deps): Update golang Docker tag to v1.23.5 #203

Workflow file for this run

name: Tests
on:
push:
branches: [main]
tags:
- v*
pull_request:
branches: [main]
jobs:
lint:
name: Lint golang code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure go version
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- name: fmt check
run: test -z $(go fmt ./...)
- name: lint
run: make lint
- name: Install pre-commit
run: |
pip install pre-commit
pre-commit install
- name: Run pre-commit hooks
run: pre-commit run --all-files
unit-tests:
name: Run go tests
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Ensure go version
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- name: run tests
run: go test -json ./... > test.json
- name: Annotate tests
if: always()
uses: guyarb/golang-test-annoations@v0.8.0
with:
test-results: test.json
shellcheck:
name: Lint bash code with shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: bewuethr/shellcheck-action@v2
# This ensures the latest code works with the manifests built from tree.
# It is useful for two things:
# - Test manifests changes (obviously), ensuring they don't break existing clusters
# - Ensure manifests work with the latest versions even with no manifest change
# (compared to helm charts, manifests cannot easily template changes based on versions)
# Helm charts are _trailing_ releases, while manifests are done during development.
# This test uses the "command" reboot-method.
e2e-manifests-command:
name: End-to-End test with kured with code and manifests from HEAD (command)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
job:
- {kubernetes: "1.30", concurrency: 1}
- {kubernetes: "1.29", concurrency: 1}
- {kubernetes: "1.30", concurrency: 2}
- {kubernetes: "1.29", concurrency: 2}
steps:
- uses: actions/checkout@v4
- name: Ensure go version
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
check-latest: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Find current tag version
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
id: tags
- name: Build artifacts
run: |
VERSION="${{ steps.tags.outputs.sha_short }}" make image
VERSION="${{ steps.tags.outputs.sha_short }}" make manifest
- name: Workaround "Failed to attach 1 to compat systemd cgroup /actions_job/..." on gh actions
run: |
sudo bash << EOF
cp /etc/docker/daemon.json /etc/docker/daemon.json.old
echo '{}' > /etc/docker/daemon.json
systemctl restart docker || journalctl --no-pager -n 500
systemctl status docker
EOF
# Default name for helm/kind-action kind clusters is "chart-testing"
- name: Create kind cluster with 5 nodes
uses: helm/kind-action@v1.10.0
with:
config: .github/kind-cluster-${{ matrix.job.kubernetes }}.yaml
version: v0.14.0
- name: Preload previously built images onto kind cluster
run: kind load docker-image ghcr.io/${{ github.repository }}:${{ steps.tags.outputs.sha_short }} --name chart-testing
- name: Install Alertmanager
run: |
kubectl apply -f test/alertmanager.yaml
- name: Install Kured
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
helm repo add kubereboot https://kubereboot.github.io/charts
helm install -n kube-system kured kubereboot/kured --set configuration.period=10s --set configuration.concurrency=${{ matrix.job.concurrency }}
- name: Ensure kured is ready
uses: nick-invision/retry@v3.0.0
with:
timeout_minutes: 10
max_attempts: 10
retry_wait_seconds: 60
# DESIRED CURRENT READY UP-TO-DATE AVAILABLE should all be = to cluster_size
command: "kubectl get ds -n kube-system kured | grep -E 'kured.*5.*5.*5.*5.*5'"
- name: Install kured-alert-silencer with kubectl
run: |
kubectl apply -f install/kubernetes/rbac.yaml && kubectl apply -f install/kubernetes/deployment.yaml
- name: Create reboot sentinel files
run: |
./test/kind/create-reboot-sentinels.sh
- name: Follow reboot until success
env:
DEBUG: true
run: |
./test/kind/follow-coordinated-reboot.sh
- name: Check all silences were created
run: |
./test/kind/check-silences.sh
rerun-failed-jobs:
runs-on: ubuntu-latest
needs:
- e2e-manifests-command
if: failure()
steps:
- name: Rerun failed jobs in the current workflow
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
run: gh workflow run retry-workflow.yaml -F run_id=${{ github.run_id }}