From 215579683597b5df285fc15a7fcac4f515791c53 Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:32:26 +0530
Subject: [PATCH 1/6] Create main.yml

---
 .github/workflows/main.yml | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 .github/workflows/main.yml

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 00000000..cae15e34
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,35 @@
+name: eShop build
+
+on:
+  push:
+    paths:
+    - 'src/Services/Coupon/**'
+    - 'tests/Services/Coupon/**'
+    branches: [ main ]
+
+jobs:
+  build-and-push-docker-image:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Get code from the repository
+      uses: actions/checkout@v1
+      with:
+        ref: main
+
+    - name: Run unit tests
+      run: dotnet test tests/Services/Coupon/*.Tests/*.csproj
+      env:
+        DOTNET_CLI_TELEMETRY_OPTOUT: true
+        DOTNET_NOLOGO: true
+
+    - name: Build and push Docker image
+      uses: docker/build-push-action@v1.1.0
+      with:
+        username: ${{ secrets.REGISTRY_USERNAME }}
+        password: ${{ secrets.REGISTRY_PASSWORD }}
+        registry: ${{ secrets.REGISTRY_LOGIN_SERVER }}
+        path: .
+        dockerfile: './src/Services/Coupon/Coupon.API/Dockerfile.acr'
+        repository: 'coupon.api'
+        tags: 'linux-net6-coupon'
+        push: true

From be84581336c664bc394ffc2ee98b9f2d90d22622 Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:33:37 +0530
Subject: [PATCH 2/6] Update CouponController.cs

---
 src/Services/Coupon/Coupon.API/Controllers/CouponController.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Services/Coupon/Coupon.API/Controllers/CouponController.cs b/src/Services/Coupon/Coupon.API/Controllers/CouponController.cs
index 40503ef8..89bb185a 100644
--- a/src/Services/Coupon/Coupon.API/Controllers/CouponController.cs
+++ b/src/Services/Coupon/Coupon.API/Controllers/CouponController.cs
@@ -54,7 +54,7 @@ public async Task<ActionResult<CouponDto>> GetCouponByCodeAsync(string code)
 
             var couponDto = _mapper.Translate(coupon);
 
-            // Add LogInformation call
+            _logger.LogInformation("Applying coupon {CouponCode}", code);
 
             return couponDto;
         }

From 3de65f65b0e3a832d1c2a85d4b7c798d7e00eacb Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:38:21 +0530
Subject: [PATCH 3/6] Update CouponControllerTests.cs

---
 .../Coupon.API.Tests/Controllers/CouponControllerTests.cs       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/Services/Coupon/Coupon.API.Tests/Controllers/CouponControllerTests.cs b/tests/Services/Coupon/Coupon.API.Tests/Controllers/CouponControllerTests.cs
index bb06d0fe..d7d1a098 100644
--- a/tests/Services/Coupon/Coupon.API.Tests/Controllers/CouponControllerTests.cs
+++ b/tests/Services/Coupon/Coupon.API.Tests/Controllers/CouponControllerTests.cs
@@ -7,7 +7,7 @@ public class CouponControllerTests
         [Fact]
         public void Test1()
         {
-            Assert.True(false);
+            Assert.True(true);
         }
     }
 }

From fb3543d90fcfc6416e46de82519bc4be63bbdf18 Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:47:26 +0530
Subject: [PATCH 4/6] Create deploy.yml

---
 .github/workflows/deploy.yml | 40 ++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 .github/workflows/deploy.yml

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 00000000..abd63f3c
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,40 @@
+name: eShop deploy
+
+on:
+  push:
+    paths:
+    - 'deploy/k8s/helm-simple/coupon/*'
+    branches: [ main ]
+
+jobs:
+  deploy-to-aks:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Azure Login
+      uses: azure/login@v1.4.5
+      with:
+        creds: ${{ secrets.AZURE_CREDENTIALS }}
+
+    - name: Azure Kubernetes set context
+      uses: Azure/aks-set-context@v2
+      with:
+        resource-group: 'eshop-learn-rg'
+        cluster-name: 'eshop-learn-aks'
+
+    - name: Get code from the repository
+      uses: actions/checkout@v3
+      with:
+        ref: main
+
+    - name: Helm tool installer
+      uses: Azure/setup-helm@v1
+
+    - name: Deploy
+      run: >
+        helm upgrade 
+        --install eshoplearn-coupon
+        --namespace=default 
+        --set registry=${{ secrets.REGISTRY_LOGIN_SERVER }} 
+        --set imagePullPolicy=Always 
+        --set host=${{ secrets.IP_ADDRESS }} 
+        --set protocol=http './deploy/k8s/helm-simple/coupon'

From a3cce224df7a7a36d70c202c36af72f1c8474e1e Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:48:15 +0530
Subject: [PATCH 5/6] Update Chart.yaml

---
 deploy/k8s/helm-simple/coupon/Chart.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/deploy/k8s/helm-simple/coupon/Chart.yaml b/deploy/k8s/helm-simple/coupon/Chart.yaml
index 9f338f68..92e14612 100644
--- a/deploy/k8s/helm-simple/coupon/Chart.yaml
+++ b/deploy/k8s/helm-simple/coupon/Chart.yaml
@@ -18,4 +18,4 @@ version: 0.1.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application.
-appVersion: 1.0.0
+appVersion: 1.1.0

From a3594e65dc33ab1d36dca7de3c8e69f32b074c4b Mon Sep 17 00:00:00 2001
From: AFSAL KC <nkcafsal@gmail.com>
Date: Mon, 19 Jun 2023 16:52:53 +0530
Subject: [PATCH 6/6] Update Chart.yaml

---
 deploy/k8s/helm-simple/coupon/Chart.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/deploy/k8s/helm-simple/coupon/Chart.yaml b/deploy/k8s/helm-simple/coupon/Chart.yaml
index 92e14612..47ebf935 100644
--- a/deploy/k8s/helm-simple/coupon/Chart.yaml
+++ b/deploy/k8s/helm-simple/coupon/Chart.yaml
@@ -18,4 +18,4 @@ version: 0.1.0
 
 # This is the version number of the application being deployed. This version number should be
 # incremented each time you make changes to the application.
-appVersion: 1.1.0
+appVersion: 1.2.0