我有一个运行Capistrano部署的Jenkins构建作为后构建操作.
从控制台运行Capkinsrano任务作为Jenkins用户工作非常正常,没有密码提示(我之前在构建和登台服务器上都设置了SSH密钥).但是,当通过Jenkins运行相同的脚本时,我突然收到密码提示,然后构建失败(没有TTY存在).
[workspace] $ /bin/sh -xe /tmp/hudson7321493219694918714.sh
Performing Post build task...
Match found for : : True
Logical operation result is TRUE
Running script : cap _2.13.4_ deploy
[workspace] $ /bin/sh -xe /tmp/hudson1545664641721322948.sh
+ cap _2.13.4_ deploy
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
triggering before callbacks for `deploy:update_code'
[32m--> Updating code base with checkout strategy[0m
executing locally: "git ls-remote git@my.staging-server.com:my_project.git master"
command finished in 1200ms
* executing "git clone -q git@my.staging-server.com:my_project.git /var/www/staging/my_project/releases/20121029223619 && cd …Run Code Online (Sandbox Code Playgroud) 场景:
我正在使用一个包(FOSFacebookBundle),它允许我在我的配置中为一个facebook应用设置参数.一切都很好,但现在我不仅需要设置一个应用程序,还需要设置多个应用程序.
我的方法:
我创建了一个AcmeFacebookBundle,它允许在一个数组中定义多个应用程序(在Acme\FacebookBundle\DependencyInjection\Configuration中定义配置),如下所示:
acme_facebook:
apps:
some_competition:
server_url: %acme.facebook.some_competition.server_url%
file: %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
alias: facebook
app_id: %acme.facebook.some_competition.app_id%
secret: % acme .facebook.some_competition.secret%
cookie: true
permissions: [email, user_birthday, user_location]
some_other_competition:
server_url: %acme.facebook. some_other_competition.server_url%
file: %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php
alias: facebook
app_id: %acme.facebook. some_other_competition.app_id%
secret: % acme .facebook. some_other_competition.secret%
cookie: true
permissions: [email, user_birthday, user_location]
Run Code Online (Sandbox Code Playgroud)
在Acme\FacebookBundle\DependencyInjection\AcmeFacebookExtension中,我然后循环遍历所有应用程序.我们的想法是将server_url参数与当前URL进行比较,并使用我的覆盖fos_facebook配置.
class AcmeFacebookExtension extends Extension
{
...
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
foreach …Run Code Online (Sandbox Code Playgroud)