instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.58k stars 2.48k forks source link

Fix syntax error for script/common/utils/common.sh check_dependencies function #2171

Closed cgravatt closed 1 year ago

cgravatt commented 1 year ago

Evaluation of docker-compose version outputs multiple lines with multiple matches to the regex pattern

We only want the docker-compose version which is first so pipe it to head. This fixes the following syntax error

Checking Dependencies...
script/common/utils/common.sh: line 159: ((: 0
0
0
1 : syntax error in expression (error token is "0
0
1 ")
echo "$(eval "docker-compose" version |grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")"
1.29.2
5.0.3
3.10.6
3.0.2
echo "$(eval "docker-compose" version |grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")" | head -1
1.29.2

Closes #2169

Test Plan:

maths22 commented 1 year ago

This was merged in 72f993ed90f4b00c31d4e3989bd0f433a3ef94b5