Skip to content

Commit 6223922

Browse files
gabemonteroRoming22
authored andcommitted
update checkov.sh so it can use the checkov.yaml from a PR
update static-check PAC def to use PR branch checkov changes
1 parent 63c9cb5 commit 6223922

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.tekton/pipeline-service-static-code-analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ spec:
118118
image: quay.io/redhat-pipeline-service/static-checks:$(params.target_branch)
119119
script: |
120120
#!/usr/bin/env bash
121-
/opt/static-checks/bin/checkov.sh --workspace_dir $(workspaces.source.path)
121+
$(workspaces.source.path)/ci/images/static-checks/content/bin/checkov.sh --workspace_dir $(workspaces.source.path) --config-file $(workspaces.source.path)/ci/images/static-checks/content/config/checkov.yaml
122122
workspaces:
123123
- name: source
124124
workspaces:

ci/images/static-checks/content/bin/checkov.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ usage() {
3333
Usage:
3434
${0##*/} [options]
3535
36-
Run yamllint in the content of the workspace directory
36+
Run checkov against the content of the workspace directory
3737
3838
Optional arguments:
3939
-w, --workspace_dir WORKSPACE_DIR.
4040
Workspace directory.
4141
Default: $PROJECT_DIR
42+
-c, --config-file CONFIG_FILE
43+
Configuration file.
44+
Default: the path '../config/checkov.yaml' from this script
4245
-d, --debug
4346
Activate tracing/debug mode.
4447
-h, --help
@@ -51,6 +54,7 @@ Example:
5154

5255
parse_args() {
5356
WORKSPACE_DIR="$PROJECT_DIR"
57+
CONFIG_FILE="$SCRIPT_DIR/../config/checkov.yaml"
5458
while [[ $# -gt 0 ]]; do
5559
case $1 in
5660
-w | --workspace_dir)
@@ -66,6 +70,10 @@ parse_args() {
6670
usage
6771
exit 0
6872
;;
73+
-c | --config-file)
74+
shift
75+
CONFIG_FILE="$1"
76+
;;
6977
*)
7078
echo "[ERROR] Unknown argument: $1" >&2
7179
usage
@@ -81,7 +89,7 @@ init() {
8189
}
8290

8391
run() {
84-
checkov --directory "$WORKSPACE_DIR" --config-file "$SCRIPT_DIR/../config/checkov.yaml"
92+
checkov --directory "$WORKSPACE_DIR" --config-file "$CONFIG_FILE"
8593
}
8694

8795
main() {

0 commit comments

Comments
 (0)