This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Reinitialize jenkins keychain') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" | |
| } | |
| } | |
| steps { | |
| sh "fastlane refreshJenkinsKeychain" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lane :refreshJenkinsKeychain do | |
| delete_keychain(name: "jenkins") if File.exists? File.expand_path("~/Library/Keychains/jenkins-db") | |
| create_keychain( | |
| name: "jenkins", | |
| password: "jenkins", | |
| timeout: false, | |
| lock_when_sleeps: false, | |
| unlock: true | |
| ) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| post { | |
| failure { | |
| slackSend color: "danger", message: "*${env.JOB_NAME}* *${env.BRANCH_NAME}* job is failed" | |
| } | |
| unstable { | |
| slackSend color: "danger", message: "*${env.JOB_NAME}* *${env.BRANCH_NAME}* job is unstable. Unstable means test failure, code violation etc." | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Inform Slack for success') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" | |
| } | |
| } | |
| steps { | |
| slackSend color: "good", message: "*${env.JOB_NAME}* *${env.BRANCH_NAME}* job is completed successfully" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Send to Prod') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" && env.BRANCH_NAME == "master" | |
| } | |
| } | |
| steps { | |
| // Deploy your application to prod servers | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Build application for prod') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" && env.BRANCH_NAME == "master" | |
| } | |
| } | |
| steps { | |
| // Build your application for prod servers | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Deploy to beta') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" | |
| } | |
| } | |
| steps { | |
| // Deploy new build to pre-prod environments | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Build application for beta') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" | |
| } | |
| } | |
| steps { | |
| // Build application for pre-prod servers | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Run Unit and UI Tests') { | |
| when { | |
| expression { | |
| return env.shouldBuild != "false" | |
| } | |
| } | |
| steps { | |
| script { | |
| try { | |
| // Run your tests here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| stage('Init') { | |
| steps { | |
| script { | |
| lastCommitInfo = sh(script: "git log -1", returnStdout: true).trim() | |
| commitContainsSkip = sh(script: "git log -1 | grep '.*\\[skip ci\\].*'", returnStatus: true) | |
| if(commitContainsSkip == 0) { | |
| skippingText = "Skipping commit." | |
| env.shouldBuild = false | |
| currentBuild.result = "NOT_BUILT" |