Skip to content

Commit 811d0b2

Browse files
committed
skip analyze and import conditions
Signed-off-by: Maksim Khimchenko <maksim.khimchenko@flant.com>
1 parent 27dab81 commit 811d0b2

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

svace_analyze/action.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -261,19 +261,27 @@ runs:
261261
read module image <<< "$(echo ${proj} | grep -oE '[^/]+/[^/]+$' | sed 's/\// /g')"
262262
[[ $image == "*" ]] && warning "Nothing to analyze in ${proj}" && echo "::warning file=$(realpath "$0")::Nothing to analyze" && exit 0
263263
264-
info "Start analyzing module \"${module}\" image \"${image}\"..."
265-
send "svace analyze --quiet --svace-dir ${proj}"
266-
success "Analysis completed successfully!"
267-
268-
info "Start archiving module \"${module}\" image \"${image}\"..."
269-
send "cd ${proj} && tar -czf ${image}.tar.gz .svace-dir && rm -rf .svace-dir"
270-
info "Archiving completed successfuly!"
264+
if [[ -d "${proj}/.svace-dir" ]]; then
265+
info "Start analyzing module \"${module}\" image \"${image}\"..."
266+
send "svace analyze --quiet --svace-dir ${proj}"
267+
success "Analysis completed successfully!"
268+
269+
info "Start archiving module \"${module}\" image \"${image}\"..."
270+
send "cd ${proj} && tar -czf ${image}.tar.gz .svace-dir && rm -rf .svace-dir"
271+
info "Archiving completed successfuly!"
272+
else
273+
warning "Nothing to analyze! Couldn't find \".svace-dir\" in \"${proj}\""
274+
fi
271275
272-
info "Start importing module \"${module}\" image \"${image}\"..."
273-
upload_to_svacer "${module}/${image}" "${CI_COMMIT_REF_NAME}" "${proj}/${image}.tar.gz"
274-
success "Import completed successfuly!"
276+
if [[ -f "${proj}/${image}.tar.gz" ]]
277+
info "Start importing module \"${module}\" image \"${image}\"..."
278+
upload_to_svacer "${module}/${image}" "${CI_COMMIT_REF_NAME}" "${proj}/${image}.tar.gz"
279+
success "Import completed successfuly!"
280+
else
281+
warning "Nothing to import! Couldn't find \"${image}.tar.gz\" in \"${proj}\""
282+
fi
275283
276-
info "Cleaning up imported artifacts..."
284+
info "Cleaning up artifacts..."
277285
send "rm -rf /${proj}"
278286
send "find /${SVACE_ANALYZE_DIR}/${CI_COMMIT_HASH} -type d -empty -delete"
279287
info "Cleanup completed successfully"

0 commit comments

Comments
 (0)