Skip to content

Commit a976d03

Browse files
gabemonteroRoming22
authored andcommitted
update shellcheck/yamllint/hadolint and static check pac pipeline so PR changes are used in test
1 parent 6223922 commit a976d03

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
imagePullPolicy: Always
5858
script: |
5959
#!/usr/bin/env bash
60-
/opt/static-checks/bin/shellcheck.sh --workspace_dir $(workspaces.source.path)
60+
$(workspaces.source.path)/ci/images/static-checks/content/bin/shellcheck.sh --workspace_dir $(workspaces.source.path)
6161
workspaces:
6262
- name: source
6363
- name: yamllint
@@ -78,7 +78,7 @@ spec:
7878
imagePullPolicy: Always
7979
script: |
8080
#!/usr/bin/env bash
81-
/opt/static-checks/bin/yamllint.sh --workspace_dir $(workspaces.source.path)
81+
$(workspaces.source.path)/ci/images/static-checks/content/bin/yamllint.sh --config-file $(workspaces.source.path)/ci/images/static-checks/content/config/yamllint.yaml --workspace_dir $(workspaces.source.path)
8282
workspaces:
8383
- name: source
8484
- name: hadolint
@@ -98,7 +98,7 @@ spec:
9898
image: quay.io/redhat-pipeline-service/static-checks:$(params.target_branch)
9999
script: |
100100
#!/usr/bin/env bash
101-
/opt/static-checks/bin/hadolint.sh --workspace_dir $(workspaces.source.path)
101+
$(workspaces.source.path)/ci/images/static-checks/content/bin/hadolint.sh --config-file $(workspaces.source.path)/ci/images/static-checks/content/config/hadolint.yaml --workspace_dir $(workspaces.source.path)
102102
workspaces:
103103
- name: source
104104
- name: checkov

ci/images/static-checks/content/bin/hadolint.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 hadolint in 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/hadolint.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/hadolint.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
@@ -82,7 +90,7 @@ init() {
8290

8391
run() {
8492
find "$WORKSPACE_DIR" -name Dockerfile -exec \
85-
hadolint -c "$SCRIPT_DIR/../config/hadolint.yaml" {} +
93+
hadolint -c "$CONFIG_FILE" {} +
8694
}
8795

8896
main() {

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ 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/yamllint.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/yamllint.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-
yamllint -c "$SCRIPT_DIR/../config/yamllint.yaml" "$WORKSPACE_DIR"
92+
yamllint -c "$CONFIG_FILE" "$WORKSPACE_DIR"
8593
}
8694

8795
main() {

0 commit comments

Comments
 (0)