From d550c9210d41b284fcf51f64460823e0d201eb1d Mon Sep 17 00:00:00 2001 From: LandmarkTechnology <70292434+legah2045@users.noreply.github.com> Date: Sat, 1 Apr 2023 14:22:26 -0400 Subject: [PATCH] Create Jenkinsfile_declarative042023 --- Jenkinsfile_declarative042023 | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Jenkinsfile_declarative042023 diff --git a/Jenkinsfile_declarative042023 b/Jenkinsfile_declarative042023 new file mode 100644 index 0000000000..9cde454050 --- /dev/null +++ b/Jenkinsfile_declarative042023 @@ -0,0 +1,69 @@ +pipeline{ + agent { + label 'master' + } + tools { + maven 'maven3.9.1' + } + //options{} + //triggers{} + stages { + stage('1Clone'){ + steps{ + sh "echo 'cloning the latest application version' " + git "https://github.com/LandmakTechnology/maven-web-application" + sh "echo 'latest application version available for testing and build' " + } + } + stage('2TestBuild'){ + steps{ + sh "echo 'running JUnit-test-cases' " + sh "echo 'testing must passed to create artifacts ' " + sh "mvn clean package" + } + } + stage('3CodeQualityAnalysis') { + steps{ + sh "echo setup sonarQube authentication" + sh "echo 'Perfoming CodeQualityAnalysis' " + sh "mvn sonar:sonar" + } + } + stage('4UploadArtifacts') { + steps{ + sh "echo configure nexus authentication" + //sh "mvn deploy" + sh "echo artifacts uploaded" + } + } + stage('5deploy') { + steps{ + deploy adapters: [tomcat9(credentialsId: 'tomcat-credentials', path: '', url: 'http://100.26.217.86:8080/')], contextPath: null, war: 'target/*war' + } + } + + //stage('5deploy') {} + } +post{ + always{ +emailext body: '''Great job team. + +LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build Success', to: 'mylandmarktech@gmail.com' + + } + success{ +emailext body: '''Great job team. + +LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build Success', to: 'mylandmarktech@gmail.com' + + } + failure{ +emailext body: '''Please review this job. + +LandmarkTech ''', recipientProviders: [buildUser(), developers()], subject: 'Build failed', to: 'mylandmarktech@gmail.com' + + } + +} + +}