Skip to content

Commit 91adb80

Browse files
committed
Add svace import settings
Signed-off-by: Maksim Khimchenko <[email protected]>
1 parent d5e7932 commit 91adb80

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

svace_analyze/action.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ runs:
227227
--form options='{\"values\":[ \
228228
{\"option\":\"project-group\",\"value\":\"${PROJECT_GROUP}\"}, \
229229
{\"option\":\"if-no-group\",\"value\":\"${IF_NO_GROUP}\"}, \
230-
{\"option\":\"field\",\"value\":\"CI_COMMIT_HASH:${CI_COMMIT_HASH}\"} \
230+
{\"option\":\"field\",\"value\":\"CI_COMMIT_HASH:${CI_COMMIT_HASH}\"}, \
231+
{\"option\":\"field\",\"value\":\"CI_COMMIT_REF_NAME:${CI_COMMIT_REF_NAME}\"} \
231232
]}'"
232233
233234
info "Importing \"${project_name}\"..."
@@ -268,6 +269,27 @@ runs:
268269
fi
269270
}
270271
272+
define_import_params() {
273+
local -n project="${1}"
274+
local -n branch="${2}"
275+
if [[ $(send "[[ -f ${proj}/.svace-dir/import-settings ]] && echo true || echo false") == true ]]; then
276+
import_settings=$(send "cat /${proj}/.svace-dir/import-settings")
277+
while IFS='=' read -r key val; do
278+
case "$key" in
279+
ProjectName)
280+
project=$val
281+
;;
282+
Branch)
283+
branch=$val
284+
;;
285+
*)
286+
warning "Undefined import setting \"${key}=${val}\" will be ommited!"
287+
;;
288+
esac
289+
done <<< "${import_settings}"
290+
fi
291+
}
292+
271293
if [[ $(send "[[ -d /${SVACE_ANALYZE_DIR}/${CI_COMMIT_HASH} ]] && echo true || echo false") == false ]]; then
272294
echo "::warning file=$(realpath "$0")::Specified commit directory doesn't exists on analyze server." && exit 0
273295
fi
@@ -281,7 +303,12 @@ runs:
281303
svacer_proj=${proj#/${SVACE_ANALYZE_DIR}/${CI_COMMIT_HASH}/}
282304
build_item=${svacer_proj##*/}
283305
306+
import_project=${svacer_proj}
307+
import_branch=${CI_COMMIT_REF_NAME}
308+
284309
if [[ $(send "[[ -d ${proj}/.svace-dir ]] && echo true || echo false") == true ]]; then
310+
define_import_params import_project import_branch
311+
285312
info "Start analyzing project \"${svacer_proj}\" ..."
286313
send "svace config --svace-dir ${proj} THREAD_NUMBER auto"
287314
send "svace analyze --set-config SKIP_UNREACHABLE_PROCEDURE_ANALYSIS=${SKIP_UNREACHABLE_PROCEDURE_ANALYSIS} --quiet --svace-dir ${proj}"

0 commit comments

Comments
 (0)