Skip to content

Commit 9c9fbe9

Browse files
committed
some improvements
* UTF-8 error/warning signs * emit diff on tarball listing differences, if tarballs are different * dump tarball listings to disk, if tarballs are different * do not purge temp directory when errors were reported * fix usage of `find` for helm-chart checks
1 parent 5ef277a commit 9c9fbe9

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

tools/verify-release/verify-release.sh

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,19 @@ if [[ ! ${maven_repo_id} =~ ${STAGING_REGEX} ]]; then
104104
fi
105105
maven_repo_id="${BASH_REMATCH[1]}"
106106

107+
fatal_reported=0
108+
finished=0
109+
107110
run_id="polaris-release-verify-$(date "+%Y-%m-%d-%k-%M-%S")"
108111
temp_dir="$(mktemp --tmpdir --directory "${run_id}-XXXXXXXXX")"
109112
function purge_temp_dir {
110113
if [[ $keep_temp_dir -eq 0 ]] ; then
111-
echo "Purging ${temp_dir}..."
112-
rm -rf "${temp_dir}"
114+
if [[ $fatal_reported -eq 0 && $finished -eq 1 ]] ; then
115+
echo "Purging ${temp_dir}..."
116+
rm -rf "${temp_dir}"
117+
else
118+
echo "⚠ NOT purging temporary directory ${temp_dir} - errors were reported!"
119+
fi
113120
else
114121
echo "Leaving ${temp_dir} around, you may want to purge it."
115122
fi
@@ -173,7 +180,8 @@ function log_part_end {
173180
}
174181

175182
function log_fatal {
176-
echo -n -e "${RED}"
183+
fatal_reported=1
184+
echo -n -e "${RED}"
177185
echo -n "$1"
178186
echo -e "${RESET}"
179187
echo "" >> "${failures_file}"
@@ -183,7 +191,7 @@ function log_fatal {
183191
}
184192

185193
function log_warn {
186-
echo -ne "${ORANGE}"
194+
echo -ne "${ORANGE}"
187195
echo -n "$1"
188196
echo -e "${RESET}"
189197
}
@@ -311,16 +319,22 @@ function report_mismatch {
311319
*.tar.gz | *.tgz | *.tar)
312320
mkdir "${local_file}.extracted" "${repo_file}.extracted"
313321
tar --warning=no-timestamp -xf "${local_file}" --directory "${local_file}.extracted" || true
322+
log_info " extracted to ${local_file}.extracted"
314323
tar --warning=no-timestamp -xf "${repo_file}" --directory "${repo_file}.extracted" || true
324+
log_info " extracted to ${repo_file}.extracted"
315325
if proc_exec "${title}" diff --recursive "${local_file}.extracted" "${repo_file}.extracted"; then
316326
# Dump tar listing only when the contents are equal (to inspect mtime and posix attributes)
317327
log_warn "${title}"
318328
(
319329
echo "${title}" # log_warn above prints ANSI escape sequences
330+
tar --warning=no-timestamp -tvf "${local_file}" > "${local_file}.contents-listing" || true
331+
tar --warning=no-timestamp -tvf "${repo_file}" > "${repo_file}.contents-listing" || true
332+
echo "Diff of archives contents:"
333+
diff "${local_file}.contents-listing" "${repo_file}.contents-listing"
320334
echo ">>>>>>>>>>>>>>> tar tvf ${local_file}"
321-
tar --warning=no-timestamp -tvf "${local_file}" || true
335+
cat "${local_file}.contents-listing"
322336
echo ">>>>>>>>>>>>>>> tar tvf ${repo_file}"
323-
tar --warning=no-timestamp -tvf "${repo_file}" || true
337+
cat "${repo_file}.contents-listing"
324338
echo ""
325339
) >> "${failures_file}"
326340
fi
@@ -484,7 +498,7 @@ log_part_start "Comparing helm chart artifacts"
484498
mkdir -p "${helm_work_dir}/local" "${helm_work_dir}/staged"
485499
# Prerequisite for reproducible helm packages: file modification time must be deterministic
486500
# Works with helm since version 4.0.0
487-
exec_process find "${worktree_dir}/helm/polaris" -exec touch -d "1980-01-01 00:00:00" {} +
501+
find "${worktree_dir}/helm/polaris" -exec touch -d "1980-01-01 00:00:00" {} +
488502
proc_exec "Helm packaging failed" helm package --destination "${helm_work_dir}" "${worktree_dir}/helm/polaris"
489503
helm_package_file="polaris-${version}.tgz"
490504
tar --warning=no-timestamp -xf "${helm_dir}/${helm_package_file}" --directory "${helm_work_dir}/staged" || true
@@ -544,3 +558,5 @@ The contents of all LICENSE and NOTICE files however MUST be verified manually.
544558
545559
!
546560
fi
561+
562+
finished=1

0 commit comments

Comments
 (0)