diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 00000000..e2ad34e3
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,40 @@
+name: Azure Bicep-Advanced
+
+on:
+ workflow_dispatch:
+ inputs:
+ appenv:
+ type: choice
+ description: Choose the target environment
+ options:
+ - dev
+ - test
+ - prod
+
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pages: write
+ id-token: write
+ steps:
+ # Checkout code
+ - uses: actions/checkout@main
+
+ # Log into Azure
+ - uses: azure/login@v2.1.1
+ with:
+ client-id: ${{ secrets.AZURE_CLIENT_ID }}
+ tenant-id: ${{ secrets.AZURE_TENANT_ID }}
+ subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
+ enable-AzPSSession: true
+
+ # Deploy ARM template
+ - name: Run ARM deploy
+ uses: azure/arm-deploy@v1
+ with:
+ subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
+ resourceGroupName: ${{ secrets.AZURE_RG }}
+ template: ./src/InfrastructureAsCode/main.bicep
+ parameters: environment=${{ github.event.inputs.appenv }}
\ No newline at end of file
diff --git a/.github/workflows/dotnet-deploy.yml b/.github/workflows/dotnet-deploy.yml
new file mode 100644
index 00000000..c6b74643
--- /dev/null
+++ b/.github/workflows/dotnet-deploy.yml
@@ -0,0 +1,136 @@
+name: .NET CI
+
+env:
+ registryName: qkycf2fsjozsgmpnpreg.azurecr.io
+ repositoryName: techexcel/dotnetcoreapp
+ dockerFolderPath: ./src/Application/src/RazorPagesTestSample
+ tag: ${{github.run_number}}
+
+on:
+ push:
+ branches: [ main ]
+ paths: src/Application/**
+ pull_request:
+ branches: [ main ]
+ paths: src/Application/**
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 8.0
+
+ - name: Restore dependencies
+ run: dotnet restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
+ - name: Build
+ run: dotnet build --no-restore ./src/Application/src/RazorPagesTestSample/RazorPagesTestSample.csproj
+ - name: Test
+ run: dotnet test --no-build --verbosity normal ./src/Application/tests/RazorPagesTestSample.Tests/RazorPagesTestSample.Tests.csproj
+
+ - uses: actions/github-script@v6
+ if: failure()
+ with:
+ github-token: ${{secrets.GITHUB_TOKEN}}
+ script: |
+ let body = "${{ env.build_name }} Workflow Failure \n Build Number: ${{ github.run_number }} \n Build Log: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \n SHA: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) \n";
+ github.issues.create({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ title: "${{ env.build_name }} Workflow ${{ github.run_number }} Failed! ",
+ body: body
+ });
+
+ dockerBuildPush:
+ runs-on: ubuntu-latest
+ needs: build
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Docker Login
+ # You may pin to the exact commit or the version.
+ # uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
+ uses: docker/login-action@v1.9.0
+ with:
+ # Server address of Docker registry. If not set then will default to Docker Hub
+ registry: ${{ secrets.ACR_LOGIN_SERVER }}
+ # Username used to log against the Docker registry
+ username: ${{ secrets.ACR_USERNAME }}
+ # Password or personal access token used to log against the Docker registry
+ password: ${{ secrets.ACR_PASSWORD }}
+ # Log out from the Docker registry at the end of a job
+ logout: true
+
+ - name: Docker Build
+ run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
+
+ - name: Docker Push
+ run: docker push $registryName/$repositoryName:$tag
+
+ deploy-to-dev:
+
+ runs-on: ubuntu-latest
+ needs: dockerBuildPush
+ environment:
+ name: dev
+ url: https://qkycf2fsjozsg-dev.azurewebsites.net/
+
+ steps:
+ - name: 'Login via Azure CLI'
+ uses: azure/login@v2.1.1
+ with:
+ creds: ${{ secrets.AZURE_CREDENTIALS }}
+
+ - uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'qkycf2fsjozsg-dev'
+ images: qkycf2fsjozsgmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
+
+ deploy-to-test:
+
+ runs-on: ubuntu-latest
+ needs: deploy-to-dev
+ environment:
+ name: test
+ url: https://qkycf2fsjozsg-test.azurewebsites.net/
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: 'Login via Azure CLI'
+ uses: azure/login@v2.1.1
+ with:
+ creds: ${{ secrets.AZURE_CREDENTIALS }}
+
+ - uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'qkycf2fsjozsg-test'
+ images: qkycf2fsjozsgmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
+
+ deploy-to-prod:
+
+ runs-on: ubuntu-latest
+ needs: deploy-to-test
+ environment:
+ name: prod
+ url: https://qkycf2fsjozsg-prod.azurewebsites.net/
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: 'Login via Azure CLI'
+ uses: azure/login@v2.1.1
+ with:
+ creds: ${{ secrets.AZURE_CREDENTIALS }}
+
+ - uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'qkycf2fsjozsg-prod'
+ images: qkycf2fsjozsgmpnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
diff --git a/.github/workflows/first-workflow.yml b/.github/workflows/first-workflow.yml
new file mode 100644
index 00000000..09ec8cbc
--- /dev/null
+++ b/.github/workflows/first-workflow.yml
@@ -0,0 +1,23 @@
+name: First Workflow
+
+on:
+ workflow_dispatch:
+ issues:
+ types: [opened]
+
+jobs:
+ job1:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Step one
+ run: echo "Log from step one"
+ - name: Step two
+ run: echo "Log from step two"
+
+ job2:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Step two
+ run: echo "Log from step two"
\ No newline at end of file
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
deleted file mode 100644
index cedae546..00000000
--- a/.github/workflows/pages.yml
+++ /dev/null
@@ -1,62 +0,0 @@
-# This workflow uses actions that are not certified by GitHub.
-# They are provided by a third-party and are governed by
-# separate terms of service, privacy policy, and support
-# documentation.
-
-# Sample workflow for building and deploying a Jekyll site to GitHub Pages
-name: Deploy Jekyll site to Pages
-
-on:
- push:
- branches: ["main"]
-
- # Allows you to run this workflow manually from the Actions tab
- workflow_dispatch:
-
-# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
-permissions:
- contents: read
- pages: write
- id-token: write
-
-# Allow one concurrent deployment
-concurrency:
- group: "pages"
- cancel-in-progress: true
-
-jobs:
- # Build job
- build:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Setup Ruby
- uses: ruby/setup-ruby@v1
- with:
- ruby-version: '3.1' # Not needed with a .ruby-version file
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- cache-version: 0 # Increment this number if you need to re-download cached gems
- - name: Setup Pages
- id: pages
- uses: actions/configure-pages@v2
- - name: Build with Jekyll
- # Outputs to the './_site' directory by default
- run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
- env:
- JEKYLL_ENV: production
- - name: Upload artifact
- # Automatically uploads an artifact from the './_site' directory by default
- uses: actions/upload-pages-artifact@v1
-
- # Deployment job
- deploy:
- environment:
- name: github-pages
- url: "${{ steps.deployment.outputs.page_url }}"
- runs-on: ubuntu-latest
- needs: build
- steps:
- - name: Deploy to GitHub Pages
- id: deployment
- uses: actions/deploy-pages@v1
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..5dabb895
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "sarif-viewer.connectToGithubCodeScanning": "off"
+}
\ No newline at end of file
diff --git a/Solution/Exercise-03/Task-3/dotnet-deploy-3.yml b/Solution/Exercise-03/Task-3/dotnet-deploy-3.yml
index 19bb9a4a..8bd09b75 100644
--- a/Solution/Exercise-03/Task-3/dotnet-deploy-3.yml
+++ b/Solution/Exercise-03/Task-3/dotnet-deploy-3.yml
@@ -1,7 +1,7 @@
name: .NET CI
env:
- registryName: {your_registry_name}.azurecr.io
+ registryName: qkycf2fsjozsgmpnpreg.azurecr.io
repositoryName: techexcel/dotnetcoreapp
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
tag: ${{github.run_number}}
@@ -67,7 +67,7 @@ jobs:
needs: dockerBuildPush
environment:
name: dev
- url: https://{your_prefix}-dev.azurewebsites.net/
+ url: https://qkycf2fsjozsg-dev.azurewebsites.net/
steps:
- name: 'Login via Azure CLI'
@@ -77,8 +77,8 @@ jobs:
- uses: azure/webapps-deploy@v2
with:
- app-name: '{your_prefix}-dev'
- images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
+ app-name: 'qkycf2fsjozsg-dev'
+ images: registryName.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
deploy-to-test:
@@ -86,7 +86,7 @@ jobs:
needs: deploy-to-dev
environment:
name: test
- url: https://{your_prefix}-test.azurewebsites.net/
+ url: https://qkycf2fsjozsg-test.azurewebsites.net/
steps:
- uses: actions/checkout@v3
@@ -98,8 +98,8 @@ jobs:
- uses: azure/webapps-deploy@v2
with:
- app-name: '{your_prefix}-test'
- images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
+ app-name: 'qkycf2fsjozsg-test'
+ images: registryName.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
deploy-to-prod:
@@ -107,7 +107,7 @@ jobs:
needs: deploy-to-test
environment:
name: prod
- url: https://{your_prefix}-prod.azurewebsites.net/
+ url: https://qkycf2fsjozsg-prod.azurewebsites.net/
steps:
- uses: actions/checkout@v3
@@ -119,5 +119,5 @@ jobs:
- uses: azure/webapps-deploy@v2
with:
- app-name: '{your_prefix}-prod'
- images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
+ app-name: 'qkycf2fsjozsg-prod'
+ images: registryName.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
diff --git a/src/Application/src/RazorPagesTestSample/Data/Message.cs b/src/Application/src/RazorPagesTestSample/Data/Message.cs
index ea99cbd6..d66364f2 100644
--- a/src/Application/src/RazorPagesTestSample/Data/Message.cs
+++ b/src/Application/src/RazorPagesTestSample/Data/Message.cs
@@ -1,16 +1,27 @@
using System.ComponentModel.DataAnnotations;
-namespace RazorPagesTestSample.Data
+///