|
1 | 1 | pipeline { |
2 | 2 | agent any |
3 | 3 | environment { |
4 | | - GIT_URL = 'https://github.com/BSO-Space/BSOSpace-Blog-Frontend' |
| 4 | + GIT_URL = 'https://github.com/bsospace/BSOSpace-Blog-Frontend' |
5 | 5 | DOCKER_COMPOSE_FILE = '' |
6 | 6 | DOCKER_IMAGE_TAG = '' |
7 | 7 | APP_PORT = '' |
@@ -84,74 +84,6 @@ pipeline { |
84 | 84 | } |
85 | 85 | } |
86 | 86 |
|
87 | | - stage('Code Analysis') { |
88 | | - steps { |
89 | | - withCredentials([string(credentialsId: 'bso-space-app', variable: 'SONAR_TOKEN')]) { |
90 | | - script { |
91 | | - def sonarResult = sh( |
92 | | - script: ''' |
93 | | - npm install sonar-scanner |
94 | | - npx sonar-scanner \ |
95 | | - -Dsonar.projectKey=bso-space-app \ |
96 | | - -Dsonar.host.url=http://labs.bsospace.com:3001 \ |
97 | | - -Dsonar.login=$SONAR_TOKEN |
98 | | - ''', |
99 | | - returnStatus: true |
100 | | - ) |
101 | | - |
102 | | - if (sonarResult != 0) { |
103 | | - error "SonarQube analysis failed. Halting deployment." |
104 | | - } else { |
105 | | - echo "SonarQube analysis passed successfully." |
106 | | - } |
107 | | - } |
108 | | - } |
109 | | - } |
110 | | - post { |
111 | | - success { |
112 | | - publishChecks name: 'Code Analysis', title: 'Code Analysis', summary: 'SonarQube analysis passed.' |
113 | | - } |
114 | | - failure { |
115 | | - publishChecks name: 'Code Analysis', title: 'Code Analysis', summary: 'SonarQube analysis failed.' |
116 | | - } |
117 | | - } |
118 | | - } |
119 | | - |
120 | | - stage('Quality Gate') { |
121 | | - steps { |
122 | | - withCredentials([string(credentialsId: 'bso-space-app', variable: 'SONAR_TOKEN')]) { |
123 | | - script { |
124 | | - def response = sh( |
125 | | - script: "curl -s -u ${SONAR_TOKEN}: https://sonarqube.bsospace.com/api/qualitygates/project_status?projectKey=bso-space-app", |
126 | | - returnStdout: true |
127 | | - ).trim() |
128 | | - def qualityGate = new groovy.json.JsonSlurper().parseText(response) |
129 | | - env.QUALITY_GATE_STATUS = qualityGate?.projectStatus?.status ?: "UNKNOWN" |
130 | | - |
131 | | - def qualitySummary = "Quality Gate Status: ${env.QUALITY_GATE_STATUS}\n" |
132 | | - qualityGate?.projectStatus?.conditions.each { condition -> |
133 | | - qualitySummary += "Metric: ${condition.metricKey}, Status: ${condition.status}, " + |
134 | | - "Actual: ${condition.actualValue}, Threshold: ${condition.errorThreshold}\n" |
135 | | - } |
136 | | - echo qualitySummary |
137 | | - env.QUALITY_SUMMARY = qualitySummary |
138 | | - |
139 | | - if (env.QUALITY_GATE_STATUS != 'OK') { |
140 | | - error "Quality Gate failed with status: ${env.QUALITY_GATE_STATUS}" |
141 | | - } |
142 | | - } |
143 | | - } |
144 | | - } |
145 | | - post { |
146 | | - success { |
147 | | - publishChecks name: 'Quality Gate', title: 'Quality Gate', summary: 'Quality gate passed successfully.' |
148 | | - } |
149 | | - failure { |
150 | | - publishChecks name: 'Quality Gate', title: 'Quality Gate', summary: 'Quality gate failed.' |
151 | | - } |
152 | | - } |
153 | | - } |
154 | | - |
155 | 87 | stage('Testing with Jest') { |
156 | 88 | steps { |
157 | 89 | script { |
|
0 commit comments