jenkinsfile
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
Some checks failed
eCommerce-backend/pipeline/head There was a failure building this commit
This commit is contained in:
51
Jenkinsfile
vendored
51
Jenkinsfile
vendored
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user