├── First.bat ├── Jenkins Automation.pptx ├── Jenkinsfile ├── README.md ├── Second.bat ├── V13-Jenkinsfile ├── V15-Jenkinsfile └── V17-Jenkinsfile /First.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo "This is a First batch file!" 3 | -------------------------------------------------------------------------------- /Jenkins Automation.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/logicopslab/JenkinsAutomation/c36ee5ee0ff6a62d3724e6a22984e3a2819ad5c5/Jenkins Automation.pptx -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | 4 | stages { 5 | stage('First') { 6 | steps { 7 | echo "This is 1st stage" 8 | } 9 | } 10 | stage('Second') { 11 | steps { 12 | echo "This is 2nd stage" 13 | } 14 | } 15 | stage('Third') { 16 | steps { 17 | echo "This is 3rd stage" 18 | } 19 | } 20 | stage('Fourth') { 21 | steps { 22 | echo "This is 4th stage" 23 | } 24 | } 25 | stage('Fifth') { 26 | steps { 27 | echo "This is 5th stage" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JenkinsAutomation 2 | Codebase for Jenkins automation tutorial 3 | -------------------------------------------------------------------------------- /Second.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo "This is a Second batch file!" 3 | -------------------------------------------------------------------------------- /V13-Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | tools { 4 | maven "3.6.3" 5 | } 6 | stages { 7 | stage('Git CheckOut') { 8 | steps { 9 | git branch: 'main', credentialsId: 'My private token login creds', url: 'https://github.com/logicopslab/WebAppForJenkins.git' 10 | } 11 | } 12 | stage('Clean and Install') { 13 | steps { 14 | bat 'mvn clean install' 15 | } 16 | } 17 | stage ('Package'){ 18 | steps { 19 | bat 'mvn package' 20 | } 21 | } 22 | stage ('Server'){ 23 | steps { 24 | rtServer ( 25 | id: "Artifactory", 26 | url: 'http://localhost:8082/artifactory', 27 | username: 'ravish', 28 | password: 'YouPasswordHere', 29 | bypassProxy: true, 30 | timeout: 300 31 | ) 32 | } 33 | } 34 | stage('Upload'){ 35 | steps{ 36 | rtUpload ( 37 | serverId:"Artifactory" , 38 | spec: '''{ 39 | "files": [ 40 | { 41 | "pattern": "*.war", 42 | "target": "logic-ops-lab-libs-snapshot-local" 43 | } 44 | ] 45 | }''', 46 | ) 47 | } 48 | } 49 | stage ('Publish build info') { 50 | steps { 51 | rtPublishBuildInfo ( 52 | serverId: "Artifactory" 53 | ) 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /V15-Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | tools { 4 | maven "3.6.3" 5 | } 6 | stages { 7 | stage('Git CheckOut') { 8 | steps { 9 | checkout([$class: 'GitSCM', branches: [[name: '*/dragon']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/logicopslab/rock-paper-scissors.git']]]) 10 | } 11 | } 12 | stage('Clean and Install') { 13 | steps { 14 | bat 'mvn clean install' 15 | } 16 | } 17 | stage ('Code Quality'){ 18 | steps { 19 | withSonarQubeEnv('SonarQube Server') { 20 | bat 'mvn sonar:sonar' 21 | } 22 | } 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /V17-Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | stages { 4 | stage('First Stage') { 5 | steps { 6 | script { 7 | try { 8 | // send build started notifications 9 | slackSend (channel: "#jenkinsbuildstatus", color: '#00FF00', message: "Build : ${env.JOB_Name} started! In First Stage. ${env.BUILD_URL}") 10 | // bat 'echo "I am in First stage"' 11 | asdasdas 12 | } 13 | 14 | catch(Exception e) 15 | { 16 | bat 'echo "Job Failed"' 17 | currentBuild.result = "FAILURE" 18 | slackSend (channel: "#jenkinsbuildstatus", color: '#FF0000', message: "Build : ${env.JOB_Name} FAILED! Kindly troubleshoot! ${env.BUILD_URL}") 19 | } 20 | } 21 | 22 | } 23 | } 24 | } 25 | } 26 | --------------------------------------------------------------------------------