Skip to content

Commit

Permalink
Merge pull request #3313 from guilherme-gm/fix-mariadb
Browse files Browse the repository at this point in the history
Don't use SSL for MariaDB CI runs (Fixes CI)
  • Loading branch information
MishimaHaruna authored Aug 31, 2024
2 parents bcf1be3 + ac87324 commit 613ede9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions tools/ci/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,27 +144,32 @@ case "$MODE" in
;;
esac

SSL_ARG=""
if [[ $(mysql --version) =~ "MariaDB" ]]; then
SSL_ARG="--ssl=0"
fi

case "$MODE" in
createdb)
echo "Creating database $DBNAME as $DBUSER..."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE DATABASE $DBNAME;" || aborterror "Unable to create database."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="CREATE DATABASE $DBNAME;" || aborterror "Unable to create database."
;;
importdb)
echo "Importing tables into $DBNAME as $DBUSER..."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --database=$DBNAME < sql-files/main.sql || aborterror "Unable to import main database."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --database=$DBNAME < sql-files/logs.sql || aborterror "Unable to import logs database."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --database=$DBNAME < sql-files/main.sql || aborterror "Unable to import main database."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --database=$DBNAME < sql-files/logs.sql || aborterror "Unable to import logs database."
;;
adduser)
echo "Adding user $NEWUSER as $DBUSER, with access to database $DBNAME..."
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true
mysql $DBUSER_ARG $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true

if [[ -n "$(uname -a | grep -i linux)" ]]; then
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="CREATE USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="GRANT SELECT,INSERT,UPDATE,DELETE ON $DBNAME.* TO '$NEWUSER'@'$DBHOST';" || true
mysql --defaults-file=/etc/mysql/debian.cnf $DBPASS_ARG $DBHOST_ARG $SSL_ARG --execute="ALTER USER '$NEWUSER'@'$DBHOST' IDENTIFIED BY '$NEWPASS';" || true
fi
;;
build)
Expand Down

0 comments on commit 613ede9

Please sign in to comment.