Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New setup project cannot deploy, "Failed with status 1 (1)" #328

Closed
cofyc opened this issue Jul 8, 2015 · 3 comments
Closed

New setup project cannot deploy, "Failed with status 1 (1)" #328

cofyc opened this issue Jul 8, 2015 · 3 comments

Comments

@cofyc
Copy link

cofyc commented Jul 8, 2015

I run mina -S deploy get deploy script, It contains:

#!/usr/bin/env bash

# Bail out ASAP
set -e

....

# Determine $previous_path and other variables
[ -h "current" ] && [ -d "current" ] && previous_path=$(cd "current" >/dev/null && pwd -LP)
build_path="./tmp/build-`date +%s`$RANDOM"
version=$((`cat "/var/www/project/last_version" 2>/dev/null`+1))
release_path="releases/$version"
...

When getting last version with cat, it failed and exit because of last_version file is missing.

mina setup should create last_version file with 0, or deploy script check file exist or not.

At last, I create this file myself to work around this issue.

@flowerett
Copy link
Contributor

That's strange, as 2>/dev/null does exactly what you need - checks if last_version exists.

$ cat last_version
cat: last_version: No such file or directory
$ cat last_version 2>/dev/null
$ version=$((`cat "last_version" 2>/dev/null`+1))

$ echo $version
1

Could you attach the full error log? (mina deploy -v)

@cofyc
Copy link
Author

cofyc commented Jul 8, 2015

@flowerett

Hi, because the generated bash script has set -e declaration. The script exits immediately if a command exits with a non-zero status.

version=$((`cat "last_version" 2>/dev/null`+1))

This can get version 1, but the whole script exits here.

You can test it with this demo script:

#!/bin/bash

set -e

cat does_not_exist_file 2>/dev/null

echo "ok"

Here is full log of mina deploy -v.

$ mina deploy -v

 !     Command failed.
       Failed with status 1 (1)

@d4be4st
Copy link
Member

d4be4st commented Jul 8, 2015

Hm... thx for cacthcing this. Obviously we will have to remove that set -e :(

@d4be4st d4be4st closed this as completed in 7ab6a58 Jul 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants