From ef82e518c98bcb1f86816576a0d9c88d25596da4 Mon Sep 17 00:00:00 2001 From: Anusha <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 14:40:23 +0530 Subject: [PATCH 01/17] Created Jenkinsfile --- frontend/Jenkinsfile | 93 ++++++++++++++++++++++++++++++++++++++++++++ server/Jenkinsfile | 93 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 frontend/Jenkinsfile create mode 100644 server/Jenkinsfile diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile new file mode 100644 index 0000000..19d7f52 --- /dev/null +++ b/frontend/Jenkinsfile @@ -0,0 +1,93 @@ +def agentLabel= 'ubuntu' +def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' +pipeline { + agent {label agentLabel} + options{ + diableConcurrentBuilds(abortPrevious: true) + } + stages{ + stage('Git Pull') { + steps { + cleanWs() + script{ + git branch:env.BRANCH_NAME, credentialsId: 'anusha-ssh', url: 'git@gitlab.pal.tech:siva.mirrapalli/tech-knights-ai-challenge.git' + branch = '${env.BRANCH_NAME.toLowerCase()}' + echo "${branch}" + } + if (("$branch").matches('dev(.*)')) { + port = '9802' + branch = 'dev' + } + else if (("$branch").matches('qa')) { + port = '9804' + branch = 'qa' + } + else if (("$branch").matches('main')) { + port = '9806' + branch = 'main' + } + + echo "${port}" + echo "${branch}" + + def build = currentBuild.previousBuild + while (build !=null){ + if (build.result == 'SUCCESS') { + lastSuccessfulBuildID = build.id as Integer + break + } + build = build.previousBuild + } + println lastSuccessfulBuildID + + } + } + + stage('Build Image') + { + steps { + "docker build -t talent-rover-ui-${$branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + } + } + stage('Delete Previous Container') + { + steps { + sh "docker container stop \$(docker container ls -q --filter name=talent-rover-ui-${branch}) || true" + sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-ui-${branch}) || true" + } + } + stage('Run container') + { + steps { + script{ + containerID = sh( + script: "docker run -d -p ${port}:3000 --network pt-net --name talent-rover-ui-${branch} talent-rover-ui-${branch}-b${BUILD_NUMBER}", + returnStdout: true + ).trim() + echo "Container ID is ==> ${containerID}" + sh "docker update --restart always ${containerID}" + sh "docker rmi \$(docker images -f=reference=talent-rover-ui-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\") || true" + + + } + } + } + + } + + post { + always { + script { + office365ConnectorSend ( + webhookUrl: webhookUrl, + message: "Please find status of pipeline: Status-<strong>${currentBuild.currentResult}</strong><br><strong>Branch: ${env.BRANCH_NAME}</strong><br>Job: ${env.JOB_NAME}<br>Repository URL: https://gitlab.pal.tech/siva.mirrapalli/tech-knights-ai-challenge.git" + + + ) + + } + } + + } + +} \ No newline at end of file diff --git a/server/Jenkinsfile b/server/Jenkinsfile new file mode 100644 index 0000000..478a64b --- /dev/null +++ b/server/Jenkinsfile @@ -0,0 +1,93 @@ +def agentLabel= 'ubuntu' +def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' +pipeline { + agent {label agentLabel} + options{ + diableConcurrentBuilds(abortPrevious: true) + } + stages{ + stage('Git Pull') { + steps { + cleanWs() + script{ + git branch:env.BRANCH_NAME, credentialsId: 'anusha-ssh', url: 'git@gitlab.pal.tech:siva.mirrapalli/tech-knights-ai-challenge.git' + branch = "${env.BRANCH_NAME.toLowerCase()}" + echo "${branch}" + } + if (("$branch").matches('dev(.*)')) { + port = '9803' + branch = 'dev' + } + else if (("$branch").matches('qa')) { + port = '9805' + branch = 'qa' + } + else if (("$branch").matches('main')) { + port = '9807' + branch = 'main' + } + + echo "${port}" + echo "${branch}" + + def build = currentBuild.previousBuild + while (build !=null){ + if (build.result == 'SUCCESS') { + lastSuccessfulBuildID = build.id as Integer + break + } + build = build.previousBuild + } + println lastSuccessfulBuildID + + } + } + + stage('Build Image') + { + steps { + "docker build -t talent-rover-api-${$branch}-b${BapiLD_NUMBER} -f Dockerfile --no-cache ." + } + } + stage('Delete Previous Container') + { + steps { + sh "docker container stop \$(docker container ls -q --filter name=talent-rover-api-${branch}) || true" + sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-api-${branch}) || true" + } + } + stage('Run container') + { + steps { + script{ + containerID = sh( + script: "docker run -d -p ${port}:3000 --network pt-net --name talent-rover-api-${branch} talent-rover-api-${branch}-b${BUILD_NUMBER}", + returnStdout: true + ).trim() + echo "Container ID is ==> ${containerID}" + sh "docker update --restart always ${containerID}" + sh "docker rmi \$(docker images -f=reference=talent-rover-api-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\") || true" + + + } + } + } + + } + + post { + always { + script { + office365ConnectorSend ( + webhookUrl: webhookUrl, + message: "Please find status of pipeline: Status-<strong>${currentBuild.currentResult}</strong><br><strong>Branch: ${env.BRANCH_NAME}</strong><br>Job: ${env.JOB_NAME}<br>Repository URL: https://gitlab.pal.tech/siva.mirrapalli/tech-knights-ai-challenge.git" + + + ) + + } + } + + } + +} \ No newline at end of file -- GitLab From eb59e990c31508f83827d7168740dcf850918c74 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 12:49:49 +0000 Subject: [PATCH 02/17] Updated Jenkinsfile - corrected the stage --- frontend/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 19d7f52..baaee2f 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { git branch:env.BRANCH_NAME, credentialsId: 'anusha-ssh', url: 'git@gitlab.pal.tech:siva.mirrapalli/tech-knights-ai-challenge.git' branch = '${env.BRANCH_NAME.toLowerCase()}' echo "${branch}" - } + if (("$branch").matches('dev(.*)')) { port = '9802' branch = 'dev' -- GitLab From 1c34e41a5aa6f3f8109875e9d6e845f1cc372f8e Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 12:53:19 +0000 Subject: [PATCH 03/17] Update Jenkinsfile --- frontend/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index baaee2f..540b8cc 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -90,4 +90,5 @@ pipeline { } +} } \ No newline at end of file -- GitLab From 5a75cbaff0b5a0927423edbe87984e39d4d13706 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 16:41:15 +0000 Subject: [PATCH 04/17] Update file Jenkinsfile --- frontend/Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 540b8cc..f42be5d 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -41,6 +41,7 @@ pipeline { println lastSuccessfulBuildID } + } } stage('Build Image') @@ -73,8 +74,8 @@ pipeline { } } - } - + } + post { always { script { @@ -91,4 +92,3 @@ pipeline { } } -} \ No newline at end of file -- GitLab From 64bceb7b47c4827d3a50be6e637a139676e03ac8 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 16:44:14 +0000 Subject: [PATCH 05/17] Update file Jenkinsfile --- frontend/Jenkinsfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index f42be5d..dd42758 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -2,9 +2,7 @@ def agentLabel= 'ubuntu' def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { agent {label agentLabel} - options{ - diableConcurrentBuilds(abortPrevious: true) - } + stages{ stage('Git Pull') { steps { @@ -47,14 +45,18 @@ pipeline { stage('Build Image') { steps { + script { "docker build -t talent-rover-ui-${$branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + } } } stage('Delete Previous Container') { steps { + script { sh "docker container stop \$(docker container ls -q --filter name=talent-rover-ui-${branch}) || true" sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-ui-${branch}) || true" + } } } stage('Run container') -- GitLab From f492fb01202bd95d7d6c3e9a50fc3a48c26c16b8 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 16:46:36 +0000 Subject: [PATCH 06/17] Update file Jenkinsfile --- frontend/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index dd42758..7f645e2 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -1,4 +1,5 @@ def agentLabel= 'ubuntu' +def port = '' def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { agent {label agentLabel} -- GitLab From ee60156695c3573f67e7b8fddc71f6e23f5531eb Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 16:49:03 +0000 Subject: [PATCH 07/17] Updated jenkinsfile --- frontend/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 7f645e2..0da44de 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -1,5 +1,5 @@ def agentLabel= 'ubuntu' -def port = '' +def port= '' def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { agent {label agentLabel} @@ -10,7 +10,7 @@ pipeline { cleanWs() script{ git branch:env.BRANCH_NAME, credentialsId: 'anusha-ssh', url: 'git@gitlab.pal.tech:siva.mirrapalli/tech-knights-ai-challenge.git' - branch = '${env.BRANCH_NAME.toLowerCase()}' + branch = env.BRANCH_NAME.toLowerCase() echo "${branch}" if (("$branch").matches('dev(.*)')) { -- GitLab From b551aa3c5c9b6fd8d1ec81fce1d8c09698aa51f3 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 16:55:48 +0000 Subject: [PATCH 08/17] Updated Jenkinsfile --- frontend/Jenkinsfile | 1 + server/Jenkinsfile | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 0da44de..b6cffe3 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -1,5 +1,6 @@ def agentLabel= 'ubuntu' def port= '' +def lastSuccessfulBuildID= 0 def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { agent {label agentLabel} diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 478a64b..0d45b02 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -1,10 +1,10 @@ def agentLabel= 'ubuntu' +def port= '' +def lastSuccessfulBuildID= 0 def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { agent {label agentLabel} - options{ - diableConcurrentBuilds(abortPrevious: true) - } + stages{ stage('Git Pull') { steps { @@ -46,14 +46,18 @@ pipeline { stage('Build Image') { steps { + script { "docker build -t talent-rover-api-${$branch}-b${BapiLD_NUMBER} -f Dockerfile --no-cache ." + } } } stage('Delete Previous Container') { steps { + script { sh "docker container stop \$(docker container ls -q --filter name=talent-rover-api-${branch}) || true" sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-api-${branch}) || true" + } } } stage('Run container') -- GitLab From 41b67dd8a566ffb32f8f1d0b155797f038cdcf95 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 17:01:20 +0000 Subject: [PATCH 09/17] Updated Jenkinsfile --- frontend/Jenkinsfile | 1 + server/Jenkinsfile | 1 + 2 files changed, 2 insertions(+) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index b6cffe3..b33fff5 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -1,5 +1,6 @@ def agentLabel= 'ubuntu' def port= '' +def branch= env.BRANCH_NAME def lastSuccessfulBuildID= 0 def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' pipeline { diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 0d45b02..3a7bfaf 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -1,4 +1,5 @@ def agentLabel= 'ubuntu' +def branch= env.BRANCH_NAME def port= '' def lastSuccessfulBuildID= 0 def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' -- GitLab From 95552cca5dcbca6992346dc9282da9c40c0a6105 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 17:06:49 +0000 Subject: [PATCH 10/17] Updated jenkinsfile-final --- frontend/Jenkinsfile | 2 +- server/Jenkinsfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index b33fff5..778ee2f 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -49,7 +49,7 @@ pipeline { { steps { script { - "docker build -t talent-rover-ui-${$branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } } diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 3a7bfaf..96fe808 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -48,7 +48,7 @@ pipeline { { steps { script { - "docker build -t talent-rover-api-${$branch}-b${BapiLD_NUMBER} -f Dockerfile --no-cache ." + "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } } -- GitLab From 1098c69e6c5b6fe9addf34be77d14f3b0885aa00 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 17:32:05 +0000 Subject: [PATCH 11/17] Update 2 files - /frontend/Jenkinsfile - /server/Jenkinsfile --- frontend/Jenkinsfile | 17 ++++++++--------- server/Jenkinsfile | 14 +++++++------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 778ee2f..c2e6384 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -45,10 +45,9 @@ pipeline { } } - stage('Build Image') - { + stage('Build Image') { steps { - script { + script{ "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } @@ -56,9 +55,9 @@ pipeline { stage('Delete Previous Container') { steps { - script { - sh "docker container stop \$(docker container ls -q --filter name=talent-rover-ui-${branch}) || true" - sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-ui-${branch}) || true" + script{ + sh "docker container stop \$(docker container ls -q --filter name=talent-rover-ui-${branch})||true" + sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-ui-${branch})||true" } } } @@ -68,11 +67,11 @@ pipeline { script{ containerID = sh( script: "docker run -d -p ${port}:3000 --network pt-net --name talent-rover-ui-${branch} talent-rover-ui-${branch}-b${BUILD_NUMBER}", - returnStdout: true - ).trim() + returnStdout: true + ).trim() echo "Container ID is ==> ${containerID}" sh "docker update --restart always ${containerID}" - sh "docker rmi \$(docker images -f=reference=talent-rover-ui-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\") || true" + sh "docker rmi \$(docker images -f=reference=talent-rover-ui-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\")||true" } diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 96fe808..1d5b173 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { stage('Build Image') { steps { - script { + script{ "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } @@ -55,9 +55,9 @@ pipeline { stage('Delete Previous Container') { steps { - script { - sh "docker container stop \$(docker container ls -q --filter name=talent-rover-api-${branch}) || true" - sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-api-${branch}) || true" + script{ + sh "docker container stop \$(docker container ls -q --filter name=talent-rover-api-${branch})||true" + sh "docker container rm -f \$(docker container ps -a -q --filter name=talent-rover-api-${branch})||true" } } } @@ -67,11 +67,11 @@ pipeline { script{ containerID = sh( script: "docker run -d -p ${port}:3000 --network pt-net --name talent-rover-api-${branch} talent-rover-api-${branch}-b${BUILD_NUMBER}", - returnStdout: true - ).trim() + returnStdout: true + ).trim() echo "Container ID is ==> ${containerID}" sh "docker update --restart always ${containerID}" - sh "docker rmi \$(docker images -f=reference=talent-rover-api-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\") || true" + sh "docker rmi \$(docker images -f=reference=talent-rover-api-${branch}-b${lastSuccessfulBuildID} --format \"{{.ID}}\")||true" } -- GitLab From ba4482605d5554d4d0afb1c23c7576c7022f1aa1 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Mon, 10 Mar 2025 17:35:31 +0000 Subject: [PATCH 12/17] updated jenkinsfile final --- frontend/Jenkinsfile | 2 +- server/Jenkinsfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index c2e6384..e9bf8c7 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -48,7 +48,7 @@ pipeline { stage('Build Image') { steps { script{ - "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + sh "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } } diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 1d5b173..0e4198f 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -48,7 +48,7 @@ pipeline { { steps { script{ - "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + sh "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." } } } -- GitLab From 82ff5d60f23707f6001afbd54b7af81d87a1a543 Mon Sep 17 00:00:00 2001 From: Anusha Mallipalli <anusha.mallipalli@pal.tech> Date: Tue, 11 Mar 2025 05:54:16 +0000 Subject: [PATCH 13/17] Updated Jenkinsfile with corrected Dockerfile --- frontend/Jenkinsfile | 2 +- server/Jenkinsfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index e9bf8c7..7ede4d2 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -48,7 +48,7 @@ pipeline { stage('Build Image') { steps { script{ - sh "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + sh "docker build -t talent-rover-ui-${branch}-b${BUILD_NUMBER} -f ./frontend/Dockerfile --no-cache ." } } } diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 0e4198f..14d1cde 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -48,7 +48,7 @@ pipeline { { steps { script{ - sh "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f Dockerfile --no-cache ." + sh "docker build -t talent-rover-api-${branch}-b${BUILD_NUMBER} -f ./server/Dockerfile --no-cache ." } } } -- GitLab From 04e1153fc6107ac45c5ea6dda7d8902f17044ddf Mon Sep 17 00:00:00 2001 From: Anusha <anusha.mallipalli@pal.tech> Date: Wed, 12 Mar 2025 14:50:05 +0530 Subject: [PATCH 14/17] package.json issue in jenkins --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 166bb87..f4f5b4f 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,7 @@ FROM node:20-alpine #setting workdir WORKDIR /app +COPY package*.json ./ #Copy code to the container COPY . . #install the npm modules -- GitLab From 15f6028b25a43537c2501933c5d3d900eabfd471 Mon Sep 17 00:00:00 2001 From: Anusha <anusha.mallipalli@pal.tech> Date: Wed, 12 Mar 2025 16:21:13 +0530 Subject: [PATCH 15/17] Updated Dockerfiles --- frontend/Dockerfile | 4 ++-- frontend/Jenkinsfile | 10 ++++++++++ server/Dockerfile | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index f4f5b4f..e9a04ff 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,9 +1,9 @@ FROM node:20-alpine #setting workdir WORKDIR /app -COPY package*.json ./ +COPY /frontend/package*.json ./ #Copy code to the container -COPY . . +COPY ./frontend . #install the npm modules RUN npm install #CMD npm run dev diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 7ede4d2..4b46ef6 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -45,6 +45,16 @@ pipeline { } } + stage('Add Configuration') { + steps { + script { + configFileProvider([configFile(fileId: "talent-rover-ui-${branch}", variable: 'ENV_CONFIG')]) { + sh 'cp $ENV_CONFIG ./frontend/.env' + } + } + } + } + stage('Build Image') { steps { script{ diff --git a/server/Dockerfile b/server/Dockerfile index 790eee6..07b5173 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,10 +1,10 @@ FROM python:3.12-bookworm RUN ldd --version -COPY ./requirements.txt /app/server/requirements.txt +COPY ./server/requirements.txt /app/server/requirements.txt WORKDIR /app RUN pip install -r server/requirements.txt -COPY . /app/server +COPY ./server /app/server EXPOSE 80 CMD quart --app server/main.py run --host=0.0.0.0 --port 80 -- GitLab From e95bde40e4927972a3f830861c2c4b430ab380b1 Mon Sep 17 00:00:00 2001 From: Anusha <anusha.mallipalli@pal.tech> Date: Wed, 12 Mar 2025 17:30:38 +0530 Subject: [PATCH 16/17] updated jenkinsfile --- frontend/Jenkinsfile | 2 +- server/Jenkinsfile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/Jenkinsfile b/frontend/Jenkinsfile index 4b46ef6..bf88d39 100644 --- a/frontend/Jenkinsfile +++ b/frontend/Jenkinsfile @@ -2,7 +2,7 @@ def agentLabel= 'ubuntu' def port= '' def branch= env.BRANCH_NAME def lastSuccessfulBuildID= 0 -def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' +def webhookUrl= 'https://paltech0.webhook.office.com/webhookb2/1ce07c79-9b4b-4e81-ab89-253715dccd77@1680abbe-1a01-4cb0-99e9-452fe05bf615/IncomingWebhook/81bb6c54ad3e4274a4e32cbd0d58e4f9/a74c3df4-0c59-455b-8969-c52e309262f8/V2hWINx0Q8UwZZ_4JmasiyDCZZrrqGluyVr1CBKvfQXRw1' pipeline { agent {label agentLabel} diff --git a/server/Jenkinsfile b/server/Jenkinsfile index 14d1cde..d1b98eb 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -2,7 +2,7 @@ def agentLabel= 'ubuntu' def branch= env.BRANCH_NAME def port= '' def lastSuccessfulBuildID= 0 -def webhookUrl= 'https://prod-25.centralindia.logic.azure.com:443/workflows/52e217ea6eb64dc69720309e9f8df539/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IPCvz9Zd3TkJUc3OUG7Gffcax7KJ6xm7i1KhjLsvBRM' +def webhookUrl= 'https://paltech0.webhook.office.com/webhookb2/1ce07c79-9b4b-4e81-ab89-253715dccd77@1680abbe-1a01-4cb0-99e9-452fe05bf615/IncomingWebhook/81bb6c54ad3e4274a4e32cbd0d58e4f9/a74c3df4-0c59-455b-8969-c52e309262f8/V2hWINx0Q8UwZZ_4JmasiyDCZZrrqGluyVr1CBKvfQXRw1' pipeline { agent {label agentLabel} @@ -14,7 +14,7 @@ pipeline { git branch:env.BRANCH_NAME, credentialsId: 'anusha-ssh', url: 'git@gitlab.pal.tech:siva.mirrapalli/tech-knights-ai-challenge.git' branch = "${env.BRANCH_NAME.toLowerCase()}" echo "${branch}" - } + if (("$branch").matches('dev(.*)')) { port = '9803' branch = 'dev' @@ -43,7 +43,9 @@ pipeline { } } + } + stage('Build Image') { steps { -- GitLab From 9b2904856b148fe62c66b023ef1039146f819b4d Mon Sep 17 00:00:00 2001 From: Anusha <anusha.mallipalli@pal.tech> Date: Wed, 12 Mar 2025 17:35:45 +0530 Subject: [PATCH 17/17] updated jenkinsfile --- server/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/Jenkinsfile b/server/Jenkinsfile index d1b98eb..95fae5f 100644 --- a/server/Jenkinsfile +++ b/server/Jenkinsfile @@ -68,7 +68,7 @@ pipeline { steps { script{ containerID = sh( - script: "docker run -d -p ${port}:3000 --network pt-net --name talent-rover-api-${branch} talent-rover-api-${branch}-b${BUILD_NUMBER}", + script: "docker run -d -p ${port}:80 --network pt-net --name talent-rover-api-${branch} talent-rover-api-${branch}-b${BUILD_NUMBER}", returnStdout: true ).trim() echo "Container ID is ==> ${containerID}" -- GitLab