Skip to content

Instantly share code, notes, and snippets.

@mrhockeymonkey
mrhockeymonkey / Jenkins-GitDiff.groovy
Last active March 16, 2024 02:11
Jenkins: git diff in pipeline to discover modified files
#!groovy
// https://medium.com/rocket-travel-engineering/running-advanced-git-commands-in-a-declarative-multibranch-jenkinsfile-e82b075dbc53
// Jenkins only checks out the branch for performance reasons so to be able to do more advanced git commands we need to
// also fetch master (or anything else you need)
pipeline {
agent any
stages {
stage ("info") {
when {