@@ -4,164 +4,110 @@ variables:
4
4
5
5
CI_REGISTRY_IMAGE : registry.gitlab.isc.org/isc-projects/kea
6
6
7
- # Disabled shellcheck warnings:
8
- # SC1117: Backslash is literal in "\/". Prefer explicit escaping: "\\/".
9
- # SC2039: In POSIX sh, 'local' is undefined.
10
- # SC3043: In POSIX sh, 'local' is undefined.
11
- SHELLCHECK_OPTS : " --exclude=SC1117 --exclude=SC2039 --exclude=SC3043"
12
-
13
7
# Setting this variable will affect all Security templates
14
8
# (SAST, Dependency Scanning, ...)
15
9
SECURE_ANALYZERS_PREFIX : " registry.gitlab.com/gitlab-org/security-products/analyzers"
16
10
17
11
# Leave only bandit, flawfinder, semgrep.
18
12
SAST_EXCLUDED_ANALYZERS : " eslint, spotbugs"
19
13
14
+ image : " ${CI_REGISTRY_IMAGE}:latest"
15
+
20
16
stages :
21
17
- test
22
18
23
- shellcheck :
19
+ are-database-scripts-in-sync :
20
+ stage : test
21
+ script :
22
+ - ./src/share/database/scripts/utils/are-scripts-in-sync.py
23
+
24
+ check-for-json-errors-in-doc :
24
25
stage : test
25
- image : " ${CI_REGISTRY_IMAGE}:latest"
26
- tags :
27
- - linux
28
- - amd64
29
26
script :
30
- - SCRIPTS=
31
- - SCRIPTS+="src/bin/admin/admin-utils.sh "
32
- - SCRIPTS+="src/bin/admin/kea-admin.in "
33
- - SCRIPTS+="src/bin/admin/tests/admin_tests.sh.in "
34
- - SCRIPTS+="src/bin/admin/tests/memfile_tests.sh.in "
35
- - SCRIPTS+="src/bin/admin/tests/mysql_tests.sh.in "
36
- - SCRIPTS+="src/bin/admin/tests/pgsql_tests.sh.in "
37
- - SCRIPTS+="src/bin/agent/tests/ca_process_tests.sh.in "
38
- - SCRIPTS+="src/bin/d2/tests/d2_process_tests.sh.in "
39
- - SCRIPTS+="src/bin/dhcp4/tests/dhcp4_process_tests.sh.in "
40
- - SCRIPTS+="src/bin/dhcp6/tests/dhcp6_process_tests.sh.in "
41
- - SCRIPTS+="src/bin/keactrl/keactrl.conf.in "
42
- - SCRIPTS+="src/bin/keactrl/keactrl.in "
43
- - SCRIPTS+="src/bin/keactrl/tests/keactrl_tests.sh.in "
44
- - SCRIPTS+="src/bin/netconf/tests/shtests/netconf_tests.sh.in "
45
- - SCRIPTS+="src/bin/shell/tests/basic_auth_tests.sh.in "
46
- - SCRIPTS+="src/bin/shell/tests/shell_process_tests.sh.in "
47
- - SCRIPTS+="src/lib/asiolink/tests/process_spawn_app.sh.in "
48
- - SCRIPTS+="src/lib/log/tests/buffer_logger_test.sh.in "
49
- - SCRIPTS+="src/lib/log/tests/console_test.sh.in "
50
- - SCRIPTS+="src/lib/log/tests/destination_test.sh.in "
51
- - SCRIPTS+="src/lib/log/tests/init_logger_test.sh.in "
52
- - SCRIPTS+="src/lib/log/tests/local_file_test.sh.in "
53
- - SCRIPTS+="src/lib/log/tests/logger_lock_test.sh.in "
54
- - SCRIPTS+="src/lib/log/tests/severity_test.sh.in "
55
- - SCRIPTS+="src/lib/testutils/dhcp_test_lib.sh.in "
56
- - SCRIPTS+="src/lib/testutils/xml_reporting_test_lib.sh.in "
57
- - SCRIPTS+="src/hooks/dhcp/run_script/tests/run_script_test.sh.in "
58
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_001.0_to_002.0.sh.in "
59
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_002.0_to_003.0.sh.in "
60
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_003.0_to_004.0.sh.in "
61
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_004.0_to_004.1.sh.in "
62
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_004.1_to_005.0.sh.in "
63
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.0_to_005.1.sh.in "
64
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.1_to_005.2.sh.in "
65
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_005.2_to_006.0.sh.in "
66
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_006.0_to_007.0.sh.in "
67
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_007.0_to_008.0.sh.in "
68
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.0_to_008.1.sh.in "
69
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.1_to_008.2.sh.in "
70
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_008.2_to_009.0.sh.in "
71
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.0_to_009.1.sh.in "
72
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.1_to_009.2.sh.in "
73
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.2_to_009.3.sh.in "
74
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.3_to_009.4.sh.in "
75
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.4_to_009.5.sh.in "
76
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.5_to_009.6.sh.in "
77
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_009.6_to_010.0.sh.in "
78
- - SCRIPTS+="src/share/database/scripts/mysql/upgrade_010_to_011.sh.in "
79
- - SCRIPTS+="src/share/database/scripts/mysql/wipe_data.sh.in "
80
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_001.0_to_002.0.sh.in "
81
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_002.0_to_003.0.sh.in "
82
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.0_to_003.1.sh.in "
83
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.1_to_003.2.sh.in "
84
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.2_to_003.3.sh.in "
85
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_003.3_to_004.0.sh.in "
86
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_004.0_to_005.0.sh.in "
87
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_005.0_to_005.1.sh.in "
88
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_005.1_to_006.0.sh.in "
89
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.0_to_006.1.sh.in "
90
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.1_to_006.2.sh.in "
91
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_006.2_to_007.0.sh.in "
92
- - SCRIPTS+="src/share/database/scripts/pgsql/upgrade_007_to_008.sh.in "
93
- - SCRIPTS+="src/share/database/scripts/pgsql/wipe_data.sh.in "
94
- - SCRIPTS+="src/share/yang/modules/utils/check-hashes.sh "
95
- - SCRIPTS+="src/share/yang/modules/utils/check-revisions.sh "
96
- - SCRIPTS+="src/share/yang/modules/utils/gen-revisions.sh "
97
- - SCRIPTS+="src/share/yang/modules/utils/reinstall.sh.in "
98
- - SCRIPTS+="tools/add-config-h.sh "
99
- - SCRIPTS+="tools/bump-lib-versions.sh "
100
- - SCRIPTS+="tools/check-for-duplicate-includes.sh "
101
- - SCRIPTS+="tools/mk_cfgrpt.sh "
102
- - SCRIPTS+="tools/path_replacer.sh.in "
103
- - SCRIPTS+="tools/print-generated-files.sh "
104
- - SCRIPTS+="tools/shellcheck-all.sh "
105
- - SCRIPTS+="tools/tests_in_valgrind.sh "
106
- - shellcheck ${SCRIPTS} ${SHELLCHECK_OPTS}
27
+ - ./tools/check-for-json-errors-in-doc.sh
107
28
108
29
danger :
109
30
stage : test
110
- image : registry.gitlab.isc.org/isc-projects/stork/ci-danger
111
- tags :
112
- - linux
113
- - amd64
114
31
before_script :
115
32
- export CI_MERGE_REQUEST_ID=$(git ls-remote -q origin merge-requests\*\head | grep $CI_COMMIT_SHA | sed 's/.*refs\/merge-requests\/\([0-9]*\)\/head/\1/g')
116
33
- export CI_PROJECT_PATH=$CI_PROJECT_ID # some version of gitlab has problems with searching by project path
117
34
- export DANGER_GITLAB_HOST=gitlab.isc.org
118
35
- export DANGER_GITLAB_API_BASE_URL=https://gitlab.isc.org/api/v4
119
36
script :
120
- - sysctl -w net.ipv6.conf.all.disable_ipv6=1
121
- - sysctl -w net.ipv6.conf.default.disable_ipv6=1
122
- - gem install danger-commit_lint
123
37
- danger --fail-on-errors=true --new-comment
124
38
125
- dhcpdb_create-upgrade-consistency :
126
- allow_failure : false
39
+ duplicate-includes :
40
+ stage : test
41
+ script :
42
+ - ./tools/check-for-duplicate-includes.sh
43
+
44
+ duplicate-log-messages :
127
45
stage : test
128
- image : " ${CI_REGISTRY_IMAGE}:latest"
129
46
script :
130
- - ./src/share/database/scripts/utils/are-scripts-in-sync .py
47
+ - ./tools/check-messages .py
131
48
132
- duplicate-includes :
49
+ uninstalled-headers :
133
50
stage : test
134
- image : " ${CI_REGISTRY_IMAGE}:latest"
135
- tags :
136
- - linux
137
- - amd64
138
51
script :
139
- - ./tools/check-for-duplicate-includes.sh
52
+ - ./tools/find-uninstalled-headers.py
53
+
54
+ missing-api-commands :
55
+ stage : test
56
+ script :
57
+ - ./tools/check-for-missing-api-commands.sh
140
58
141
59
missing-config-h-include :
142
60
stage : test
143
- image : " ${CI_REGISTRY_IMAGE}:latest"
144
- tags :
145
- - linux
146
- - amd64
147
61
script :
148
62
- FILES=$(./tools/add-config-h.sh -n)
149
63
- printf '%s\n' "${FILES}"
150
64
- test -z "${FILES}"
151
65
152
66
missing-git-attribute :
153
67
stage : test
154
- image : " ${CI_REGISTRY_IMAGE}:latest"
155
- tags :
156
- - linux
157
- - amd64
158
68
script :
159
69
- git_diff=$(git diff)
160
70
- if test -n "${git_diff}"; then printf '%s\n\ngit diff should be empty here under all circumstances. CI broken?\n' "${git_diff}"; exit 1; fi
161
71
- ./tools/print-generated-files.sh -a
162
72
- git_diff=$(git diff)
163
73
- if test -n "${git_diff}"; then printf '%s\n\n.gitattributes are missing a generated file. Please run "./tools/print-generated-files.sh -a" and commit the resulting change to fix them.\n' "${git_diff}"; exit 1; fi
164
74
75
+ shellcheck :
76
+ stage : test
77
+ script :
78
+ - ./tools/shellcheck-all.sh
79
+
80
+ .base_get_list_of_modified_files : &get_modified_files
81
+ - MODIFIED_FILES=$(git diff --name-only $(git merge-base origin/master HEAD))
82
+ - echo "${MODIFIED_FILES}"
83
+
84
+ .base_get_list_of_python_scripts : &get_python_scripts
85
+ - PYTHON_SCRIPTS=$(find ${INPUT-.} -type f -not -path './.git/*' -and \( -name '*.py' -or -name '*.py.in' \) | sort)
86
+ - echo "${PYTHON_SCRIPTS}"
87
+ - if test -z "${PYTHON_SCRIPTS}"; then echo "No python scripts to check. Exiting early."; exit 0; fi
88
+
89
+ bandit :
90
+ script :
91
+ - bandit -r ./src -x ./.git
92
+
93
+ pycodestyle :
94
+ stage : test
95
+ script :
96
+ # - *get_modified_files
97
+ # - INPUT="${MODIFIED_FILES}"
98
+ - *get_python_scripts
99
+ - pycodestyle --config=.gitlab/ci/pycodestyle.cfg ${PYTHON_SCRIPTS}
100
+
101
+ pylint :
102
+ stage : test
103
+ script :
104
+ # - *get_modified_files
105
+ # - INPUT="${MODIFIED_FILES}"
106
+ - *get_python_scripts
107
+ - pylint --jobs "$(nproc || gnproc || echo 1)" --rcfile ./.gitlab/ci/pylint.rc ${PYTHON_SCRIPTS}
108
+ # If we reached this point, it means pylint passed. Run again with all warnings enabled, but ignore the return code to show a list of improvements that the developer could do, even when CI is passing.
109
+ - pylint --jobs "$(nproc || gnproc || echo 1)" --rcfile ./.gitlab/ci/pylint.rc --enable all ${PYTHON_SCRIPTS} || true
110
+
165
111
# ############################## SAST ################################
166
112
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/sast/
167
113
#
0 commit comments