Last active
July 15, 2019 21:40
-
-
Save hazelement/51c7f5a0225066da11acd36335efbc23 to your computer and use it in GitHub Desktop.
Jenkins
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
pipeline { | |
options { | |
buildDiscarder(logRotator(numToKeepStr: '3')) | |
} | |
agent any | |
stages { | |
stage('Cloning Git'){ | |
steps { | |
// check out git repo and pull submodules recursively | |
checkout( | |
[ | |
$class: 'GitSCM', | |
branches: [ | |
[ | |
name: '*/master' | |
] | |
], | |
doGenerateSubmoduleConfigurations: false, | |
extensions: [ | |
[ | |
$class: 'SubmoduleOption', | |
disableSubmodules: false, | |
parentCredentials: true, | |
recursiveSubmodules: true, | |
reference: '', | |
trackingSubmodules: false | |
] | |
], | |
submoduleCfg: [], | |
userRemoteConfigs: [ | |
[ | |
credentialsId: 'sdf23f23-1212-47sdf7c-sfd-wfasf', | |
url: 'ssh://git@git_repo/myproject.git' | |
] | |
] | |
] | |
) | |
} | |
} | |
stage('Building image') { | |
steps{ | |
script { | |
sh "script1.sh" | |
} | |
} | |
} | |
} | |
post { | |
always { | |
emailext attachLog: true, attachmentsPattern: 'build_log.txt', body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", | |
recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], | |
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}" | |
} | |
failure { | |
} | |
success { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment