2017-04-11 49 views

回答

1

你必須使用更多的步驟。無需開始部署,切換到迭代,啓動。

cf push APPLICATION_NAME --no-start 
cf disable-diego APPLICATION_NAME 
cf start APPLICATION_NAME 

參考Deploying Apps

0

我建一個bash exec來做到這一點,這將使用現有的manifest.yml文件和包裝這一切到一個單一的請求。在bash EXEC的內容如下:

#!/bin/bash 

filename="manifest.yml" 
if [ -e $filename ]; 
then 
    echo "using manifest.yml file in this directory" 
else 
    echo "no manifest.yml file found. exiting" 
    exit -2 
fi 
shopt -s nocasematch 
string='name:' 
targetName="" 
echo "Retrieving name from manifest file" 
while read -r line 
do 
    name="$line" 
    variable=${name%%:*} 
    if [[ $variable == *"name"* ]] 
    then 
     inBound=${name#*:} 
     targetName="$(echo -e "${inBound}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" 
    fi 
done < "$filename" 
if [ "$targetName" == "" ]; 
then 
    echo "Could not find name of application in manifest.yml file. Cancelling build." 
    echo "application name is identified by the 'name: ' term in the manifest.yml file" 
    exit -1 
else 
    echo "starting cf push for $targetName" 

    cf push --no-start 

    echo "cf enable-diego $targetName" 
    cf enable-diego $targetName 

    echo "cf start $targetName" 
    cf start $targetName 

    exit 0 
fi 

只是把這個代碼到編輯器作爲一個新的文件,然後使文件的可執行文件。我在每個根目錄的倉庫中都保留了這個exec的副本。做一個複製粘貼並執行此exec後,您可能會收到以下錯誤:

/bin/bash^M: bad interpreter: No such file or directory 

如果你做什麼,只要運行DOS2UNIX的命令,它會「修復了」行結束,以配合您的操作系統。