Skip to content

Commit

Permalink
Adapt playground to M1 mac #3488
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed Mar 7, 2023
1 parent 036dd62 commit a5510f9
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions ccloud/environment/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

DISABLE_REPLICATOR_MONITORING=""
Expand Down
1 change: 1 addition & 0 deletions environment/2way-ssl/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/2way-ssl/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/kerberos/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/kerberos/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} down -v --remove-orphans
Expand Down
1 change: 1 addition & 0 deletions environment/kraft-external-plaintext/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/kraft-external-plaintext/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/kraft-plaintext/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/kraft-plaintext/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/ldap-authorizer-sasl-plain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/sasl-plain/docker-compose.yml -f ../../environment/ldap-authorizer-sasl-plain/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/ldap-sasl-plain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/sasl-plain/docker-compose.yml -f ../../environment/ldap-sasl-plain/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/mdc-kerberos/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

DISABLE_REPLICATOR_MONITORING=""
Expand Down
1 change: 1 addition & 0 deletions environment/mdc-plaintext/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

DISABLE_REPLICATOR_MONITORING=""
Expand Down
1 change: 1 addition & 0 deletions environment/mdc-sasl-plain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

DISABLE_REPLICATOR_MONITORING=""
Expand Down
1 change: 1 addition & 0 deletions environment/plaintext/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ then
set +e
nb_connect_services=$(egrep -c "connect[0-9]+:" ${DOCKER_COMPOSE_FILE_OVERRIDE})
set -e
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

# defined 3 Connect variable and when profile is included/excluded
Expand Down
1 change: 1 addition & 0 deletions environment/rbac-sasl-plain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/rbac-sasl-plain/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} up -d zookeeper broker tools openldap
Expand Down
1 change: 1 addition & 0 deletions environment/sasl-plain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/sasl-plain/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/sasl-scram/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/sasl-scram/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/sasl-ssl/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/sasl-ssl/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} build
Expand Down
1 change: 1 addition & 0 deletions environment/ssl_kerberos/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ DOCKER_COMPOSE_FILE_OVERRIDE=$1
if [ -f "${DOCKER_COMPOSE_FILE_OVERRIDE}" ]
then
ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE="-f ${DOCKER_COMPOSE_FILE_OVERRIDE}"
check_arm64_support "${DIR}" "${DOCKER_COMPOSE_FILE_OVERRIDE}"
fi

docker-compose -f ../../environment/plaintext/docker-compose.yml -f ../../environment/ssl_kerberos/docker-compose.yml ${ENABLE_DOCKER_COMPOSE_FILE_OVERRIDE} down -v --remove-orphans
Expand Down
26 changes: 26 additions & 0 deletions scripts/cli/src/lib/utils_function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3257,3 +3257,29 @@ function ccloud::version_gt() {
## ccloud-utils functions
## END
##############

function check_arm64_support() {
DIR="$1"
DOCKER_COMPOSE_FILE="$2"
set +e
if [ `uname -m` = "arm64" ]
then
test=$(echo "$DOCKER_COMPOSE_FILE" | awk -F"/" '{ print $(NF-2)"/"$(NF-1) }')
grep "${test}" ${DIR}/../../scripts/arm64-support-none.txt > /dev/null
if [ $? = 0 ]
then
logerror "🖥️ This example is not working with ARM64 !"
exit 1
fi

grep "${test}" ${DIR}/../../scripts/arm64-support-with-emulation.txt > /dev/null
if [ $? = 0 ]
then
logwarn "🖥️ This example is working with ARM64 but requires emulation."
exit 1
fi

log "🖥️ This example should work natively with ARM64."
fi
set -e
}

0 comments on commit a5510f9

Please sign in to comment.