Skip to content

Commit e19c966

Browse files
authored
feat: Skip large-set warning if DEFAULT_SERVICES is overridden (openedx-unsupported#723)
Some developers make use of the option of overriding `DEFAULT_SERVICES` in options.local.mk (a git-ignored overrides file) as mentioned in the docs. These people presumably know what they're doing and have already selected a smaller set of services, so there's no point in bothering them with a warning.
1 parent e5fa9dd commit e19c966

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

scripts/make_warn_default_large.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
target="$1"
1010

11-
cat <<"EOCOW" >&2
11+
show_warning_and_wait() {
12+
cat <<"EOCOW" >&2
1213
_________________________________________________________________________
1314
/ \
1415
| Are you sure you want to run this command for *all* Open edX services? |
@@ -21,7 +22,7 @@ cat <<"EOCOW" >&2
2122
2223
EOCOW
2324

24-
cat <<EOF >&2
25+
cat <<EOF >&2
2526
The command "make $target" will operate on a large default set of
2627
services and their dependencies. This can make your task take longer
2728
than necessary.
@@ -37,10 +38,19 @@ down Docker images you don't need or take up extra memory and CPU. You
3738
might even run into bugs in unrelated services.
3839
3940
(If you *really* want the large default set of services, you can use
40-
the command "make $target.large-and-slow".)
41+
the command "make $target.large-and-slow". You can also configure
42+
DEFAULT_SERVICES in your options.local.mk to your preferred smaller
43+
set of services. Either of these options will prevent this warning.)
4144
4245
EOF
4346

44-
read -r -p $'(You can cancel the command now with Ctrl-C or press ENTER to continue.)\n'
47+
read -r -p $'(You can cancel the command now with Ctrl-C or press ENTER to continue.)\n'
48+
}
49+
50+
if grep --quiet --no-messages '^DEFAULT_SERVICES' options.local.mk; then
51+
echo >&2 "Skipping warning because DEFAULT_SERVICES is set in options.local.mk"
52+
else
53+
show_warning_and_wait
54+
fi
4555

4656
make --no-print-directory "$target.large-and-slow"

0 commit comments

Comments
 (0)