Skip to content

Commit 90c1f00

Browse files
committed
fix: Postgres config is generated without need
This now uses the correct syntax for shell default values. Signed-off-by: Karsten Silkenbäumer <[email protected]>
1 parent 2cf0e42 commit 90c1f00

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

templates/ort-scan.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
- echo -e "\e[1;33m Initializing ORT in GitLab... "
7272

7373
# Setting default values for various variables.
74-
- |
74+
- |
7575
export ORT_DATA_PATH=${HOME}/${ORT_DATA_DIR_NAME:-".ort"}
7676
export DISABLE_SHALLOW_CLONE=${DISABLE_SHALLOW_CLONE:-"false"}
7777
export FAIL_ON_OUTDATED_NOTICE_FILE=${FAIL_ON_OUTDATED_NOTICE_FILE:-"false"}
@@ -104,10 +104,10 @@
104104
export ORT_RESULTS_WEB_APP_PATH="${ORT_RESULTS_PATH}/scan-report-web-app.html"
105105
export ORT_RUN_COMMANDS=${RUN:-"labels,analyzer,evaluator,advisor,reporter"}
106106
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}
111111
112112
if [ ! -n "${VCS_TYPE+x}" ] && \
113113
[ ! -n "${VCS_URL+x}" ] && \
@@ -127,7 +127,7 @@
127127
export PROJECT_VCS_REVISION=${VCS_REVISION:-""}
128128
export PROJECT_VCS_PATH=${VCS_PATH:-""}
129129
export PROJECT_PATH="${HOME}/project"
130-
fi
130+
fi
131131
132132
export PROJECT_VCS_REPOSITORY_NAME=$(echo $PROJECT_VCS_URL | sed -E 's/.*\/(.*)\.git/\1/')
133133
export SW_NAME=${SW_NAME:-"$PROJECT_VCS_REPOSITORY_NAME"}
@@ -158,9 +158,9 @@
158158
cd $ORT_CONFIG_PATH
159159
[[ -d "${ORT_CONFIG_PATH}/.git" ]] \
160160
&& 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)
162162
cd -
163-
163+
164164
echo -e "Using ORT config revision ${ORT_CONFIG_VCS_REVISION}."
165165
166166
# Generate ORT global configuration if not found and PostgreSQL is used.
@@ -250,10 +250,10 @@
250250
else
251251
echo -e "\e[1;33m Using 'config.yml' from 'ort-config' repository..."
252252
fi
253-
253+
254254
${ORT_CLI} config --show-active
255255
256-
# Generate labels to be passed as arguments to ORT Analyzer.
256+
# Generate labels to be passed as arguments to ORT Analyzer.
257257
# Labels can be used track scan related info or execute policy rules for specific product, delivery or organization.
258258
- |
259259
if [[ ${ORT_RUN_COMMANDS} == *"labels"* ]]; then
@@ -280,7 +280,7 @@
280280
elif [[ ! -z "${ORT_YML_PATH}" ]]; then
281281
echo -e "\e[1;31m File ${ORT_YML_PATH} not found!."
282282
fi
283-
283+
284284
- |
285285
export ORT_CLI_ANALYZE_ARGS ORT_CLI_EVALUATE_ARGS ORT_CLI_REPORT_ARGS
286286
@@ -304,12 +304,12 @@
304304
--project-name "${SW_NAME_SAFE}" \
305305
|| ORT_CLI_DOWNLOAD_EXIT_CODE=$? \
306306
&& export ORT_CLI_DOWNLOAD_EXIT_CODE="${ORT_CLI_DOWNLOAD_EXIT_CODE:-0}"
307-
307+
308308
[[ ${ORT_CLI_DOWNLOAD_EXIT_CODE} -eq 1 ]] \
309309
&& echo -e "\e[1;31m Unable to retrieve project sources from ${VCS_URL}." \
310310
&& exit 1
311311
fi
312-
312+
313313
# Run ORT's Analyzer to determine the dependencies used by the project and their metadata.
314314
- |
315315
echo -e "\e[1;33m Running ORT Analyzer... "
@@ -329,7 +329,7 @@
329329
[[ -f ${ORT_RESULTS_ANALYZER_PATH} ]] \
330330
&& ln -frs $ORT_RESULTS_ANALYZER_PATH $ORT_RESULTS_CURRENT_PATH \
331331
|| echo -e "\e[1;31m File $ORT_RESULTS_ANALYZER_PATH not found."
332-
332+
333333
[[ ${ORT_CLI_ANALYZE_EXIT_CODE} -eq 1 ]] && exit 1
334334
335335
# Run ORT's Scanner to use configured source code scanners to detect license and copyright findings.
@@ -427,8 +427,8 @@
427427
428428
[[ ${ORT_CLI_REPORT_CODE} -eq 1 ]] && exit 1
429429
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
432432
- |
433433
[[ -f ${ORT_RESULTS_CURRENT_PATH} ]] \
434434
&& rm $ORT_RESULTS_CURRENT_PATH \

0 commit comments

Comments
 (0)