Detect if a publishable item filepath is valid or not

This commit is contained in:
Dan Hawkins 2019-04-28 14:20:28 +01:00
commit e00f228c7b

View file

@ -1,8 +1,23 @@
// The filepath must end in "<folder>/**" or "<folder>/" - Glob wildcard - as a git sparse checkout
def checkallowed(String filepath) {
if (filepath.endsWith('/**') || filepath.endsWith('/')) {
def files = findFiles glob: filepath
if (files.length > 0) {
return
} else {
error "There are no files/folders under the publishable item: ${filepath}"
}
}
error "The publishable item: ${filepath} does not end in <folder>/** or <folder>/ (for git sparse checkouts)"
}
// Generate a list of artifact files that are publishable to outside parties
def generatelist(meta, publishable) {
filelist = []
for (filepath in publishable) {
checkallowed(filepath)
meta.addPublishable(filepath)
}
}