Remove code quality check from PRs

master^2
Lasantha Dharmakeerthi 2 months ago
commit 4faefcce23

41
Jenkinsfile vendored

@ -5,7 +5,6 @@ pipeline {
environment { environment {
def isPendingUpstreamDependenciesExists = false def isPendingUpstreamDependenciesExists = false
def triggeredViaPush = false def triggeredViaPush = false
SCANNER_HOME = tool 'sonar-scanner'
JAVA_HOME = '/usr/lib/jvm/java-11-openjdk' JAVA_HOME = '/usr/lib/jvm/java-11-openjdk'
PATH = "${JAVA_HOME}/bin:${env.PATH}" PATH = "${JAVA_HOME}/bin:${env.PATH}"
} }
@ -49,29 +48,13 @@ pipeline {
} }
} }
stage('Check SonarQube Installation') {
steps {
script {
echo "Initial JAVA_HOME: ${env.JAVA_HOME}"
echo "Initial PATH: ${env.PATH}"
withEnv(["JAVA_HOME=${env.JAVA_HOME}", "PATH=${env.JAVA_HOME}/bin:${env.PATH}"]) {
sh """
java -version
${SCANNER_HOME}/bin/sonar-scanner --version
"""
}
}
}
}
stage('Fetch Pending Upstream Dependencies') { stage('Fetch Pending Upstream Dependencies') {
steps { steps {
script { script {
if (env.CHANGE_ID) { if (env.CHANGE_ID) {
def url = swaggerEndPoint.call() def url = swaggerEndPoint.call()
echo "Fetching from URL: ${url}" echo "Fetching from URL: ${url}"
withCredentials([usernamePassword(credentialsId: '4093a0bf-073a-4874-b929-be5b69273f4a', passwordVariable: 'password', usernameVariable: 'username')]) { withCredentials([usernamePassword(credentialsId: 'entgra-gitea-credentials', passwordVariable: 'password', usernameVariable: 'username')]) {
def response = sh(script: """curl -X GET "${url}" -H 'accept: application/json' -u \$username:\$password""", returnStdout: true).trim() def response = sh(script: """curl -X GET "${url}" -H 'accept: application/json' -u \$username:\$password""", returnStdout: true).trim()
echo "API Response: ${response}" echo "API Response: ${response}"
isPendingUpstreamDependenciesExists = sh(script: "echo '${response}' | jq 'contains({\"labels\": [{ \"name\": \"pending upstream\"}]})'", returnStdout: true).trim().toBoolean() isPendingUpstreamDependenciesExists = sh(script: "echo '${response}' | jq 'contains({\"labels\": [{ \"name\": \"pending upstream\"}]})'", returnStdout: true).trim().toBoolean()
@ -93,7 +76,7 @@ pipeline {
echo '[Jenkinsfile] Entering testing phase.' echo '[Jenkinsfile] Entering testing phase.'
try { try {
checkout scm checkout scm
withCredentials([usernamePassword(credentialsId: 'builder2-deployer', passwordVariable: 'password', usernameVariable: 'username')]) { withCredentials([usernamePassword(credentialsId: 'builder2-deployer-nexus', passwordVariable: 'password', usernameVariable: 'username')]) {
sh """/opt/scripts/run-test.sh -u \$username -p \$password""" sh """/opt/scripts/run-test.sh -u \$username -p \$password"""
} }
currentBuild.result = 'SUCCESS' currentBuild.result = 'SUCCESS'
@ -112,29 +95,11 @@ pipeline {
} }
} }
stage('Code Quality Check') {
steps {
script {
def projectName = "device-mgt-plugins-${env.CHANGE_ID}"
def projectKey = "device-mgt-plugins-${env.CHANGE_ID}"
withSonarQubeEnv('sonar') {
sh """
$SCANNER_HOME/bin/sonar-scanner \
-Dsonar.projectName=${projectName} \
-Dsonar.projectKey=${projectKey} \
-Dsonar.java.binaries=target
"""
}
}
}
}
stage('Report Job Status') { stage('Report Job Status') {
steps { steps {
script { script {
if (true) { if (true) {
withCredentials([usernamePassword(credentialsId: '4093a0bf-073a-4874-b929-be5b69273f4a', passwordVariable: 'password', usernameVariable: 'username')]) { withCredentials([usernamePassword(credentialsId: 'entgra-gitea-credentials', passwordVariable: 'password', usernameVariable: 'username')]) {
def url = swaggerEndPoint.call() + '/reviews' def url = swaggerEndPoint.call() + '/reviews'
echo "[Jenkinsfile] Notifying pull request build status to ${url}" echo "[Jenkinsfile] Notifying pull request build status to ${url}"
def response = sh(script: """curl -X POST "${url}" -H 'accept: application/json' -H 'Content-Type: application/json' -u \$username:\$password -d '{ "body": "${message}" }'""", returnStdout: true).trim() def response = sh(script: """curl -X POST "${url}" -H 'accept: application/json' -H 'Content-Type: application/json' -u \$username:\$password -d '{ "body": "${message}" }'""", returnStdout: true).trim()

Loading…
Cancel
Save