Skip to content

Commit 1f57f9b

Browse files
authored
Merge pull request #331 from keymanapp/maint/bootstrap-resilience
maint: improve bootstrap resilience
2 parents 8145e75 + 6725567 commit 1f57f9b

4 files changed

Lines changed: 29 additions & 11 deletions

File tree

.gitattributes

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11

2-
Dockerfile text eol=lf
3-
*.sh eol=lf
2+
Dockerfile text eol=lf
3+
*.Dockerfile text eol=lf
4+
*.sh eol=lf

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ vendor*
88
# Shared files are bootstrapped:
99
resources/bootstrap.inc.sh
1010
resources/.bootstrap-version
11+
resources/.bootstrap-registry
1112
_common/
1213

1314
# State files
14-
_control/debug
15+
_control/debug
16+
_control/release

build.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
readonly THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
44
readonly BOOTSTRAP="$(dirname "$THIS_SCRIPT")/resources/bootstrap.inc.sh"
55
readonly BOOTSTRAP_VERSION=v1.0.10
6-
[ -f "$BOOTSTRAP" ] && source "$BOOTSTRAP" || source <(curl -fs https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh)
6+
if ! [ -f "$BOOTSTRAP" ] || ! source "$BOOTSTRAP"; then
7+
curl -H "Cache-Control: no-cache" --fail --silent --show-error -w "curl: Finished attempt to download %{url}" "https://raw.githubusercontent.com/keymanapp/shared-sites/$BOOTSTRAP_VERSION/bootstrap.inc.sh" -o "$BOOTSTRAP.tmp" || exit 1
8+
source "$BOOTSTRAP.tmp"
9+
rm -f "$BOOTSTRAP.tmp"
10+
fi
711
## END STANDARD SITE BUILD SCRIPT INCLUDE
812

913
readonly API_KEYMAN_DB_CONTAINER_NAME=api-keyman-com-db
@@ -29,6 +33,9 @@ builder_describe \
2933
"stop" \
3034
"test" \
3135
"--rebuild-test-fixtures Rebuild the test fixtures from live data" \
36+
"--no-unit-test" \
37+
"--no-lint" \
38+
"--no-link-check" \
3239
":db Build the database" \
3340
":app Build the site"
3441

@@ -42,15 +49,22 @@ function test_docker_container() {
4249
touch rebuild-test-fixtures.txt
4350
fi
4451

45-
# Run unit tests
46-
docker exec $API_KEYMAN_CONTAINER_DESC sh -c "vendor/bin/phpunit --testdox"
52+
if ! builder_has_option --no-unit-test; then
53+
# Run unit tests
54+
# shellcheck disable=SC2154
55+
docker exec $API_KEYMAN_CONTAINER_DESC sh -c "vendor/bin/phpunit --testdox ${builder_extra_params[*]}"
56+
fi
4757

48-
# Lint .php files for obvious errors
49-
docker exec $API_KEYMAN_CONTAINER_DESC sh -c "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l"
58+
if ! builder_has_option --no-lint; then
59+
# Lint .php files for obvious errors
60+
docker exec $API_KEYMAN_CONTAINER_DESC sh -c "find . -name '*.php' | grep -v '/vendor/' | xargs -n 1 -d '\\n' php -l"
61+
fi
5062

51-
# Check all internal links
52-
# NOTE: link checker runs on host rather than in docker image
53-
npx broken-link-checker http://localhost:8058 --ordered --recursive --host-requests 10 -e --filter-level 3
63+
if ! builder_has_option --no-link-check; then
64+
# Check all internal links
65+
# NOTE: link checker runs on host rather than in docker image
66+
npx broken-link-checker http://localhost:8058 --ordered --recursive --host-requests 10 -e --filter-level 3
67+
fi
5468

5569
rm tier.txt
5670
}

tools/2020/ReleaseSchedule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static function DoesRequestMeetSchedule(string $releaseDate, int $current
4242

4343
foreach($schedule as $days => $minutes) {
4444
if($interval->days <= $days) {
45+
// TODO: spread this test across the hour rather than just 'first x minutes of the hour'
4546
return $currentTime['minutes'] < $minutes;
4647
}
4748
}

0 commit comments

Comments
 (0)