mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-29 00:09:28 +08:00
v3 new release (#182)
* Make pulling of images switchable (#178) * Make namespace annotation switchable (#177) * Bump tmpl from 1.0.4 to 1.0.5 (#152) Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump ansi-regex from 5.0.0 to 5.0.1 (#166) Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump minimist from 1.2.5 to 1.2.6 (#175) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add directory functionality (#181) * Add node modules and compiled JavaScript from main Co-authored-by: Jan Röhrich <roehrijn@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jaiveer Katariya <35347859+jaiveerk@users.noreply.github.com> Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
committed by
GitHub
parent
08d466b6ab
commit
e3c97bfc20
@@ -61,3 +61,49 @@ function getManifestFileName(kind: string, name: string) {
|
||||
const tempDirectory = getTempDirectory();
|
||||
return path.join(tempDirectory, path.basename(filePath));
|
||||
}
|
||||
|
||||
export function getFilesFromDirectories(
|
||||
filePaths: string[]
|
||||
): string[]{
|
||||
|
||||
const fullPathSet: Set<string> = new Set<string>()
|
||||
|
||||
filePaths.forEach((fileName => {
|
||||
try {
|
||||
if(fs.lstatSync(fileName).isDirectory()){
|
||||
recurisveManifestGetter(fileName).forEach((file) => {fullPathSet.add(file)})
|
||||
} else if(getFileExtension(fileName) === "yml" || getFileExtension(fileName) === "yaml"){
|
||||
fullPathSet.add(fileName)
|
||||
} else{
|
||||
core.debug(`Detected non-manifest file, ${fileName}, continuing... ` )
|
||||
}
|
||||
} catch (ex) {
|
||||
throw Error(
|
||||
`Exception occurred while reading the file ${fileName}: ${ex}`
|
||||
);
|
||||
}
|
||||
}))
|
||||
|
||||
return Array.from(fullPathSet)
|
||||
}
|
||||
|
||||
function recurisveManifestGetter(dirName: string): string[]{
|
||||
const toRet: string[] = []
|
||||
|
||||
fs.readdirSync(dirName).forEach((fileName) => {
|
||||
const fnwd: string = path.join(dirName, fileName)
|
||||
if(fs.lstatSync(fnwd).isDirectory()){
|
||||
toRet.push(...recurisveManifestGetter(fnwd))
|
||||
} else if(getFileExtension(fileName) === "yml" || getFileExtension(fileName) === "yaml"){
|
||||
toRet.push(path.join(dirName, fileName))
|
||||
} else{
|
||||
core.debug(`Detected non-manifest file, ${fileName}, continuing... ` )
|
||||
}
|
||||
})
|
||||
|
||||
return toRet
|
||||
}
|
||||
|
||||
function getFileExtension(fileName: string){
|
||||
return fileName.slice((fileName.lastIndexOf(".") - 1 >>> 0) + 2)
|
||||
}
|
||||
Reference in New Issue
Block a user