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

Dev #3

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: java
jdk:
- openjdk11

script:
- mvn clean install
62 changes: 62 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
pipeline {
agent any

environment {
PATH = "$PATH:$HOME/.dotnet/tools"
SONARQUBE_HOST = 'http://192.168.176.24:9000'
SONARQUBE_TOKEN = 'sqp_104bdde603f13ded777f0e840264dc6dcf6177aa'
}
triggers {
pollSCM('H/5 * * * *')
}

stages {
stage('Checkout from Github') {
steps {
script {
if (env.BRANCH_NAME == 'main' || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME ==~ /VDMKC-.*/) {
git credentialsId: 'TahaTangulu', url: 'https://github.com/TeamsecABS/vdmk-backend.git', branch: env.BRANCH_NAME
}
}
}
}

stage('Restore') {
steps {
sh 'dotnet restore'
}
}

stage('Build & Test') {
steps {
sh 'dotnet build'
sh 'dotnet test'
}
}

stage('Install .NET Core SonarScanner and Run Analysis') {

steps {
script {
sh 'dotnet tool install --global dotnet-sonarscanner || true'
sh 'echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.dotnet/tools"'
sh "dotnet sonarscanner begin /k:'vdmk-backend' /d:sonar.host.url='${SONARQUBE_HOST}' /d:sonar.login='${SONARQUBE_TOKEN}'"
sh 'dotnet build'
sh "dotnet sonarscanner end /d:sonar.login='${SONARQUBE_TOKEN}'"
}
}
}

stage('SonarQube Quality Gate') {
steps {
echo 'SonarQube Quality Gate complete!'
}
}
}

post {
always {
echo 'Pipeline execution complete!'
}
}
}
5 changes: 4 additions & 1 deletion src/test/java/HelloWorldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public class HelloWorldTest {
@Test
public void sayHello() {
new HelloWorld().sayHello();
}
}





}