Remove timestamps from docs/api-reference/*/*.html

If there are 2 or more PR(s) in the queue, they will end up with
conflicts (and rechecks). So let us remove the timestamp entirely
when we generate the files.

Fixes #46814
This commit is contained in:
Davanum Srinivas
2017-06-02 08:58:54 -04:00
parent 7e62e753e1
commit 5b3c3665f3
47 changed files with 59 additions and 47 deletions

View File

@@ -127,13 +127,25 @@ kube::swagger::gen_api_ref_docs() {
find . -type f | cut -sd / -f 2- | LC_ALL=C sort > .generated_html
popd > /dev/null
if LANG=C sed --help 2>&1 | grep -q GNU; then
SED="sed"
elif which gsed &>/dev/null; then
SED="gsed"
else
echo "Failed to find GNU sed as sed or gsed. If you are on Mac: brew install gnu-sed." >&2
exit 1
fi
while read file; do
if [[ -e "${output_dir}/${file}" && -e "${output_tmp}/${file}" ]]; then
echo "comparing ${output_dir}/${file} with ${output_tmp}/${file}"
# Remove the timestamp to reduce conflicts in PR(s)
$SED -i 's/^Last updated.*$//' "${output_tmp}/${file}"
# By now, the contents should be normalized and stripped of any
# auto-managed content.
if diff -NauprB -I 'Last update' "${output_dir}/${file}" "${output_tmp}/${file}" >/dev/null; then
if diff -NauprB "${output_dir}/${file}" "${output_tmp}/${file}" >/dev/null; then
# actual contents same, overwrite generated with original.
cp "${output_dir}/${file}" "${output_tmp}/${file}"
fi