-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.cloudogu.ces.cesbuildlib | ||
|
||
def call(String dockerfile = "Dockerfile") { | ||
// only latest version available | ||
docker.image('projectatomic/dockerfile-lint:latest').inside({ | ||
sh "dockerfile_lint -p -f ${dockerfile}" | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* shellcheck for jenkins-pipelines https://github.com/koalaman/shellcheck | ||
* | ||
*/ | ||
package com.cloudogu.ces.cesbuildlib | ||
|
||
/** | ||
* run shellcheck with a custom fileList | ||
* sample input "test1.sh", "test2.sh" | ||
* | ||
*/ | ||
def call(fileList) { | ||
executeWithDocker(fileList) | ||
} | ||
|
||
/** | ||
* run shellcheck on every .sh file inside the project folder | ||
* note: it ignores ./ecosystem folder for usage with ecosystem instances | ||
* | ||
*/ | ||
def call() { | ||
def fileList = sh (script: 'find . -path ./ecosystem -prune -o -type f -regex .*\\.sh -print', returnStdout: true) | ||
fileList='"' + fileList.trim().replaceAll('\n','" "') + '"' | ||
executeWithDocker(fileList) | ||
} | ||
|
||
/* | ||
* run the alpine based shellcheck image | ||
* note: we encountered some problems while using the minified docker image | ||
*/ | ||
private def executeWithDocker(fileList){ | ||
docker.image('koalaman/shellcheck-alpine:stable').inside(){ | ||
sh "/bin/shellcheck ${fileList}" | ||
} | ||
} |