Skip to content

Instantly share code, notes, and snippets.

@ctran
Created April 9, 2019 15:42
Show Gist options
  • Save ctran/71768dbe912b1d1b867089ca516dae23 to your computer and use it in GitHub Desktop.
Save ctran/71768dbe912b1d1b867089ca516dae23 to your computer and use it in GitHub Desktop.
pipeline {
agent none
options {
buildDiscarder logRotator(numToKeepStr: '10')
}
triggers {
eventTrigger jmespathQuery("repository.full_name")
}
stages {
stage('Example') {
steps {
script {
String text = ''
env.getEnvironment().each { name, value ->
text += "$name=$value\n"
}
println text
for(cause in currentBuild.rawBuild.getCauses()) {
println "${cause}"
if (cause instanceof com.cloudbees.jenkins.plugins.pipeline.events.EventTriggerCause) {
println "${cause.event}"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment