Skip to content

Commit

Permalink
update ci --skip-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Feb 2, 2024
1 parent 29b51f4 commit b35c1d7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 33 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CWM_WORKER_HELM_DEPLOY_KEY: ${{ secrets.CWM_WORKER_HELM_DEPLOY_KEY }}
CWM_WORKER_CLUSTER_DEPLOY_KEY: ${{ secrets.CWM_WORKER_CLUSTER_DEPLOY_KEY }}
HELM_VERSION: "v3.2.4"
MINIKUBE_VERSION: "v1.21.0"
MINIKUBE_KUBERNETES_VERSION: "v1.18.15"
Expand Down
78 changes: 45 additions & 33 deletions bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,51 @@ uci docker tag-push \
--push-tag-name "ghcr.io/cloudwebmanage/cwm-worker-ingress/nginx:$GITHUB_SHA"

if [ "$(uci github actions get-branch-name)" == "main" ]; then
uci docker tag-push \
--source-tag-name vdns \
--push-tag-name ghcr.io/cloudwebmanage/cwm-worker-ingress/vdns:latest
uci docker tag-push \
--source-tag-name nginx \
--push-tag-name ghcr.io/cloudwebmanage/cwm-worker-ingress/nginx:latest
uci kubectl install --version "${KUBECTL_VERSION}" --with-sudo
uci minikube install --version "${MINIKUBE_VERSION}" --with-sudo
uci helm install --version "${HELM_VERSION}" --with-sudo
minikube start --driver=docker --kubernetes-version="${MINIKUBE_KUBERNETES_VERSION}"
uci util wait-for --timeout-seconds 240 --timeout-message "waited too long for minikube to start" \
"minikube status 2>&1 >/dev/null"
uci util wait-for --timeout-seconds 240 --timeout-message "waited too long for minikube node to be ready" \
'kubectl get nodes | grep " Ready "'
helm upgrade --install --wait cwm-worker-ingress ./helm
sleep 5
kubectl apply -f tests/k8s-tests.yaml
[ "$?" != "0" ] && echo "failed to apply tests/k8s-tests.yaml" && exit 1
sleep 10
tests/k8s_tests.sh
K8S_TESTS_RES="$?"
echo K8S_TESTS_RES=$K8S_TESTS_RES
POD=$(kubectl get pods | grep cwm-worker-ingress-http- | tee /dev/stderr | cut -d " " -f1)
kubectl describe pod tests
kubectl describe pod "$POD"
echo "-- redis logs --"
kubectl logs $POD -c redis
echo "-- nginx logs --"
kubectl logs $POD -c nginx
echo "-- vdns logs --"
kubectl logs $POD -c vdns
echo "---------------"
[ "${K8S_TESTS_RES}" != "0" ] && echo "K8S_TESTS_RES=$K8S_TESTS_RES" && exit 1
if ! uci git check-last-commit-message --contains --skip-tests; then
uci docker tag-push \
--source-tag-name vdns \
--push-tag-name ghcr.io/cloudwebmanage/cwm-worker-ingress/vdns:latest
uci docker tag-push \
--source-tag-name nginx \
--push-tag-name ghcr.io/cloudwebmanage/cwm-worker-ingress/nginx:latest
uci kubectl install --version "${KUBECTL_VERSION}" --with-sudo
uci minikube install --version "${MINIKUBE_VERSION}" --with-sudo
uci helm install --version "${HELM_VERSION}" --with-sudo
minikube start --driver=docker --kubernetes-version="${MINIKUBE_KUBERNETES_VERSION}"
uci util wait-for --timeout-seconds 240 --timeout-message "waited too long for minikube to start" \
"minikube status 2>&1 >/dev/null"
uci util wait-for --timeout-seconds 240 --timeout-message "waited too long for minikube node to be ready" \
'kubectl get nodes | grep " Ready "'
helm upgrade --install --wait cwm-worker-ingress ./helm
sleep 5
kubectl apply -f tests/k8s-tests.yaml
[ "$?" != "0" ] && echo "failed to apply tests/k8s-tests.yaml" && exit 1
sleep 10
tests/k8s_tests.sh
K8S_TESTS_RES="$?"
echo K8S_TESTS_RES=$K8S_TESTS_RES
POD=$(kubectl get pods | grep cwm-worker-ingress-http- | tee /dev/stderr | cut -d " " -f1)
kubectl describe pod tests
kubectl describe pod "$POD"
echo "-- redis logs --"
kubectl logs $POD -c redis
echo "-- nginx logs --"
kubectl logs $POD -c nginx
echo "-- vdns logs --"
kubectl logs $POD -c vdns
echo "---------------"
[ "${K8S_TESTS_RES}" != "0" ] && echo "K8S_TESTS_RES=$K8S_TESTS_RES" && exit 1
fi
uci git checkout \
--github-repo-name CloudWebManage/cwm-worker-cluster \
--branch-name master \
--ssh-key "${CWM_WORKER_CLUSTER_DEPLOY_KEY}" \
--path cwm-worker-cluster \
--config-user-name cwm-worker-ingress-ci &&\
cd cwm-worker-cluster &&\
bin/update_cluster_image.py cwm-worker-ingress $GITHUB_SHA --git-commit &&\
git push origin master
[ "$?" != "0" ] && echo "deploy failed" && exit 1
fi

exit 0

0 comments on commit b35c1d7

Please sign in to comment.