From 53aabfdf9fdb3c49ce09dd20d3e460a5026165f4 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:51:33 +0530 Subject: [PATCH 01/19] Add files via upload Adding Jenkinsfile --- Jenkinsfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..e69de29bb2 From c61ec67a70caed4626b60c01e68da17aa9ef4691 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:54:16 +0530 Subject: [PATCH 02/19] Update Jenkinsfile --- Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index e69de29bb2..4e7f7a064b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -0,0 +1,17 @@ +pipeline{ + agent any + + stages{ + stage("Verify Branch"){ + steps{ + echo "$GTI_BRANCH" + } + } + + stage("Docker Build"){ + steps{ + sh(script: 'docker conpose build') + } + } + } +} From 172482e20ddd5a125d6655f8a322eedc561cdeed Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:55:56 +0530 Subject: [PATCH 03/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4e7f7a064b..9ac81b1e43 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline{ stages{ stage("Verify Branch"){ steps{ - echo "$GTI_BRANCH" + echo "$GIT_BRANCH" } } From 66ad49accb2b8629f16dc41a7390773759f9a2ff Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:06:34 +0530 Subject: [PATCH 04/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ac81b1e43..e2cfb51a0e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline{ stage("Docker Build"){ steps{ - sh(script: 'docker conpose build') + sh(script: 'docker compose build') } } } From c600cc2937d3fff5c5f30e3ae5bfde1741d8c81a Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Thu, 6 Feb 2025 13:10:06 +0530 Subject: [PATCH 05/19] Update docker-compose.yaml correction in version of docker compose file --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1e868d2ebc..594e2967d6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3' +version: '3.8' services: azure-vote-back: image: mcr.microsoft.com/oss/bitnami/redis:6.0.8 From 08f320dbec5cc1569b57a0447c29628fc2d574f2 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 13:05:09 +0530 Subject: [PATCH 06/19] Update Jenkinsfile added startapp and test steps in jenkinsfile --- Jenkinsfile | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e2cfb51a0e..d35539cfeb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,8 +10,34 @@ pipeline{ stage("Docker Build"){ steps{ - sh(script: 'docker compose build') + sh(script: 'docker conpose build') } } + + stage("Start App"){ + steps{ + sh(script: 'docker compose up -d') + } + } + + stage("Run Tests"){ + steps{ + sh(script: "pytest ./tests/test_sample.py") + } + post{ + success { + echo "Test Passed :)" + } + failure { + echo "Test Failed :(" + } + } + } + } +} + +post{ + always{ + sh(script: 'docker compose down') } } From f2d8193015fd3b948db11d1e2faef238d5aae33a Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:32:18 +0530 Subject: [PATCH 07/19] Update Jenkinsfile corrected docker compose command --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d35539cfeb..ce3cf2dfea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline{ stage("Docker Build"){ steps{ - sh(script: 'docker conpose build') + sh(script: 'docker compose build') } } From c9fff3733c873fb3115af7baaeaf8dd2e2643d35 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:35:43 +0530 Subject: [PATCH 08/19] Update docker-compose.yaml change in port of docker file since 8080 port is already occupied --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 594e2967d6..9a9e0b480a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,4 +15,4 @@ services: environment: REDIS: azure-vote-back ports: - - "8080:80" + - "9000:9000" From f8b7aacc4140af25d648fd5d3a469a93d096c689 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 14:37:53 +0530 Subject: [PATCH 09/19] Update azure-vote-all-in-one-redis.yaml change in port from 80 to 9000 --- azure-vote-all-in-one-redis.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-vote-all-in-one-redis.yaml b/azure-vote-all-in-one-redis.yaml index 75b6822824..31c37b52ff 100644 --- a/azure-vote-all-in-one-redis.yaml +++ b/azure-vote-all-in-one-redis.yaml @@ -59,7 +59,7 @@ spec: - name: azure-vote-front image: mcr.microsoft.com/azuredocs/azure-vote-front:v1 ports: - - containerPort: 80 + - containerPort: 9000 resources: requests: cpu: 250m @@ -76,6 +76,6 @@ metadata: spec: type: LoadBalancer ports: - - port: 80 + - port: 9000 selector: app: azure-vote-front From a9ec19e8d4d76602f716bb49cb9f753e940498f0 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:38:19 +0530 Subject: [PATCH 10/19] Update docker-compose.yaml --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 9a9e0b480a..1e868d2ebc 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,4 @@ -version: '3.8' +version: '3' services: azure-vote-back: image: mcr.microsoft.com/oss/bitnami/redis:6.0.8 @@ -15,4 +15,4 @@ services: environment: REDIS: azure-vote-back ports: - - "9000:9000" + - "8080:80" From 96c69d7ccd121179f0c012225f880348a451c098 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:38:55 +0530 Subject: [PATCH 11/19] Update azure-vote-all-in-one-redis.yaml --- azure-vote-all-in-one-redis.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-vote-all-in-one-redis.yaml b/azure-vote-all-in-one-redis.yaml index 31c37b52ff..75b6822824 100644 --- a/azure-vote-all-in-one-redis.yaml +++ b/azure-vote-all-in-one-redis.yaml @@ -59,7 +59,7 @@ spec: - name: azure-vote-front image: mcr.microsoft.com/azuredocs/azure-vote-front:v1 ports: - - containerPort: 9000 + - containerPort: 80 resources: requests: cpu: 250m @@ -76,6 +76,6 @@ metadata: spec: type: LoadBalancer ports: - - port: 9000 + - port: 80 selector: app: azure-vote-front From b777cb6ed306924a5f97c4b91cba461221f3c485 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:46:24 +0530 Subject: [PATCH 12/19] Update Jenkinsfile trying to change the port from 8080 to 8085 since jenkins is running on 8080 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ce3cf2dfea..3625f76012 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ stage("Start App"){ steps{ - sh(script: 'docker compose up -d') + sh(script: 'docker compose up -d -p 8085:8080') } } From 9f58875dd08a6ec63b24972482be1491a3340d7d Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:51:24 +0530 Subject: [PATCH 13/19] Update docker-compose.yaml port changed from 8080 to 8081 --- docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1e868d2ebc..d3fffe493d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,4 +15,4 @@ services: environment: REDIS: azure-vote-back ports: - - "8080:80" + - "8081:80" From 84091b6ec7704033e4e7d0e23b23b3e4a1629be1 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:53:24 +0530 Subject: [PATCH 14/19] Update Jenkinsfile reverted back to normal docker compose command --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3625f76012..a51eb93fa3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ stage("Start App"){ steps{ - sh(script: 'docker compose up -d -p 8085:8080') + sh(script: 'docker compose up -d ') } } From e7063a4a83edf3473319beb268e8307f744b7ba9 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:12:27 +0530 Subject: [PATCH 15/19] Add files via upload --- tests/test_sample.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/test_sample.py diff --git a/tests/test_sample.py b/tests/test_sample.py new file mode 100644 index 0000000000..e3d8ae9ef6 --- /dev/null +++ b/tests/test_sample.py @@ -0,0 +1,5 @@ +def inc(x): + return x+1 + +def test_answer(): + assert inc(3) == 5 \ No newline at end of file From f1f4c6cb7bf647c7c62e5518436d168914398e8d Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:19:31 +0530 Subject: [PATCH 16/19] Update test_sample.py changing test conditions --- tests/test_sample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_sample.py b/tests/test_sample.py index e3d8ae9ef6..31eb313fc3 100644 --- a/tests/test_sample.py +++ b/tests/test_sample.py @@ -2,4 +2,4 @@ def inc(x): return x+1 def test_answer(): - assert inc(3) == 5 \ No newline at end of file + assert inc(4) == 5 From c8230c7b16e2d2d553767667efcc80d698378592 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Fri, 7 Feb 2025 18:23:45 +0530 Subject: [PATCH 17/19] Update Jenkinsfile trying to fix the post function issue of docker compose down command not working. --- Jenkinsfile | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a51eb93fa3..5e5792fa11 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,30 +1,30 @@ -pipeline{ +pipeline { agent any - stages{ - stage("Verify Branch"){ - steps{ + stages { + stage("Verify Branch") { + steps { echo "$GIT_BRANCH" } } - stage("Docker Build"){ - steps{ + stage("Docker Build") { + steps { sh(script: 'docker compose build') } } - stage("Start App"){ - steps{ - sh(script: 'docker compose up -d ') + stage("Start App") { + steps { + sh(script: 'docker compose up -d') } } - stage("Run Tests"){ - steps{ + stage("Run Tests") { + steps { sh(script: "pytest ./tests/test_sample.py") } - post{ + post { success { echo "Test Passed :)" } @@ -34,10 +34,11 @@ pipeline{ } } } -} -post{ - always{ - sh(script: 'docker compose down') + post { + always { + echo "Cleaning up..." + sh(script: 'docker compose down') + } } } From 2fac763a66026a796ea5df4eb11a961b58932cde Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Sun, 9 Feb 2025 14:15:41 +0530 Subject: [PATCH 18/19] Update Jenkinsfile Trying to do some changes in jenkins file for better build results. --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e5792fa11..90c1a9f846 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,25 +4,27 @@ pipeline { stages { stage("Verify Branch") { steps { - echo "$GIT_BRANCH" + echo "${env.GIT_BRANCH}" } } stage("Docker Build") { steps { - sh(script: 'docker compose build') + sh 'docker compose build' } } stage("Start App") { steps { - sh(script: 'docker compose up -d') + sh 'docker --version' + sh 'docker compose --version' + sh 'docker compose up -d' } } stage("Run Tests") { steps { - sh(script: "pytest ./tests/test_sample.py") + sh "pytest ./tests/test_sample.py" } post { success { @@ -38,7 +40,7 @@ pipeline { post { always { echo "Cleaning up..." - sh(script: 'docker compose down') + sh 'docker compose down' } } } From 6a67eb557b1641525357a7107f7e4b0b0f4feaa5 Mon Sep 17 00:00:00 2001 From: Meghal Mathankar <167750099+mmathank26@users.noreply.github.com> Date: Sun, 9 Feb 2025 14:22:09 +0530 Subject: [PATCH 19/19] Update Jenkinsfile made changes for the sh command not found interuption. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 90c1a9f846..3c70c436e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,7 @@ pipeline { stage("Run Tests") { steps { - sh "pytest ./tests/test_sample.py" + sh 'pytest ./tests/test_sample.py' } post { success {