Skip to content

Commit

Permalink
Update config-compat.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
b23prodtm committed Sep 8, 2019
1 parent 9e52174 commit 19ff595
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
10 changes: 4 additions & 6 deletions .circleci/config-compat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ jobs:
command: |
echo $(cat amd64.env | awk '{printf "export %s\n", $1}') >> $BASH_ENV
echo $(cat common.env | awk '{printf "export %s\n", $1}') >> $BASH_ENV
echo "export MYSQL_SERVICE_HOST=127.0.0.1" >> $BASH_ENV
echo "export TEST_MYSQL_SERVICE_HOST=127.0.0.1" >> $BASH_ENV
- run:
name: Waiting for Mysql to be ready
command: |
Expand Down Expand Up @@ -113,7 +111,8 @@ workflows:
build-and-compose:
jobs:
- build
- compose
- compose:
context: Info-b23prodtm
version: 2

# Original config.yml file:
Expand Down Expand Up @@ -170,8 +169,6 @@ workflows:
# command: |
# echo $(cat amd64.env | awk '{printf \"export %s\\n\", $1}') >> $BASH_ENV
# echo $(cat common.env | awk '{printf \"export %s\\n\", $1}') >> $BASH_ENV
# echo \"export MYSQL_SERVICE_HOST=127.0.0.1\" >> $BASH_ENV
# echo \"export TEST_MYSQL_SERVICE_HOST=127.0.0.1\" >> $BASH_ENV
# - run:
# name: Waiting for Mysql to be ready
# command: |
Expand Down Expand Up @@ -262,4 +259,5 @@ workflows:
# - build:
# custom_checkout: \"/tmp/_circleci_local_build_repo\"
# - compose:
# custom_checkout: \"/tmp/_circleci_local_build_repo\"
# custom_checkout: \"/tmp/_circleci_local_build_repo\"
# context: Info-b23prodtm
2 changes: 1 addition & 1 deletion configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ esac; shift; done
echo -e "${green}Fixing some file permissions...${nc}"
[ $openshift 2> /dev/null ] && echo "None." || source ./Scripts/configure_tmp.sh
#; update plugins and dependencies
bash -c "./Scripts/composer.sh require --no-dev --no-interaction"
bash -c "./Scripts/composer.sh require --update-no-dev --no-interaction"
20 changes: 10 additions & 10 deletions migrate-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ else
logger -st $0 "Locally Testing values, bootargs...: ${pargs}"
source ./Scripts/fooargs.sh $*
fi
function sql_connect() {
sql_connect() {
prefix=""
[ "$#" -gt 0 ] && prefix=$1 && shift
bash -c "${prefix} mysql $*"
${prefix} "mysql $*"
}
function sql_connect_host() {
sql_connect_host() {
sql_connect $* -h ${MYSQL_SERVICE_HOST} -P ${MYSQL_SERVICE_PORT}
}
function sql_connect_test_host() {
sql_connect_localhost $* -h ${TEST_MYSQL_SERVICE_HOST} -P ${TEST_MYSQL_SERVICE_PORT}
sql_connect_test_host() {
sql_connect $* -h ${TEST_MYSQL_SERVICE_HOST} -P ${TEST_MYSQL_SERVICE_PORT}
}

dbfile=database.cms.php
Expand All @@ -33,8 +33,8 @@ identities=app/Config/database.sql
new_pass=""
new_test_pass=""
saved=("$*")
mysql_connect_args=("" "")
test_mysql_connect_args=("" "")
mysql_connect_args=("eval" "")
test_mysql_connect_args=("eval" "")
mysql_host=${MYSQL_SERVICE_HOST}
test_mysql_host=${TEST_MYSQL_SERVICE_HOST}
while [[ "$#" > 0 ]]; do case $1 in
Expand Down Expand Up @@ -123,7 +123,7 @@ create database if not exists '${MYSQL_DATABASE}';\r
grant all on ${MYSQL_DATABASE}.* to '${DATABASE_USER}'@'${mysql_host}';\r
" > $identities
logger -st $0 "Fork script to keep hidden table user secrets"
bash -c "echo \"source ${identities}\" | sql_connect_host ${mysql_connect_args[@]} -u ${MYSQL_USER} --password=${MYSQL_PASSWORD}"
$(echo "source ${identities}" | sql_connect_host "${mysql_connect_args[@]}" -u ${MYSQL_USER} --password=${MYSQL_PASSWORD})
export MYSQL_ROOT_PASSWORD=$set_DATABASE_PASSWORD
logger -st $0 "\r${red}WARNING: You will modify SQL ${MYSQL_USER} password !${nc}"
parse_sql_password "$new_test_pass" "set_TEST_DATABASE_PASSWORD" "new ${MYSQL_USER}"
Expand All @@ -138,7 +138,7 @@ grant all on ${TEST_DATABASE_NAME}2.* to '${MYSQL_USER}'@'${test_mysql_host}';\r
grant all on ${TEST_DATABASE_NAME}3.* to '${MYSQL_USER}'@'${test_mysql_host}';\r
" > $identities
logger -st $0 "Fork script to keep hidden table user secrets"
bash -c "echo \"source ${identities}\" | sql_connect_host ${mysql_connect_args[@]} -u ${MYSQL_USER} --password=${MYSQL_PASSWORD}"
$(echo "source ${identities}" | sql_connect_host "${mysql_connect_args[@]}" -u ${MYSQL_USER} --password=${MYSQL_PASSWORD})
export MYSQL_PASSWORD=$set_TEST_DATABASE_PASSWORD
rm $identities
fi
Expand Down Expand Up @@ -166,7 +166,7 @@ if [[ $test_checked -eq 1 ]]; then
[ ! -z $MYSQL_USER ] && [ ! -z $MYSQL_PASSWORD ] && [[ (! -z $TEST_MYSQL_SERVICE_HOST) ]] || echo "Missing VARIABLES. Please review your settings !"
logger -st $0 "Database Unit Tests... DB=${DB}"
if [[ ${DB} == 'Mysql' ]]; then
sql_connect_test_host ${test_mysql_connect_args[@]} -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} -v \
sql_connect_test_host "${test_mysql_connect_args[@]}" -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} -v \
-e "CREATE DATABASE IF NOT EXISTS ${TEST_DATABASE_NAME};" \
-e "CREATE DATABASE IF NOT EXISTS ${TEST_DATABASE_NAME}2;" \
-e "CREATE DATABASE IF NOT EXISTS ${TEST_DATABASE_NAME}3;"
Expand Down

0 comments on commit 19ff595

Please sign in to comment.