- step: &restoreDefaultDatabase
name: 'Deploy to Environment'
script:
- pipe: atlassian/ssh-run:0.8.0
variables:
SSH_USER: $REMOTE_SERVER_USER
SERVER: $REMOTE_SERVER_HOST
MODE: 'command'
COMMAND: |
export MYSQL_PWD="$DB_PASSWD" &&
echo "DROP DATABASE" &&
mysql -u$DB_USER -e "DROP DATABASE IF EXISTS $DB_NAME;" &&
echo "CREATE DATABASE" &&
mysql -u$DB_USER -e "CREATE DATABASE IF NOT EXISTS $DB_NAME DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" &&
echo "IMPORT DATABASE" &&
mysql -u$DB_USER -e "SET foreign_key_checks = 0;" &&
mysql --force -u$DB_USER $DB_NAME < /home/qwe/backup/qwe_database.sql > /home/qwe/staging3/backup_import.log 2>&1 || true &&
mysql -u$DB_USER -e "SET foreign_key_checks = 1;" &&
cat /home/qwe/staging3/backup_import.log
artifacts:
- /home/qwe/staging3/backup_import.log
This is my script I do a database import into mysql. It takes about 10-15 minutes. I can see that the import is done from phpMyAdmin But this step keeps running without stopping.
keep runing on this line
mysql --force -u$DB_USER $DB_NAME < /home/qwe/backup/grayfish_database.sql > /home/qwe/staging3/backup_import.log 2>&1 || true &&
Hi @yadamenko and welcome to the community!
The mysql command that is stuck may not be returning an exit code. I see that you are redirecting output to a log file on that server; you can check that file for indications on what the command is doing.
I also suggest checking if this works outside of Pipelines, to narrow down whether this is a Pipelines specific issue or not. If you have SSH access to this server from your computer, you can connect to that server via SSH and execute the whole command you are running from Pipelines.
Another thing to check would be from Pipelines, but without the pipe. You can install an SSH client during that step (if one is not already present in that step's Docker image) and then use an SSH command to connect to your server and run the command you are running with the pipe.
Kind regards,
Theodora
Hi @Theodora Boudale, thanks for the answer.
I have already solved this problem with an SSH connection. Where everything works as I expect it to.
In the pip documentation, it was just written that if you have any problems you can post here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thank you for your reply, it's good to hear that you have already solved this.
Can you please confirm, does your solution concern running this command with an SSH command without the pipe? Does the issue occur with the pipe only and not occur when you use an SSH command to connect to your server?
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.