Skip to content

Commit

Permalink
Merge pull request #31 from OpenLMIS/feature/CQI-10
Browse files Browse the repository at this point in the history
CQI-10: use sonarcloud instead of sonarqube
  • Loading branch information
dszafranek authored Nov 16, 2023
2 parents 64ad941 + 1ad45ab commit 0888d90
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 68 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/sonar-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: SonarCloud OpenLMIS-referencedata-ui Pipeline
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ node_modules/
.env
bower_components
.tmp
.sonar
58 changes: 0 additions & 58 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,64 +109,6 @@ pipeline {
}
}
}
stage('Sonar analysis') {
when {
expression {
return VERSION.endsWith("SNAPSHOT")
}
}
steps {
withSonarQubeEnv('Sonar OpenLMIS') {
withCredentials([string(credentialsId: 'SONAR_LOGIN', variable: 'SONAR_LOGIN'), string(credentialsId: 'SONAR_PASSWORD', variable: 'SONAR_PASSWORD')]) {
script {
sh '''
set +x
sudo rm -f .env
touch .env
SONAR_LOGIN_TEMP=$(echo $SONAR_LOGIN | cut -f2 -d=)
SONAR_PASSWORD_TEMP=$(echo $SONAR_PASSWORD | cut -f2 -d=)
echo "SONAR_LOGIN=$SONAR_LOGIN_TEMP" >> .env
echo "SONAR_PASSWORD=$SONAR_PASSWORD_TEMP" >> .env
echo "SONAR_BRANCH=$GIT_BRANCH" >> .env
docker-compose run --entrypoint ./sonar.sh referencedata-ui
docker-compose down --volumes
'''
// workaround because sonar plugin retrieve the path directly from the output
sh 'echo "Working dir: ${WORKSPACE}/.sonar"'
}
}
}
timeout(time: 1, unit: 'HOURS') {
script {
def gate = waitForQualityGate()
if (gate.status != 'OK') {
echo 'Quality Gate FAILED'
currentBuild.result = 'UNSTABLE'
}
}
}
}
post {
unstable {
script {
notifyAfterFailure()
}
}
failure {
script {
notifyAfterFailure()
}
}
cleanup {
script {
sh "sudo rm -rf ${WORKSPACE}/{*,.*} || true"
}
}
}
}
stage('Push image') {
when {
expression {
Expand Down
5 changes: 5 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sonar.projectKey=OpenLMIS_openlmis-referencedata-ui
sonar.organization=openlmis
sonar.projectName=openlmis-referencedata-ui
sonar.sources=src
sonar.sourceEncoding=UTF-8
9 changes: 0 additions & 9 deletions sonar.sh

This file was deleted.

0 comments on commit 0888d90

Please sign in to comment.