Added dashboard in kube configs #301
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: 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 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 }} |