Navigation Menu

Skip to content

Commit

Permalink
fix: use correct exit codes for docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahed Ahmed committed Jul 28, 2021
1 parent a235a72 commit 73174f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docker/docker-entrypoint.sh
Expand Up @@ -51,7 +51,7 @@ PROJECT_SUBDIR=""

if [ -n "${TARGET_FILE}" ]; then
if [ ! -f "${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}" ]; then
exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 1
exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 2
fi

PROJECT_SUBDIR=$(dirname "${TARGET_FILE}")
Expand All @@ -70,15 +70,15 @@ SNYK_PARAMS="${SNYK_PARAMS} ${TEST_SETTINGS}"
##

if [ -z "${SNYK_TOKEN}" ]; then
exitWithMsg "Missing \${SNYK_TOKEN}" 1
exitWithMsg "Missing \${SNYK_TOKEN}" 2
fi

if [ -n "${ENV_FLAGS}" ]; then
ADDITIONAL_ENV="-- ${ENV_FLAGS}"
fi

cd "${PROJECT_PATH}/${PROJECT_FOLDER}/${PROJECT_SUBDIR}" ||
exitWithMsg "Can't cd to ${PROJECT_PATH}/${PROJECT_FOLDER}/${PROJECT_SUBDIR}" 1
exitWithMsg "Can't cd to ${PROJECT_PATH}/${PROJECT_FOLDER}/${PROJECT_SUBDIR}" 2

runCmdAsDockerUser "PATH=${PATH} snyk ${SNYK_COMMAND} --json ${SNYK_PARAMS} \
${ADDITIONAL_ENV} > \"${OUTPUT_FILE}\" 2>\"${ERROR_FILE}\""
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-python-entrypoint.sh
Expand Up @@ -30,7 +30,7 @@ PROJECT_SUBDIR=""
echo "Project path = ${PROJECT_PATH}"
if [ -n "${TARGET_FILE}" ]; then
if [ ! -f "${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}" ]; then
exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 1
exitWithMsg "\"${PROJECT_PATH}/${PROJECT_FOLDER}/${TARGET_FILE}\" does not exist" 2
fi

PROJECT_SUBDIR=$(dirname "${TARGET_FILE}")
Expand All @@ -53,7 +53,7 @@ if [ -n "${TARGET_FILE}" ]; then
installPipfileDeps
;;
*)
exitWithMsg "\"${PROJECT_PATH}/${TARGET_FILE}\" is not supported" 1
exitWithMsg "\"${PROJECT_PATH}/${TARGET_FILE}\" is not supported" 3
;;
esac
fi
Expand Down

0 comments on commit 73174f5

Please sign in to comment.