|
71 | 71 | - echo -e "\e[1;33m Initializing ORT in GitLab... "
|
72 | 72 |
|
73 | 73 | # Setting default values for various variables.
|
74 |
| - - | |
| 74 | + - | |
75 | 75 | export ORT_DATA_PATH=${HOME}/${ORT_DATA_DIR_NAME:-".ort"}
|
76 | 76 | export DISABLE_SHALLOW_CLONE=${DISABLE_SHALLOW_CLONE:-"false"}
|
77 | 77 | export FAIL_ON_OUTDATED_NOTICE_FILE=${FAIL_ON_OUTDATED_NOTICE_FILE:-"false"}
|
|
104 | 104 | export ORT_RESULTS_WEB_APP_PATH="${ORT_RESULTS_PATH}/scan-report-web-app.html"
|
105 | 105 | export ORT_RUN_COMMANDS=${RUN:-"labels,analyzer,evaluator,advisor,reporter"}
|
106 | 106 | export ORT_VERSION=$(ort --version)
|
107 |
| - export POSTGRES_PASSWORD=${POSTGRES_PASSWORD-:$DB_PASSWORD} |
108 |
| - export POSTGRES_SCHEMA=${POSTGRES_SCHEMA-:$DB_SCHEMA} |
109 |
| - export POSTGRES_URL=${POSTGRES_URL-:$DB_URL} |
110 |
| - export POSTGRES_USERNAME=${POSTGRES_USERNAME-:$DB_USERNAME} |
| 107 | + export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-$DB_PASSWORD} |
| 108 | + export POSTGRES_SCHEMA=${POSTGRES_SCHEMA:-$DB_SCHEMA} |
| 109 | + export POSTGRES_URL=${POSTGRES_URL:-$DB_URL} |
| 110 | + export POSTGRES_USERNAME=${POSTGRES_USERNAME:-$DB_USERNAME} |
111 | 111 |
|
112 | 112 | if [ ! -n "${VCS_TYPE+x}" ] && \
|
113 | 113 | [ ! -n "${VCS_URL+x}" ] && \
|
|
127 | 127 | export PROJECT_VCS_REVISION=${VCS_REVISION:-""}
|
128 | 128 | export PROJECT_VCS_PATH=${VCS_PATH:-""}
|
129 | 129 | export PROJECT_PATH="${HOME}/project"
|
130 |
| - fi |
| 130 | + fi |
131 | 131 |
|
132 | 132 | export PROJECT_VCS_REPOSITORY_NAME=$(echo $PROJECT_VCS_URL | sed -E 's/.*\/(.*)\.git/\1/')
|
133 | 133 | export SW_NAME=${SW_NAME:-"$PROJECT_VCS_REPOSITORY_NAME"}
|
|
158 | 158 | cd $ORT_CONFIG_PATH
|
159 | 159 | [[ -d "${ORT_CONFIG_PATH}/.git" ]] \
|
160 | 160 | && export ORT_CONFIG_VCS_URL=$(git config remote.origin.url) \
|
161 |
| - && export ORT_CONFIG_VCS_REVISION=$(git rev-parse HEAD) |
| 161 | + && export ORT_CONFIG_VCS_REVISION=$(git rev-parse HEAD) |
162 | 162 | cd -
|
163 |
| - |
| 163 | +
|
164 | 164 | echo -e "Using ORT config revision ${ORT_CONFIG_VCS_REVISION}."
|
165 | 165 |
|
166 | 166 | # Generate ORT global configuration if not found and PostgreSQL is used.
|
|
250 | 250 | else
|
251 | 251 | echo -e "\e[1;33m Using 'config.yml' from 'ort-config' repository..."
|
252 | 252 | fi
|
253 |
| - |
| 253 | +
|
254 | 254 | ${ORT_CLI} config --show-active
|
255 | 255 |
|
256 |
| - # Generate labels to be passed as arguments to ORT Analyzer. |
| 256 | + # Generate labels to be passed as arguments to ORT Analyzer. |
257 | 257 | # Labels can be used track scan related info or execute policy rules for specific product, delivery or organization.
|
258 | 258 | - |
|
259 | 259 | if [[ ${ORT_RUN_COMMANDS} == *"labels"* ]]; then
|
|
280 | 280 | elif [[ ! -z "${ORT_YML_PATH}" ]]; then
|
281 | 281 | echo -e "\e[1;31m File ${ORT_YML_PATH} not found!."
|
282 | 282 | fi
|
283 |
| - |
| 283 | +
|
284 | 284 | - |
|
285 | 285 | export ORT_CLI_ANALYZE_ARGS ORT_CLI_EVALUATE_ARGS ORT_CLI_REPORT_ARGS
|
286 | 286 |
|
|
304 | 304 | --project-name "${SW_NAME_SAFE}" \
|
305 | 305 | || ORT_CLI_DOWNLOAD_EXIT_CODE=$? \
|
306 | 306 | && export ORT_CLI_DOWNLOAD_EXIT_CODE="${ORT_CLI_DOWNLOAD_EXIT_CODE:-0}"
|
307 |
| - |
| 307 | +
|
308 | 308 | [[ ${ORT_CLI_DOWNLOAD_EXIT_CODE} -eq 1 ]] \
|
309 | 309 | && echo -e "\e[1;31m Unable to retrieve project sources from ${VCS_URL}." \
|
310 | 310 | && exit 1
|
311 | 311 | fi
|
312 |
| - |
| 312 | +
|
313 | 313 | # Run ORT's Analyzer to determine the dependencies used by the project and their metadata.
|
314 | 314 | - |
|
315 | 315 | echo -e "\e[1;33m Running ORT Analyzer... "
|
|
329 | 329 | [[ -f ${ORT_RESULTS_ANALYZER_PATH} ]] \
|
330 | 330 | && ln -frs $ORT_RESULTS_ANALYZER_PATH $ORT_RESULTS_CURRENT_PATH \
|
331 | 331 | || echo -e "\e[1;31m File $ORT_RESULTS_ANALYZER_PATH not found."
|
332 |
| - |
| 332 | +
|
333 | 333 | [[ ${ORT_CLI_ANALYZE_EXIT_CODE} -eq 1 ]] && exit 1
|
334 | 334 |
|
335 | 335 | # Run ORT's Scanner to use configured source code scanners to detect license and copyright findings.
|
|
427 | 427 |
|
428 | 428 | [[ ${ORT_CLI_REPORT_CODE} -eq 1 ]] && exit 1
|
429 | 429 | fi
|
430 |
| - |
431 |
| - # Remove job internal use only current-result.json from scan results directory |
| 430 | +
|
| 431 | + # Remove job internal use only current-result.json from scan results directory |
432 | 432 | - |
|
433 | 433 | [[ -f ${ORT_RESULTS_CURRENT_PATH} ]] \
|
434 | 434 | && rm $ORT_RESULTS_CURRENT_PATH \
|
|
0 commit comments