Skip to content

Commit

Permalink
Sonar (#125)
Browse files Browse the repository at this point in the history
* Added properties file for sonar scans

* Updates to support Sonar

* More sonar

* More Sonar configuration

* More Sonar configuration

* More Sonar configuration

* sonar config

* Cleaning workspace

* leaving workspace

* Maybe no NPM is needed here

* Maybe no NPM is needed here

* Maybe no NPM is needed here

* Maybe NPM is needed here

* Fixing Sonar

* Define the sonar host

* Using build in sonar

* Running from base

* Running from base

* More Sonar

* Run sonar with a container that has java

* Running in individual containers

* Re-enabled slack notifications

* Removed extra }

* Formatting

* SlackSend
  • Loading branch information
jduquette authored and gpacix committed Aug 29, 2019
1 parent 0c28340 commit aeb58f8
Show file tree
Hide file tree
Showing 6 changed files with 1,114 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ testem.log
# System Files
.DS_Store
Thumbs.db

# Sonar
/.scannerwork
/.scannerwork/*
76 changes: 43 additions & 33 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,55 @@ void setBuildStatus(String message, String state) {
}

pipeline {
agent {
docker {
image 'duluca/minimal-node-chromium'
}
agent {
label 'excellanator'
}
environment {
environment {
HOME = '.'
}
stages {
stage('Checkout') {
steps {
slackSend(channel: '#tcp-angular', color: '#FFFF00', message: ":jenkins-triggered: Build Started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
checkout scm
}
}
stage('Install') {
steps {
sh 'npm install'
stages {
stage('Checkout') {
agent { docker 'duluca/minimal-node-chromium' }
steps {
slackSend(channel: '#tcp-angular', color: '#FFFF00', message: ":jenkins-triggered: Build Triggered - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)")
checkout scm
}
}
}
stage('Build') {
steps {
sh 'npm run build'
stage('Install') {
agent { docker 'duluca/minimal-node-chromium' }
steps {
sh 'npm install'
}
}
}
stage('Test') {
steps {
sh 'npm run test:headless -- --watch false'
stage('Build') {
agent { docker 'duluca/minimal-node-chromium' }
steps {
sh 'npm run build'
}
}
stage('Test') {
agent { docker 'duluca/minimal-node-chromium' }
steps {
sh 'npm run test:headless -- --watch false --code-coverage'
}
}
stage('SonarQube analysis') {
agent { docker 'daneweber/ubuntu-node-java' }
steps{
withSonarQubeEnv('default') {
sh 'npm run sonar'
}
}
}
}
}
post {
success {
setBuildStatus("Build succeeded", "SUCCESS");
slackSend(channel: '#tcp-angular', color: '#00FF00', message: ":jenkins_ci: Build Successful! ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>) :jenkins_ci:")
}
failure {
setBuildStatus("Build failed", "FAILURE");
slackSend(channel: '#tcp-angular', color: '#FF0000', message: ":alert: :jenkins_exploding: *Build Failed! WHO BROKE THE FREAKING CODE??* ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>) :jenkins_exploding: :alert:")
post {
success {
setBuildStatus("Build succeeded", "SUCCESS");
slackSend(channel: '#tcp-angular', color: '#00FF00', message: ":jenkins_ci: Build Successful! ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>) :jenkins_ci:")
}
failure {
setBuildStatus("Build failed", "FAILURE");
slackSend(channel: '#tcp-angular', color: '#FF0000', message: ":alert: :jenkins_exploding: *Build Failed! WHO BROKE THE FREAKING CODE??* ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>) :jenkins_exploding: :alert:")
}
}
}
}
15 changes: 13 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@ module.exports = function (config) {
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-spec-reporter'),
require('karma-sonarqube-reporter'),
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/tcp-angular'),
reports: ['html', 'lcovonly', 'text-summary'],
reports: ['html', 'lcovonly', 'text-summary' ],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml', 'spec'],
sonarqubeReporter: {
basePath: 'src/app',
filePattern: '**/*spec.ts',
encoding: 'utf-8',
outputFolder: 'reports',
legacyMode: false,
reportName: (metadata) => {
return 'utExecution.xml'
}
},
reporters: ['progress', 'kjhtml', 'spec', 'sonarqube' ],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand Down
Loading

0 comments on commit aeb58f8

Please sign in to comment.