2016-04-29 68 views
1

我有一個問題,EXCUTE的MakefileCapistrano的EXCUTE的Makefile失敗

deploy.rb:

namespace :deploy do 
    after :deploy, :build_app do 
    on roles(:app), in: :groups do 
     execute "make production" 
    end 
    end 
end 

的Makefile:

production: 
    echo "make file production" 
staging: 
    echo "make file staging" 
all: 
    echo "make file all" 

錯誤時運行 「帽生產部署」

DEBUG [1f0a117d] Command: make production 
DEBUG [1f0a117d] make: *** No rule to make target `production'. Stop. 
(Backtrace restricted to imported tasks) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing as make production exit status: 2 
make production stdout: make: *** No rule to make target `production'. Stop. 
make production stderr: Nothing written 

調試運行直接在服務器上「ma柯生產的」 =>回聲 「使文件製作」

如果只有EXCUTE 「讓」 它會運行到第一個標籤

--- Makefile中除了

production: 
    npm install 
    npm run deploy-production 
    sudo docker rmi dashboard:latest; sudo echo 0 
    sudo docker build -t dashboard:$(VERSION) . 
    sudo docker tag -f dashboard:$(VERSION) dashboard:latest 

staging: 
    npm install 
    npm run deploy-staging 
    sudo docker rmi dashboard:latest; sudo echo 0 
    sudo docker build -t dashboard:$(VERSION) . 
    sudo docker tag -f dashboard:$(VERSION) dashboard:latest 
+0

是否有你通過make運行而不是簡單的'cap production deploy'的原因? – microspino

+0

是的。我需要運行它來構建一些代碼(npm,docker image,...)。爲了方便閱讀,我刪除了所有與bug無關的代碼 –

+0

您可以發佈Makefile源代碼嗎? (忽略這只是看到你做到了) – microspino

回答

1

權make env的語法:

namespace :deploy do 
    after :deploy, :build_app do 
    on roles(:app), in: :groups do 
     execute 'make','production' 
    end 
    end 
end