Wercker部署到云服务器 - 部署脚本上的权限被拒绝

时间:2015-02-16 22:01:30

标签: maven continuous-integration continuous-deployment wercker

我是一个wercker noob。我试图通过scp将我的maven构建的结果部署到服务器。我有一个简单的脚本来实现这一点,但是构建过程没有执行它的权限。

部署输出

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/wercker/script/0.0.0"
$ export WERCKER_STEP_ID="2bffb2c2-6e60-4197-89b8-46c0ed566cdc"
$ export WERCKER_STEP_NAME="script"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ ./myapp-deploy/src/scripts/deploy_ocean.sh
-bash: ./myapp-deploy/src/scripts/deploy_ocean.sh: Permission denied

部署脚本

$ ls -lrt (git bash on windows laptop)
total 1
-rwxr-xr-x    1 hugo  Administ      593 Feb 16 23:31 deploy_ocean.sh

bash脚本

#!/bin/bash
set -x

TARGET_DIR="/tmp/deploy"
TARGET_DEPLOY="x.x.x.x"
SCP=/usr/bin/scp
#WAR_FILE="../../../myapp-war/target/myapp.war"

##variables for testing
WAR_FILE="../../../myapp-war/test.txt"
########

deploy()
{
echo echoing deploying $WAR_FILE
logger deploying $WAR_FILE
$SCP -i $WERCKER_PRIVATE $WAR_FILE root@$TARGET_DEPLOY:TARGET_DIR
logger deploy over
logger echoing deploy over
}

##echo variables
#echo_variables
##deploy the app
echo attempting deploy
logger attempting deploy
deploy

1 个答案:

答案 0 :(得分:0)