Skip to content

Commit

Permalink
Use mysql/mysql-server image for arm64 architecture (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halsall authored Nov 29, 2021
1 parent 4f6c31d commit 2d980a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions harness/attributes/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ attributes:
resources:
memory: 100Mi
mysql:
image: = 'mysql:' ~ @('services.mysql.version')
version: 5.7
# prefer native platform mysql image. _/mysql doesn't have arm64 images
image: "= host_architecture() == 'amd64' ? 'mysql' : 'mysql/mysql-server'"
version: 8.0
environment:
MYSQL_DATABASE: = @('database.name')
MYSQL_USER: = @('database.user')
Expand Down
20 changes: 20 additions & 0 deletions harness/config/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,23 @@ function('path_split', [paths]): |
});
= $splitPaths;
function('host_architecture', [style]): |
#!php
$arch = php_uname('m');
if ($style == 'native') {
$result = $arch;
} else if (empty($style) || $style == 'go') {
$goArchMap = [
'i386' => '386',
'x86_64' => 'amd64',
'aarch64' => 'arm64',
'armv7l' => 'arm',
'armv6l' => 'arm',
];
$result = $goArchMap[$arch] ?? $arch;
} else {
throw new \Exception(sprintf('error: unknown host_architecture style "%s"', $style));
}
= $result;
3 changes: 2 additions & 1 deletion test
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ function verify_or_exit() {

if [[ -f "${expected_containers}" ]]; then
while read -r container; do
if [ ! "$(docker ps -q -f name=ci-go-sample_"$container")" ]; then
# in docker-compose v2, underscores were replaced with dashes as a separator in container names
if [ ! "$(docker ps -q -f name=ci-go-sample_"$container")" ] && [ ! "$(docker ps -q -f name=ci-go-sample-"$container")" ]; then
echo "The ${container} container is not running, but it should be."
COMPOSE_PROJECT_NAME=ci-go-sample docker-compose logs --tail 100 "$container"
exit 1
Expand Down

0 comments on commit 2d980a0

Please sign in to comment.