Detect if a publishable item filepath is valid or not
This commit is contained in:
parent
8cadf19ce9
commit
e00f228c7b
1 changed files with 15 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue