-
Notifications
You must be signed in to change notification settings - Fork 24
151 lines (147 loc) · 7.62 KB
/
dapr-longhaul-weekly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#
# 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 }}