Skip to content

Commit 8df024e

Browse files
authored
NO-JIRA: ensure empty lines are skipped while processing env files in check-params-env.sh (#1784)
This solves the issues in https://github.com/opendatahub-io/notebooks/actions/runs/16837438136/job/47700268773 triggered by introduction of empty lines in `params-latest.env` in * #1730 ``` Checking that all variables in the file 'manifests/base/params.env' & 'manifests/base/params-latest.env' are unique and expected Some of the variables in the file aren't unique! ``` ``` Checking that all values assigned to variables in the file 'manifests/base/params.env' & 'manifests/base/params-latest.env' are unique and expected Some of the values in the file aren't unique! ``` ``` Checking that there are expected number of records in the file 'manifests/base/params.env' + 'manifests/base/params-latest.env' Number of records in the file is incorrect - expected '44' but got '75'! ``` ``` Checking format of: '' ERROR: Line doesn't contain '=' and it should! ```
1 parent 575aecb commit 8df024e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ci/check-params-env.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function check_variables_uniq() {
5252
echo "Checking that all variables in the file '${env_file_path_1}' & '${env_file_path_2}' are unique and expected"
5353

5454
local content
55-
content=$(sed 's#\(.*\)=.*#\1#' "${env_file_path_1}"; sed 's#\(.*\)=.*#\1#' "${env_file_path_2}" | sort)
55+
content=$(sed '/^$/d' "${env_file_path_1}" "${env_file_path_2}" | sed 's#\(.*\)=.*#\1#' | sort)
5656

5757
local num_records
5858
num_records=$(echo "${content}" | wc -l)
@@ -69,7 +69,7 @@ function check_variables_uniq() {
6969
if test "${allow_value_duplicity}" = "false"; then
7070
echo "Checking that all values assigned to variables in the file '${env_file_path_1}' & '${env_file_path_2}' are unique and expected"
7171

72-
content=$(sed 's#\(.*\)=.*#\1#' "${env_file_path_1}"; sed 's#\(.*\)=.*#\1#' "${env_file_path_2}" | sort)
72+
content=$(sed '/^$/d' "${env_file_path_1}" "${env_file_path_2}" | sed 's#\(.*\)=.*#\1#' | sort)
7373

7474
local num_values
7575
num_values=$(echo "${content}" | wc -l)
@@ -589,6 +589,9 @@ check_variables_uniq "${PARAMS_ENV_PATH}" "${PARAMS_LATEST_ENV_PATH}" "false" "t
589589
process_file() {
590590
local_ret_code=0
591591
while IFS= read -r LINE; do
592+
# If the line is empty, skip to the next one
593+
[[ -z "$LINE" ]] && continue
594+
592595
echo "Checking format of: '${LINE}'"
593596
[[ "${LINE}" = *[[:space:]]* ]] && {
594597
echo "ERROR: Line contains white-space and it shouldn't!"

0 commit comments

Comments
 (0)