Skip to content

Commit

Permalink
fix: e2e test image tag & bump k3s k8s version
Browse files Browse the repository at this point in the history
Signed-off-by: lvlcn-t <75443136+lvlcn-t@users.noreply.github.com>
  • Loading branch information
lvlcn-t committed Nov 19, 2024
1 parent e27e73d commit f24a810
Showing 1 changed file with 80 additions and 75 deletions.
155 changes: 80 additions & 75 deletions .github/workflows/end2end.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,79 +9,84 @@ jobs:
end2end:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up K3S
uses: debianmaster/actions-k3s@master
id: k3s
with:
version: 'v1.26.9-k3s1'
- name: Check Cluster
run: |
kubectl get nodes
- name: Check Coredns Deployment
run: |
kubectl -n kube-system rollout status deployment/coredns --timeout=60s
STATUS=$(kubectl -n kube-system get deployment coredns -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment coredns not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment coredns OK"
fi
- name: Check Metricsserver Deployment
run: |
kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s
STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment metrics-server not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment metrics-server OK"
fi
- name: Setup Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
- name: Get Image Tag
id: version
run: echo "value=commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Sparrow
run: |
helm upgrade -i sparrow \
--atomic \
--timeout 300s \
--set image.tag=${{ steps.version.outputs.value }} \
--set sparrowConfig.name=the-sparrow.com \
--set sparrowConfig.loader.type=file \
--set sparrowConfig.loader.interval=5s \
--set sparrowConfig.loader.file.path=/config/.sparrow.yaml \
--set checksConfig.health.interval=1s \
--set checksConfig.health.timeout=1s \
./chart
- name: Checkout Repo
uses: actions/checkout@v4
# We need to fetch tags because our snapshot artifacts are named like this <tag>-commit-<short-commit>.
# We don't use checkout/fetch-tags: true because it's broken.
# For more information see: https://github.com/actions/checkout/issues/1471
- name: Fetch tags explicitly
run: git fetch --prune --unshallow --tags
- name: Set up K3S
uses: debianmaster/actions-k3s@master
id: k3s
with:
version: "v1.31.2-k3s1"
- name: Check Cluster
run: |
kubectl get nodes
- name: Check Coredns Deployment
run: |
kubectl -n kube-system rollout status deployment/coredns --timeout=60s
STATUS=$(kubectl -n kube-system get deployment coredns -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment coredns not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment coredns OK"
fi
- name: Check Metricsserver Deployment
run: |
kubectl -n kube-system rollout status deployment/metrics-server --timeout=60s
STATUS=$(kubectl -n kube-system get deployment metrics-server -o jsonpath={.status.readyReplicas})
if [[ $STATUS -ne 1 ]]
then
echo "Deployment metrics-server not ready"
kubectl -n kube-system get events
exit 1
else
echo "Deployment metrics-server OK"
fi
- name: Setup Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
- name: Get Image Tag
id: version
run: echo "value=$(git describe --tags --abbrev=0)-commit-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Install Sparrow
run: |
helm upgrade -i sparrow \
--atomic \
--timeout 300s \
--set image.tag=${{ steps.version.outputs.value }} \
--set sparrowConfig.name=the-sparrow.com \
--set sparrowConfig.loader.type=file \
--set sparrowConfig.loader.interval=5s \
--set sparrowConfig.loader.file.path=/config/.sparrow.yaml \
--set checksConfig.health.interval=1s \
--set checksConfig.health.timeout=1s \
./chart
- name: Check Pods
run: |
kubectl get pods
- name: Wait for Sparrow
run: |
sleep 60
- name: Healthcheck
run: |
kubectl create job curl --image=quay.io/curl/curl:latest -- curl -f -v -H 'Content-Type: application/json' http://sparrow:8080/v1/metrics/health
kubectl wait --for=condition=complete job/curl
STATUS=$(kubectl get job curl -o jsonpath={.status.succeeded})
if [[ $STATUS -ne 1 ]]
then
echo "Job failed"
kubectl logs -ljob-name=curl
kubectl delete job curl
exit 1
else
echo "Job OK"
kubectl delete job curl
fi
- name: Check Pods
run: |
kubectl get pods
- name: Wait for Sparrow
run: |
sleep 60
- name: Healthcheck
run: |
kubectl create job curl --image=quay.io/curl/curl:latest -- curl -f -v -H 'Content-Type: application/json' http://sparrow:8080/v1/metrics/health
kubectl wait --for=condition=complete job/curl
STATUS=$(kubectl get job curl -o jsonpath={.status.succeeded})
if [[ $STATUS -ne 1 ]]
then
echo "Job failed"
kubectl logs -ljob-name=curl
kubectl delete job curl
exit 1
else
echo "Job OK"
kubectl delete job curl
fi

0 comments on commit f24a810

Please sign in to comment.