-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (126 loc) · 5.17 KB
/
KakeysBakery20240319120850.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
name: Build and deploy .NET Core application to Web App KakeysBakery20240319120850
on:
push:
branches: [main]
env:
AZURE_WEBAPP_NAME: KakeysBakery20240319120850
AZURE_WEBAPP_PACKAGE_PATH: KakeysBakery/published
CONFIGURATION: Release
WORKING_DIRECTORY: KakeysBakery
jobs:
Build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Restore
run: |
dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Lint
run: |
cd KakeysBakery
dotnet format --verify-no-changes --severity warn
- name: Build
run: |
dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore /warnaserror
# - name: Run Test Suite
# run: |
# cd ./KakeysBakery.Tests/
# dotnet test
# - name: Compile Code Coverage
# run: |
# cd KakeysBakery.Tests
# rm -rf TestResults || true
# dotnet test --collect:"XPlat Code Coverage"
# pycobertura show --format html --output /home/garion/coverage.html */*/*/coverage.cobertura.xml -s Search
# cd ..
# - name: Publish
# run: |
# dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
# - name: Publish Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: webapp
# path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: Microsoft Teams Notification
uses: skitionek/notify-microsoft-teams@master
if: success()
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
- name: Microsoft Teams Notification (On Failure)
if: failure()
uses: skitionek/notify-microsoft-teams@master
with:
webhook_url: ${{ secrets.MSTEAMS_WEBHOOK }}
needs: ${{ toJson(needs) }}
job: ${{ toJson(job) }}
steps: ${{ toJson(steps) }}
overwrite: "{title: `Runner failed! ${workflow_link}`}"
# docker:
# runs-on: self-hosted
# needs: build
# steps:
# - name: Docker Down
# run: |
# cd ./docker-staging
# docker compose down -v
# - name: Docker Up
# run: |
# cd ./docker-staging
# docker compose up --build -d
kubernetes:
runs-on: self-hosted
needs: Build
steps:
- name: Kubectl Up
run: |
export NAMESPACE="kakey-1"
docker build -t 144.17.92.12:5000/kakey-1/blazor-web:$GITHUB_RUN_ID .
docker push 144.17.92.12:5000/kakey-1/blazor-web:$GITHUB_RUN_ID
cd KakeysBakery.Tests
kubectl -n $NAMESPACE delete configmap blazor-web-postgres-init || true
kubectl -n $NAMESPACE create configmap blazor-web-postgres-init --from-file=Apr15ddl.sql
cd ../
cd Telemetry/kube-configs
kubectl -n $NAMESPACE delete configmap grafana-datasource-config || true
kubectl -n $NAMESPACE create configmap grafana-datasource-config --from-file=grafana-datasource.yml
kubectl -n $NAMESPACE delete configmap grafana-dashboard-config || true
kubectl -n $NAMESPACE create configmap grafana-dashboard-config --from-file=dashboard.json
kubectl -n $NAMESPACE delete configmap loki-config || true
kubectl -n $NAMESPACE create configmap loki-config --from-file=loki-config.yml
kubectl -n $NAMESPACE delete configmap otel-config || true
kubectl -n $NAMESPACE create configmap otel-config --from-file=otel-collector-config.yml
kubectl -n $NAMESPACE delete configmap prometheus-config || true
kubectl -n $NAMESPACE create configmap prometheus-config --from-file=prometheus-config.yml
kubectl -n $NAMESPACE delete configmap blackbox-config || true
kubectl -n $NAMESPACE create configmap blackbox-config --from-file=blackbox-config.yml
cd ../../
kubectl -n $NAMESPACE delete svc blazor-web-db-service || true
kubectl -n $NAMESPACE delete ingress kakey-blazor-ingress || true
kubectl -n $NAMESPACE delete deployment blazor-web-db-deployment || true
kubectl -n $NAMESPACE delete deployment kakey-blazor-web-deployment || true
for file in ./Telemetry/kube/*; do
echo "Applying $file"
cat $file | envsubst | kubectl apply -f -
done
# deploy:
# runs-on: self-hosted
# needs: Build
# steps:
# - name: Download artifact from build job
# uses: actions/download-artifact@v4
# with:
# name: webapp
# path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
# - name: Deploy to Azure WebApp
# uses: azure/webapps-deploy@v3
# with:
# app-name: ${{ env.AZURE_WEBAPP_NAME }}
# publish-profile: ${{ secrets.KakeysBakery20240319120850_0A13 }}
# package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}