mirror of
https://github.com/kubereboot/kured.git
synced 2026-08-20 11:56:20 +00:00
Bumps [nick-invision/retry](https://github.com/nick-invision/retry) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/nick-invision/retry/releases) - [Changelog](https://github.com/nick-invision/retry/blob/master/.releaserc.js) - [Commits](https://github.com/nick-invision/retry/compare/v2.5.1...v2.6.0) --- updated-dependencies: - dependency-name: nick-invision/retry dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
337 lines
12 KiB
YAML
337 lines
12 KiB
YAML
name: PR
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
jobs:
|
|
pr-gotest:
|
|
name: Run go tests
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: Find go version
|
|
run: |
|
|
GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
echo "::set-output name=version::${GO_VERSION}"
|
|
id: awk_gomod
|
|
- name: Ensure go version
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
- name: run tests
|
|
run: go test -json ./... > test.json
|
|
- name: Annotate tests
|
|
if: always()
|
|
uses: guyarb/golang-test-annoations@v0.5.0
|
|
with:
|
|
test-results: test.json
|
|
|
|
pr-shellcheck:
|
|
name: Lint bash code with shellcheck
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Run ShellCheck
|
|
uses: bewuethr/shellcheck-action@v2
|
|
|
|
pr-lint-code:
|
|
name: Lint golang code
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Find go version
|
|
run: |
|
|
GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
echo "::set-output name=version::${GO_VERSION}"
|
|
id: awk_gomod
|
|
- name: Ensure go version
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
- name: Lint cmd folder
|
|
uses: Jerome1337/golint-action@v1.0.2
|
|
with:
|
|
golint-path: './cmd/...'
|
|
- name: Lint pkg folder
|
|
uses: Jerome1337/golint-action@v1.0.2
|
|
with:
|
|
golint-path: './pkg/...'
|
|
|
|
pr-check-docs-links:
|
|
name: Check docs for incorrect links
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Link Checker
|
|
id: lc
|
|
uses: peter-evans/link-checker@v1
|
|
with:
|
|
args: -r *.md *.yaml */*/*.go -x .cluster.local
|
|
- name: Fail if there were link errors
|
|
run: exit ${{ steps.lc.outputs.exit_code }}
|
|
|
|
# This should not be made a mandatory test
|
|
# It is only used to make us aware of any potential security failure, that
|
|
# should trigger a bump of the image in build/.
|
|
pr-vuln-scan:
|
|
name: Build image and scan it against known vulnerabilities
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Find go version
|
|
run: |
|
|
GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
echo "::set-output name=version::${GO_VERSION}"
|
|
id: awk_gomod
|
|
- name: Ensure go version
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
- run: make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" image
|
|
- uses: Azure/container-scan@v0
|
|
with:
|
|
image-name: docker.io/${{ github.repository_owner }}/kured:${{ github.sha }}
|
|
|
|
# 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.
|
|
e2e-manifests:
|
|
name: End-to-End test with kured with code and manifests from HEAD
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
kubernetes:
|
|
- "1.21"
|
|
- "1.22"
|
|
- "1.23"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Find go version
|
|
run: |
|
|
GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
echo "::set-output name=version::${GO_VERSION}"
|
|
id: awk_gomod
|
|
- name: Ensure go version
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
- name: Build artifacts
|
|
run: |
|
|
make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" image
|
|
make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" 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.2.0
|
|
with:
|
|
config: .github/kind-cluster-${{ matrix.kubernetes }}.yaml
|
|
version: v0.11.0
|
|
|
|
- name: Preload previously built images onto kind cluster
|
|
run: kind load docker-image docker.io/${{ github.repository_owner }}/kured:${{ github.sha }} --name chart-testing
|
|
|
|
- name: Do not wait for an hour before detecting the rebootSentinel
|
|
run: |
|
|
sed -i 's/#\(.*\)--period=1h/\1--period=30s/g' kured-ds.yaml
|
|
|
|
- name: Install kured with kubectl
|
|
run: |
|
|
kubectl apply -f kured-rbac.yaml && kubectl apply -f kured-ds.yaml
|
|
|
|
- name: Ensure kured is ready
|
|
uses: nick-invision/retry@v2.6.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: Create reboot sentinel files
|
|
run: |
|
|
./tests/kind/create-reboot-sentinels.sh
|
|
|
|
- name: Follow reboot until success
|
|
env:
|
|
DEBUG: true
|
|
run: |
|
|
./tests/kind/follow-coordinated-reboot.sh
|
|
|
|
scenario-prom-helm:
|
|
name: Test prometheus with latest code from HEAD (=overrides image of the helm chart)
|
|
runs-on: ubuntu-latest
|
|
# only build with oldest and newest supported, it should be good enough.
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
kubernetes:
|
|
- "1.21"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Find go version
|
|
run: |
|
|
GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
echo "::set-output name=version::${GO_VERSION}"
|
|
id: awk_gomod
|
|
- name: Ensure go version
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
- name: Build artifacts
|
|
run: |
|
|
make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" image
|
|
make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" helm-chart
|
|
|
|
- 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 1 node kind cluster
|
|
uses: helm/kind-action@v1.2.0
|
|
with:
|
|
version: v0.11.0
|
|
|
|
- name: Preload previously built images onto kind cluster
|
|
run: kind load docker-image docker.io/${{ github.repository_owner }}/kured:${{ github.sha }} --name chart-testing
|
|
|
|
- name: Deploy kured on default namespace with its helm chart
|
|
run: |
|
|
# Documented in official helm doc to live on the edge
|
|
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
|
# Refresh bins
|
|
hash -r
|
|
helm install kured ./charts/kured/ --wait --values ./charts/kured/ci/prometheus-values.yaml
|
|
kubectl config set-context kind-chart-testing
|
|
kubectl get ds --all-namespaces
|
|
kubectl describe ds kured
|
|
|
|
- name: Ensure kured is ready
|
|
uses: nick-invision/retry@v2.6.0
|
|
with:
|
|
timeout_minutes: 10
|
|
max_attempts: 10
|
|
retry_wait_seconds: 60
|
|
# DESIRED CURRENT READY UP-TO-DATE AVAILABLE
|
|
command: "kubectl get ds kured | grep -E 'kured.*1.*1.*1.*1.*1' "
|
|
|
|
- name: Get metrics (healthy)
|
|
uses: nick-invision/retry@v2.6.0
|
|
with:
|
|
timeout_minutes: 2
|
|
max_attempts: 12
|
|
retry_wait_seconds: 5
|
|
command: "./tests/kind/test-metrics.sh 0"
|
|
|
|
- name: Create reboot sentinel files
|
|
run: |
|
|
./tests/kind/create-reboot-sentinels.sh
|
|
|
|
- name: Get metrics (need reboot)
|
|
uses: nick-invision/retry@v2.6.0
|
|
with:
|
|
timeout_minutes: 15
|
|
max_attempts: 10
|
|
retry_wait_seconds: 60
|
|
command: "./tests/kind/test-metrics.sh 1"
|
|
|
|
|
|
# TEMPLATE Scenario testing.
|
|
# Note: keep in mind that the helm chart's appVersion is overriden to test your HEAD of the branch,
|
|
# if you `make helm-chart`.
|
|
# This will allow you to test properly your scenario and not use an existing image which will not
|
|
# contain your feature.
|
|
|
|
# scenario-<REPLACETHIS>-helm:
|
|
# #example: Testing <REPLACETHIS> with helm chart and code from HEAD"
|
|
# name: "<REPLACETHIS>"
|
|
# runs-on: ubuntu-latest
|
|
# strategy:
|
|
# fail-fast: false
|
|
# # You can define your own kubernetes versions. For example if your helm chart change should behave differently with different kubernetes versions.
|
|
# matrix:
|
|
# kubernetes:
|
|
# - "1.20"
|
|
# steps:
|
|
# - uses: actions/checkout@v2
|
|
# - name: Find go version
|
|
# run: |
|
|
# GO_VERSION=$(awk '/^go/ {print $2};' go.mod)
|
|
# echo "::set-output name=version::${GO_VERSION}"
|
|
# id: awk_gomod
|
|
# - name: Ensure go version
|
|
# uses: actions/setup-go@v2
|
|
# with:
|
|
# go-version: "${{ steps.awk_gomod.outputs.version }}"
|
|
# - name: Build artifacts
|
|
# run: |
|
|
# make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" image
|
|
# make DH_ORG="${{ github.repository_owner }}" VERSION="${{ github.sha }}" helm-chart
|
|
#
|
|
# - 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 5 node kind cluster
|
|
# uses: helm/kind-action@master
|
|
# with:
|
|
# config: .github/kind-cluster-${{ matrix.kubernetes }}.yaml
|
|
#
|
|
# - name: Preload previously built images onto kind cluster
|
|
# run: kind load docker-image docker.io/${{ github.repository_owner }}/kured:${{ github.sha }} --name chart-testing
|
|
#
|
|
# - name: Deploy kured on default namespace with its helm chart
|
|
# run: |
|
|
# # Documented in official helm doc to live on the edge
|
|
# curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
|
# # Refresh bins
|
|
# hash -r
|
|
# helm install kured ./charts/kured/ --wait --values ./charts/kured/ci/<REPLACETHIS>-values.yaml
|
|
# kubectl config set-context kind-chart-testing
|
|
# kubectl get ds --all-namespaces
|
|
# kubectl describe ds kured
|
|
#
|
|
# - name: Ensure kured is ready
|
|
# uses: nick-invision/retry@v2.6.0
|
|
# with:
|
|
# timeout_minutes: 10
|
|
# max_attempts: 10
|
|
# retry_wait_seconds: 60
|
|
# # DESIRED CURRENT READY UP-TO-DATE AVAILABLE should all be = 5
|
|
# command: "kubectl get ds kured | grep -E 'kured.*5.*5.*5.*5.*5' "
|
|
#
|
|
# - name: Create reboot sentinel files
|
|
# run: |
|
|
# ./tests/kind/create-reboot-sentinels.sh
|
|
#
|
|
# - name: Test <REPLACETHIS>
|
|
# env:
|
|
# DEBUG: true
|
|
# run: |
|
|
# <TODO>
|