fix updater, deployer, waiter to support new architecture #460
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: CI | |
on: | |
push: | |
paths-ignore: | |
- '**.md' | |
workflow_dispatch: | |
inputs: | |
skip_tests: | |
description: 'yes/no: skip tests' | |
required: true | |
default: 'yes' | |
jobs: | |
ci: | |
runs-on: ubuntu-20.04 | |
steps: | |
- 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 }} | |
CWM_API_URL: ${{ secrets.CWM_API_URL }} | |
CWM_API_KEY: ${{ secrets.CWM_API_KEY }} | |
CWM_API_SECRET: ${{ secrets.CWM_API_SECRET }} | |
AWS_ROUTE53_HOSTEDZONE_ID: ${{ secrets.AWS_ROUTE53_HOSTEDZONE_ID }} | |
AWS_ROUTE53_HOSTEDZONE_DOMAIN: ${{ secrets.AWS_ROUTE53_HOSTEDZONE_DOMAIN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TEST_WORKER_ID: ${{ secrets.TEST_WORKER_ID }} | |
TEST_GATEWAY_WORKER_ID: ${{ secrets.TEST_GATEWAY_WORKER_ID }} | |
TEST_GATEWAY_AWS_WORKER_ID: ${{ secrets.TEST_GATEWAY_AWS_WORKER_ID }} | |
TEST_GATEWAY_AZURE_WORKER_ID: ${{ secrets.TEST_GATEWAY_AZURE_WORKER_ID }} | |
TEST_GATEWAY_GOOGLE_WORKER_ID: ${{ secrets.TEST_GATEWAY_GOOGLE_WORKER_ID }} | |
HELM_VERSION: "v3.2.4" | |
MINIKUBE_VERSION: "v1.21.0" | |
MINIKUBE_KUBERNETES_VERSION: "v1.18.15" | |
KUBECTL_VERSION: "v1.19.0" | |
run: | | |
curl -s https://raw.githubusercontent.com/CloudWebManage/uumpa-ci-toolbox/main/bin/github_actions_install.sh \ | |
| bash -s 807a483b65f3ec28787300499d961338a9d6bc4a CloudWebManage/uumpa-ci-toolbox &&\ | |
uci github actions self-checkout --config-user-name "cwm-worker-operator-ci" &&\ | |
if [ "${{ github.event.inputs.skip_tests }}" == "yes" ] || uci git check-last-commit-message --contains --skip-tests; then | |
SKIP_TESTS=yes | |
else | |
SKIP_TESTS=no | |
fi &&\ | |
uci minikube install --version "${MINIKUBE_VERSION}" --with-sudo &&\ | |
bin/minikube_start.sh $MINIKUBE_KUBERNETES_VERSION &&\ | |
uci kubectl install --version "${KUBECTL_VERSION}" --with-sudo &&\ | |
uci helm install --version "${HELM_VERSION}" --with-sudo &&\ | |
uci github actions docker-login &&\ | |
python -m venv venv &&\ | |
. venv/bin/activate &&\ | |
pip install --upgrade pip &&\ | |
pip install -r requirements.txt &&\ | |
pip install -r tests/requirements.txt &&\ | |
pip install -e . &&\ | |
uci util wait-for --timeout-seconds 240 --timeout-message "waited too long for minikube to start" "minikube status 2>&1 >/dev/null" &&\ | |
if [ "${SKIP_TESTS}" == "no" ]; then | |
sudo apt-get install -y redis-tools &&\ | |
bin/redis_start_wait.sh &&\ | |
kubectl get nodes &&\ | |
bin/prometheus_deploy_wait.sh &&\ | |
export DEBUG=yes &&\ | |
export DEBUG_VERBOSITY=10 &&\ | |
export REDIS_HOST=172.17.0.1 &&\ | |
export CWM_ZONE=EU &&\ | |
export CWM_ADDITIONAL_ZONES=iL,Us &&\ | |
export DEPLOYER_WAIT_DEPLOYMENT_READY_MAX_SECONDS="240.0" &&\ | |
export CWM_WORKER_DEPLOYMENT_HELM_CACHE_DIR="$(pwd)/.cwm_worker_deployment_helm_cache" &&\ | |
export CACHE_MINIO_VERSIONS=0.0.0-20200829T091900,0.0.0-20200910T100633 &&\ | |
export WAITER_VERIFY_WORKER_ACCESS=no &&\ | |
echo running tests &&\ | |
pytest | |
fi &&\ | |
uci docker build-cache \ | |
--cache-from ghcr.io/cloudwebmanage/cwm-worker-operator/cwm_worker_operator:latest \ | |
-- -t cwm_worker_operator . &&\ | |
uci docker tag-push \ | |
--source-tag-name cwm_worker_operator \ | |
--push-tag-name "ghcr.io/cloudwebmanage/cwm-worker-operator/cwm_worker_operator:${GITHUB_SHA}" &&\ | |
if uci docs render-markdown-from-click-cli --python-venv venv \ | |
--cli-command cwm-worker-operator --main-command main --cli-module cwm_worker_operator.cli --output-file CLI.md \ | |
--start-line-contains '<!-- start reference -->' --end-line-contains '<!-- end reference -->'; then | |
if [ "$(uci github actions get-branch-name)" == "main" ]; then | |
git add CLI.md &&\ | |
git commit -m "automatic update of CLI reference" &&\ | |
git push | |
fi | |
fi &&\ | |
if [ "$(uci github actions get-branch-name)" == "main" ]; then | |
uci docker tag-push \ | |
--source-tag-name cwm_worker_operator \ | |
--push-tag-name "ghcr.io/cloudwebmanage/cwm-worker-operator/cwm_worker_operator:latest" &&\ | |
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-operator-ci &&\ | |
cd cwm-worker-cluster &&\ | |
bin/update_cluster_image.py cwm-worker-operator $GITHUB_SHA --git-commit &&\ | |
git push origin master | |
fi | |
- uses: 8398a7/action-slack@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
status: ${{ job.status }} | |
author_name: ${{ github.actor }} | |
fields: all | |
if_mention: success,failure | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |