【问题标题】:script/cibuild: Permission denied when building with Jenkins脚本/cibuild:使用 Jenkins 构建时权限被拒绝
【发布时间】:2013-03-04 06:09:18
【问题描述】:

使用 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 并设置权限。

感谢所有帮助。

【问题讨论】:

    标签: git github jenkins


    【解决方案1】:

    为了解决,如果脚本/cibuild 存在,我添加了chmod 700 script/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
    

    【讨论】:

      猜你喜欢
      • 2016-05-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 2014-06-18
      • 2015-11-15
      • 1970-01-01
      相关资源
      最近更新 更多