deploy-longhaul-weekly #74
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
# | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: deploy-longhaul-weekly | |
on: | |
schedule: | |
- cron: '0 7 * * 5' # Fridays, 7am UTC | |
workflow_dispatch: | |
jobs: | |
test-nightly: | |
name: update dapr runtime with the head of master and run longhaul tests | |
runs-on: ubuntu-latest | |
env: | |
KUBECTLVER: v1.19.3 | |
GOOS: linux | |
GOARCH: amd64 | |
GOPROXY: https://proxy.golang.org | |
DAPR_REGISTRY: daprtests.azurecr.io | |
DAPR_TEST_REGISTRY: daprtests.azurecr.io | |
HELMVER: v3.7.2 | |
MAX_TEST_TIMEOUT: 5400 | |
HA_MODE: true | |
DAPR_TAG : dev | |
TEST_OUTPUT_FILE_PREFIX: test_report | |
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | |
DAPR_NAMESPACE: dapr-system | |
DAPR_MONITORING: dapr-monitoring | |
DAPR_COMPONENTS: dapr-components | |
TEST_CLUSTER: aks-longhaul-weekly | |
TEST_RESOURCE_GROUP: aks-longhaul-weekly | |
DAPR_CHECKOUT_REPO: dapr/dapr | |
DAPR_CHECKOUT_REF: refs/heads/master | |
APP_NAMESPACE: longhaul-test | |
steps: | |
# Environment setup. | |
- name: Set up container log path | |
run: | | |
echo "DAPR_CONTAINER_LOG_PATH=$GITHUB_WORKSPACE/container_logs/${{ matrix.target_os }}_${{ matrix.target_arch }}" | sed 's/\\/\//g' >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout dapr/dapr | |
uses: actions/checkout@v2 | |
with: | |
repository: ${{ env.DAPR_CHECKOUT_REPO }} | |
ref: ${{ env.DAPR_CHECKOUT_REF }} | |
path: dapr | |
- name: Set up Go ${{ env.GOVER }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: "dapr/go.mod" | |
- name: Checkout dapr/test-infra | |
uses: actions/checkout@v2 | |
with: | |
repository: dapr/test-infra | |
ref: refs/heads/master | |
path: longhaul | |
- uses: azure/setup-kubectl@v3 | |
with: | |
version: ${{ env.KUBECTLVER }} | |
id: install | |
- name: Set up Helm ${{ env.HELMVER }} | |
uses: azure/setup-helm@v1 | |
with: | |
version: ${{ env.HELMVER }} | |
- name: Azure login | |
run: | | |
az login --service-principal -u ${{ secrets.AZURE_LOGIN_USER }} -p ${{ secrets.AZURE_LOGIN_PASS }} --tenant ${{ secrets.AZURE_TENANT }} --output none | |
- name: Find the test cluster | |
run: az aks get-credentials -n ${{ env.TEST_CLUSTER }} -g ${{ env.TEST_RESOURCE_GROUP }} | |
shell: bash | |
# Setup docker and build image | |
- name: docker login | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ secrets.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASS }} | |
- name: Build dapr and its docker image and push them to test registry | |
working-directory: ./dapr | |
run: | | |
make build | |
make docker-build | |
make docker-push | |
# Setup monitoring | |
- name: Create monitoring namespace if it doesn't exist | |
run: | | |
kubectl get namespace | grep ${{ env.DAPR_MONITORING }} || kubectl create namespace ${{ env.DAPR_MONITORING }} | |
- name: check if grafana already exists | |
if: env.TEST_CLUSTER != '' | |
run: | | |
helm list -n ${{ env.DAPR_MONITORING }} | grep grafana && echo "GRAF_PRESENT=true" >> $GITHUB_ENV || echo "Grafana not present." | |
- name: Preparing ${{ env.TEST_CLUSTER }} cluster for test by installing grafana if not present | |
if: env.TEST_CLUSTER != '' && env.GRAF_PRESENT != 'true' | |
working-directory: ./longhaul | |
run: | | |
helm repo add grafana https://grafana.github.io/helm-charts | |
helm upgrade --install grafana grafana/grafana -n ${{ env.DAPR_MONITORING }} -f ./grafana-config/values.yaml | |
kubectl get pods -n ${{ env.DAPR_MONITORING }} | |
- name: check if prometheus already exists | |
if: env.TEST_CLUSTER != '' | |
run: | | |
helm list -n ${{ env.DAPR_MONITORING }} | grep prometheus && echo "PROM_PRESENT=true" >> $GITHUB_ENV || echo "Prometheus not present." | |
- name: Preparing ${{ env.TEST_CLUSTER }} cluster for test by installing prometheus if not present | |
if: env.TEST_CLUSTER != '' && env.PROM_PRESENT != 'true' | |
working-directory: ./longhaul | |
run: | | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm upgrade --install dapr-prom prometheus-community/prometheus -n ${{ env.DAPR_MONITORING }} -f ./prometheus-config/values.yaml --version 14.12.0 --set server.retention="30d" --set server.remoteWrite[0].basic_auth.password="${{ secrets.GRAFANA_PROM_KEY }}" | |
kubectl get pods -n ${{ env.DAPR_MONITORING }} | |
# Deploy dapr to k8s | |
- name: Create dapr namespace, if it doesn't exist | |
run: | | |
kubectl get namespace | grep ${{ env.DAPR_NAMESPACE }} || kubectl create namespace ${{ env.DAPR_NAMESPACE }} | |
- name: Deploy dapr to ${{ env.TEST_CLUSTER }} cluster | |
if: env.TEST_CLUSTER != '' | |
working-directory: ./dapr | |
run: | | |
helm list -n ${{ env.DAPR_NAMESPACE }} | grep dapr && helm uninstall -n ${{ env.DAPR_NAMESPACE }} dapr || echo "Dapr not present, no need to uninstall." | |
make docker-deploy-k8s | |
# Deploy external components | |
- name: Create component namespace, if it doesn't exist | |
run: | | |
kubectl get namespace | grep ${{ env.DAPR_COMPONENTS }} || kubectl create namespace ${{ env.DAPR_COMPONENTS }} | |
# Deploy all longhaul tests/components | |
- name: Create app namespace, if it doesn't exist | |
run: | | |
kubectl get namespace | grep ${{ env.APP_NAMESPACE }} || kubectl create namespace ${{ env.APP_NAMESPACE }} | |
- name: Deploy test applications | |
if: env.TEST_CLUSTER != '' | |
working-directory: ./longhaul | |
run: | | |
kubectl apply -f ./longhaul-test/feed-generator-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/feed-generator-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/hashtag-actor-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/hashtag-actor-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/hashtag-counter-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/hashtag-counter-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/message-analyzer-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/message-analyzer-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/pubsub-workflow-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/pubsub-workflow-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/snapshot-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/snapshot-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/validation-worker-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/validation-worker-app -n ${{ env.APP_NAMESPACE }} | |
kubectl apply -f ./longhaul-test/workflow-gen-deploy.yml -n ${{ env.APP_NAMESPACE }} && kubectl rollout restart deploy/workflow-gen-app -n ${{ env.APP_NAMESPACE }} | |