2

使用 Jenkins 构建时出现以下错误:

Building in workspace /var/lib/jenkins/jobs/test-1b8ac945ebc2383345391847605819c5/workspace
[workspace] $ /bin/sh -xe /tmp/hudson5014904737097448499.sh
+ [ ! -d ./.git ]
+ git fetch -q origin
+ git reset -q --hard a3ff7b59246560719bc3a8f2e89f0b5720fa32c3
+ [ -f script/cibuild ]
+ script/cibuild
/tmp/hudson5014904737097448499.sh: 9: /tmp/hudson5014904737097448499.sh: script/cibuild: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE

配置脚本是 janky 默认值:

if [ ! -d "./.git" ]; then
  git init
  git remote add origin git@github.com:repo/my_repo
fi
git fetch -q origin
git reset -q --hard $JANKY_SHA1
if [ -f script/cibuild ]; then
  script/cibuild
else
  bundle install --path vendor/gems --binstubs
  bundle exec rake
fi

我已经创建了自己的脚本/cibuild,但是从错误来看,它看起来没有正确的权限。如何从 Jenkins 自动正确设置权限?文件本身存储在 repo 中,所以我不想每次都登录 Jenkins 并设置权限。

感谢所有帮助。

4

1 回答 1

1

为了解决,我添加chmod 700 script/cibuild了脚本/cibuild 是否存在。要使此更改在 Janky 中是全局的,您需要编辑 Janky 文件夹中的 config/default.xml.erb

if [ ! -d "./.git" ]; then
  git init
  git remote add origin git@github.com:repo/my_repo
fi
git fetch -q origin
git reset -q --hard $JANKY_SHA1
if [ -f script/cibuild ]; then
  chmod 700 script/cibuild
  script/cibuild
else
  bundle install --path vendor/gems --binstubs
  bundle exec rake
fi
于 2013-03-03T22:09:18.753 回答