Git Gitlab-ci 执行 build 脚本的权限问题

goinaction · 2013年04月03日 · 最后由 goinaction 回复于 2013年04月08日 · 8363 次阅读

在两台不同的服务器上安装了 Gitlab 和 Gitlab-ci,其他都配置好了,Gitlab-ci 也能 fetch 项目到本地,但是执行 build 脚本的时候提示权限不够,需要输入密码。

按照官方文档又做了几遍,还是不行,不知道是啥地方遗漏了,特来求助。

build 脚本是:

bundle install bundle exec rake spec

在执行的时候提示:

bundle install Fetching source index from http://ruby.taobao.org/ sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: 3 incorrect password attempts

我登录到服务器的项目目录下执行

sudo -u gitlab_ci -H bundle install #也会提示输入密码 sudo -u gitlab_ci -H rvm current #提示没有这个命令

以 gitlab_ci 用户登录执行,像下面这样,gem 安装成功

sudo su gitlab_ci rvm current #=> 显示 ruby_1.9.3 bundle install

ruby 环境是通过 rvm 安装的,在 gitlab_ci 的.bashrc 里面也加入了source /home/gitlab_ci/.rvm/scripts/rvm

感觉还是环境配置问题,但是没找到问题所在,希望大家提供点思路。

@SaitoWu 不忙的话,帮忙看看😄

sudo 没有使用你的 bashrc 文件。

rvm 全局安装或者 rvmsudo 试试。

#1 楼 @Saito 果然 使用\curl -L https://get.rvm.io | sudo bash -s stable全局安装 把 gitlab_ci 加到 rvm 组 使用 rvmsudo rvm install 1.9.3 解决问题,谢谢😄

需要 登录 后方可回复, 如果你还没有账号请 注册新账号