Open PeterVenhuizen opened 1 year ago
Hi @PeterVenhuizen,
So as you know I've worked on this issue, for some reason exit codes get ignored when you write multiline commands.
# When writing it like this, it does gets executed but starts ignoring error codes, so the deploy will continue even if something fails
command %(
if [ -d #{fetch(:deploy_to)}/fake_current ]; then
echo "-----> Deleting dummy app structure"
rm -rf #{fetch(:deploy_to)}/fake_current
fi
if [ -f ~/.netrc ]; then
echo "-----> Cleaning up the auto deployment dependancies"
sed -i.bk '/machine nms-git/d' ~/.netrc
if [ -f ~/.netrc.bk ]; then
rm -fr ~/.netrc.bk
fi
fi
if [ -d #{fetch(:current_path)}/dockerfiles ]; then
echo "-----> Deleting the dockerfiles directory"
rm -fr #{fetch(:current_path)}/dockerfiles
fi
)
# This respects the error codes, 2 things ive noticed.
# 1 - make sure you end each line with a ;
# 2 - one if per command, nested seem te be ok :S
command %(
if [ -d #{fetch(:deploy_to)}/fake_current ]; then
echo "-----> Deleting dummy app structure";
rm -rf #{fetch(:deploy_to)}/fake_current;
fi
)
command %(
if [ -f ~/.netrc ]; then
echo "-----> Cleaning up the auto deployment dependancies";
sed -i.bk '/machine nms-git/d' ~/.netrc;
if [ -f ~/.netrc.bk ]; then
rm -fr ~/.netrc.bk;
fi
fi
)
command %(
if [ -d #{fetch(:current_path)}/dockerfiles ]; then
echo "-----> Deleting the dockerfiles directory";
rm -fr #{fetch(:current_path)}/dockerfiles;
fi
)
So I've mittegated this by putting 1 command in the command method. This seems to work. Why and How... no clueue
The
invoke :'rails:assets_precompile'
step in mydeploy
block fails. I know why it fails, because some of the config files are formatted incorrectly. This issue is that there is arake aborted!
message + theSyntaxError
, but instead of the GitLab CI deploy job stopping there, mina just moves on to the next task.The output below is the full output of the deploy job, with certain pieces of information
[REDACTED]
.How does
mina
listen for errors when running tasks and why wasn't the error picked up here?Hope someone can help out with this, since this forms quite a risk for the stability of our production environment.
Thanks!