QA: Simplify Comparison Between Local And Remote Site Files

This commit adds an extra step to the build process to SHA256 checksum
all the files that are built purely based on repository contents.  The
checksums file is uploaded to the webserver with the rest of the site
content.

A separate target is added to the Makefile to compare the remote
sha256sums file to a locally-built file to see if they differ.  This
allows us to detect when a remote build may have gone astray.
This commit is contained in:
David A. Harding 2015-02-25 16:02:00 -05:00
parent 45855ab2d9
commit 584e19101c
No known key found for this signature in database
GPG key ID: 4B29C30FF29EC4B7
5 changed files with 21 additions and 1 deletions

View file

@ -58,6 +58,9 @@ post-build-tests: post-build-tests-fast
## overwritten content is under version control ## overwritten content is under version control
manual-updates: manual-update-summaries-file manual-updates: manual-update-summaries-file
## All manual checks that can be run by a human
manual-checks: manual-check-diff-sha256sums
@ -71,7 +74,9 @@ ERROR_ON_OUTPUT="sed '1s/^/ERROR:\n/' | if grep . ; then sed 1iERROR ; false ; e
## This should not affect webpage output. ## This should not affect webpage output.
build: build:
$S export LANG=C.UTF-8 ; eval $(JEKYLL_COMMAND) 2>&1 | tee $(JEKYLL_LOG) $S export LANG=C.UTF-8 ; eval $(JEKYLL_COMMAND) 2>&1 | tee $(JEKYLL_LOG)
$S grep -r -L 'Note: this file is built non-deterministically' _site/ \
| egrep -v 'sha256sums.txt' \
| xargs sha256sum > _site/sha256sums.txt
## Jekyll annoyingly returns success even when it emits errors and ## Jekyll annoyingly returns success even when it emits errors and
## exceptions, so we'll grep its output for error strings ## exceptions, so we'll grep its output for error strings
@ -181,3 +186,14 @@ manual-update-summaries-file:
$S echo "{%comment%}AUTOMATICALLY-GENERATED FILE: DO NOT EDIT THIS FILE" > _includes/helpers/summaries.md $S echo "{%comment%}AUTOMATICALLY-GENERATED FILE: DO NOT EDIT THIS FILE" > _includes/helpers/summaries.md
$S echo "This file is licensed under the terms of its source texts{%endcomment%}" >> _includes/helpers/summaries.md $S echo "This file is licensed under the terms of its source texts{%endcomment%}" >> _includes/helpers/summaries.md
$S grep -rh --exclude='*summaries.md' 'assign summary_' _includes/ | sort >> _includes/helpers/summaries.md $S grep -rh --exclude='*summaries.md' 'assign summary_' _includes/ | sort >> _includes/helpers/summaries.md
manual-check-diff-sha256sums:
## A manually-run command to check the locally-built
## _site/sha256sums.txt file against the same file on the webserver to
## see if any files were built differently upstream from what we have
## locally
$S echo "Files listed below (if any) have different hashes"
$S curl -s -o- https://bitcoin.org/sha256sums.txt \
| sort - _site/sha256sums.txt \
| uniq -u \
| sort -k2

View file

@ -5,6 +5,7 @@
layout: base layout: base
id: about-us id: about-us
--- ---
<!-- Note: this file is built non-deterministically -->
<h1>{% translate pagetitle %}</h1> <h1>{% translate pagetitle %}</h1>
<p class="summary">{% translate pagedesc %}</p> <p class="summary">{% translate pagedesc %}</p>

View file

@ -5,6 +5,7 @@
layout: base layout: base
id: development id: development
--- ---
<!-- Note: this file is built non-deterministically -->
<h1>{% translate pagetitle %}</h1> <h1>{% translate pagetitle %}</h1>
<p class="summary">{% translate summary %}</p> <p class="summary">{% translate summary %}</p>

View file

@ -5,6 +5,7 @@
layout: base layout: base
id: events id: events
--- ---
<!-- Note: this file is built non-deterministically -->
<link rel="alternate" type="application/rss+xml" href="/en/rss/events.rss" title="Bitcoin conferences and events"> <link rel="alternate" type="application/rss+xml" href="/en/rss/events.rss" title="Bitcoin conferences and events">
<h1>{% translate pagetitle %}<a type="application/rss+xml" href="/en/rss/events.rss"><img src="/img/icons/icon_rss.svg" alt="rss" class="rssicon"></a></h1> <h1>{% translate pagetitle %}<a type="application/rss+xml" href="/en/rss/events.rss"><img src="/img/icons/icon_rss.svg" alt="rss" class="rssicon"></a></h1>
<p class="summary">{% translate pagedesc %}</p> <p class="summary">{% translate pagedesc %}</p>

View file

@ -4,6 +4,7 @@
--- ---
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"> <rss version="2.0">
<!-- Note: this file is built non-deterministically -->
<channel> <channel>
<title>Bitcoin conferences and events</title> <title>Bitcoin conferences and events</title>
<link>https://bitcoin.org/en/events</link> <link>https://bitcoin.org/en/events</link>