Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test GitHub jenkins plugin comments #7

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
80 changes: 33 additions & 47 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
pipeline {
agent any
stages {
stage('Lint') {
steps {
parallel(
"Lint": {
sh 'echo \'linted!\''

},
"Time": {
sh 'echo "date"'

}
)
}
}
stage('SonarQube analysis') {
steps {
// requires SonarQube Scanner 2.8+
withSonarQubeEnv('sonar') {
sh "./helloworld/sonar-scanner/bin/sonar-scanner"
}
}
}
stage('Deploy') {
steps {
sh 'echo "Deploying..."'
}
}
stage('Publish to Influxdb') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
echo 'Publishing to Influxdb'
step([$class: 'InfluxDbPublisher', customData: null, customDataMap: null, customPrefix: null, target: 'influxdb'])
}
}
node {
stage("Prepare") {
checkout scm
}
post {
always {
sh 'echo "Always in post"'
}
failure {
sh 'echo "The Pipeline failed :("'

stage('Print env') {
sh 'printenv'
}

stage("Sonar") {

// Adding variables to sonar.properties
sh "echo sonar.github.repository=multiservicio/devops-docker >> sonar-project.properties"
sh "echo sonar.analysis.mode=preview >> sonar-project.properties"
sh "echo sonar.github.pullRequest=${pullRequestId(env.BRANCH_NAME)}>> sonar-project.properties"
sh "echo sonar.github.oauth=xxxx >> sonar-project.properties"

withSonarQubeEnv('sonar') {
sh "./helloworld/sonar-scanner/bin/sonar-scanner"
}
}

stage('Publish to Influxdb') {
step([$class: 'InfluxDbPublisher', customData: null, customDataMap: null, customPrefix: null, target: 'influxdb'])
}

}

/**
* Get pull request id from branch string
*
* @param branch
* @return
*/
String pullRequestId(String branch) {
return (branch =~ /^PR-(\d+)$/)[0][1]
}
4 changes: 2 additions & 2 deletions config/devui/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
<div class="nav-wrapper">
<a class="brand-logo left">&nbsp;&nbsp;[projectName]</a>
<ul class="right hide-on-med-and-down">
<li onclick="loadIframeByUrl('http://local.dev:8080')" class="nav-item"><a>Jenkins</a></li>
<li onclick="loadIframeByUrl('http://local.dev:8080/blue/pipelines')" class="nav-item"><a>Jenkins</a></li>
<li onclick="loadIframeByUrl('http://local.dev:3000')" class="nav-item"><a>Grafana</a></li>
<li onclick="loadIframeByUrl('http://local.dev:8083')" class="nav-item"><a>InfluxDB</a></li>
<li onclick="window.open('http://local.dev:9000')" class="nav-item"><a class="tooltipped" data-position="bottom" data-delay="50" data-tooltip="Opens in a new tab"><i class="right material-icons">launch</i>Sonar</a></li>

</ul>
</div>
</nav>
Expand Down
1 change: 1 addition & 0 deletions helloworld/src/main/java/FooBar.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
public class FooBar {

public int process(int a) {
int b = 0;
Copy link
Owner Author

@multiservicio multiservicio May 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Remove this unused "b" local variable. rule
MINOR 'method def' child have incorrect indentation level 4, expected level should be 8. rule

if (a > 1 && a < 10) {
return a;
}
Expand Down
1 change: 1 addition & 0 deletions helloworld/src/main/js/foo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function process() {
var foo = 10;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Remove this useless assignment to local variable "foo" rule
MINOR Remove the declaration of the unused 'foo' variable. rule

if (i > 3) {
return i;
}
Expand Down