From b11ec5bfa715875aa36d54090e2d412f3085ca02 Mon Sep 17 00:00:00 2001 From: subodh Date: Sun, 22 Feb 2026 14:59:13 +0000 Subject: [PATCH] jenkinsfile --- Jenkinsfile | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 13244f1..7407d17 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,8 +11,8 @@ pipeline { IMAGE = '192.168.108.200:80/vaishnavi-ecommerce/ecommerce-backend' - SONAR_HOST_URL = 'http://sonarqube.example.com:9000' // ← update this - SONAR_PROJECT = 'ecommerce-backend' + // SONAR_HOST_URL = 'http://sonarqube.example.com:9000' // ← update this + // SONAR_PROJECT = 'ecommerce-backend' } options { @@ -37,27 +37,29 @@ pipeline { } } - stage('SonarQube Analysis') { - steps { - withSonarQubeEnv('SonarQube') { - sh """ - npx sonar-scanner \ - -Dsonar.projectKey=${SONAR_PROJECT} \ - -Dsonar.projectName='eCommerce Backend' \ - -Dsonar.sources=src \ - -Dsonar.host.url=${SONAR_HOST_URL} - """ - } - } - } + // ─── SonarQube stages disabled until credentials are resolved ─── + // stage('SonarQube Analysis') { + // steps { + // withSonarQubeEnv('SonarQube') { + // sh """ + // npx sonar-scanner \ + // -Dsonar.projectKey=${SONAR_PROJECT} \ + // -Dsonar.projectName='eCommerce Backend' \ + // -Dsonar.sources=src \ + // -Dsonar.host.url=${SONAR_HOST_URL} + // """ + // } + // } + // } - stage('Quality Gate') { - steps { - timeout(time: 5, unit: 'MINUTES') { - waitForQualityGate abortPipeline: false - } - } - } + // stage('Quality Gate') { + // steps { + // timeout(time: 5, unit: 'MINUTES') { + // waitForQualityGate abortPipeline: false + // } + // } + // } + // ──────────────────────────────────────────────────────────────── stage('Build Image') { steps { @@ -89,8 +91,6 @@ pipeline { stage('Patch Image Tag') { steps { - // kustomize edit set image patches the 'name: ecommerce-backend' - // entry in overlays/on-premise/kustomization.yaml dir("${K8S_OVERLAY}") { sh """ kustomize edit set image \ @@ -105,11 +105,9 @@ pipeline { withKubeConfig([credentialsId: "${K8S_CRED_ID}"]) { sh "kubectl apply -k ${K8S_OVERLAY}" - // Databases first — they must be Ready before the app starts sh "kubectl rollout status statefulset/postgres -n ${K8S_NAMESPACE} --timeout=300s" sh "kubectl rollout status statefulset/mongodb -n ${K8S_NAMESPACE} --timeout=300s" - // Then the main app (initContainers wait for DBs + run migrations) sh "kubectl rollout status deployment/ecommerce-app -n ${K8S_NAMESPACE} --timeout=300s" echo "✅ Backend deployed successfully." @@ -120,7 +118,6 @@ pipeline { stage('Smoke Test') { steps { withKubeConfig([credentialsId: "${K8S_CRED_ID}"]) { - // Health endpoint is /health on port 80 (ClusterIP service maps 80→3000) sh """ kubectl run smoke-${BUILD_NUMBER} \ --image=curlimages/curl:latest \