diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d496c42 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,74 @@ +pipeline { + agent any + + stages { + stage('Git clone') { + steps { + echo "cloning" + } + } + stage('Verify') { + steps { + echo "bokovi is verifying" + } + } + + stage('Build') { + steps { + sh 'mvn compile' + + } + } + + // Running sonarqube + stage('Sonarqube test') { + environment { + scannerHome = tool 'ibt-sonarqube'; + } + steps { + withSonarQubeEnv(credentialsId: 'SQ-student', installationName: 'IBT sonarqube') { + sh "${scannerHome}/bin/sonar-scanner" + } + } + } + +stage('Run Test') { + steps { + sh 'mvn test' + + } + } + stage('upload to artifactory') { + steps { + //sh 'mvn test' + configFileProvider([configFile('5d0920bc-97c5-4877-8aa4-2f61975fa9fc')]) { + sh 'mvn package' + } + } + } + + stage ('OWASP Dependency-Check Vulnerabilities') { + steps { + dependencyCheck additionalArguments: ''' + -o "./" + -s "./" + -f "ALL" + --prettyPrint''', odcInstallation: 'dependency-check' + + dependencyCheckPublisher pattern: 'dependency-check-report.xml' + } + } + + stage ('Deploy code to non-prod') { + steps { + script { + def remote = [name: 'IBT-Unix', host: '159.223.96.221', user: 'root', allowAnyHosts: true] + withCredentials([usernamePassword(credentialsId: " user-bokovi", usernameVariable: 'USERNAME',passwordVariable: 'PASSWORD')]) { + remote.password = PASSWORD + sshPut remote: remote, from: 'target/hello-maven-1.7-SNAPSHOT.jar', into: '/opt/tomcat/webapps/' + } + } + } + } + } +} diff --git a/pom.xml b/pom.xml index 4de0be7..ff98902 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ibt.app hello-maven - 1.0-SNAPSHOT + 1.7-SNAPSHOT hello-maven diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..627eace --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=nov15-cohort-project + +sonar.java.binaries= target +sonar.host.url=https://sonarqube.ibtlearning.co/ diff --git a/src/main/java/com/ibt/app/App.java b/src/main/java/com/ibt/app/App.java index 7909dfc..0f7af48 100644 --- a/src/main/java/com/ibt/app/App.java +++ b/src/main/java/com/ibt/app/App.java @@ -8,6 +8,6 @@ public class App { public static void main( String[] args ) { - System.out.println( "Hello World!" ); + System.out.println( "Hello World!This is an update from Bokovi" ); } }