Skip to content

Instantly share code, notes, and snippets.

@hazelement
Last active July 15, 2019 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazelement/51c7f5a0225066da11acd36335efbc23 to your computer and use it in GitHub Desktop.
Save hazelement/51c7f5a0225066da11acd36335efbc23 to your computer and use it in GitHub Desktop.
Jenkins
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