2017-11-09 11 views
1

パラメータをAWS RDS DBインスタンス名のリストに設定するために、Jenkinsの "Extensible Choice"プラグインを使用しています。Jenkinsパラメータに選択リストを入力しようとしましたが、パラメータは空のままですが、その理由は何ですか?

"Choiceプロバイダ"では "System groovy choice parameter"を選択しました。

これは、DBのリストを返すことになっているGroovyのコードです:

//Create buffer to capture command's Standard Out 
def sout = new StringBuffer(), serr = new StringBuffer() 

//Define here the shell command you would like to execute 
def proc = 'aws rds describe-db-instances | grep DBInstanceIdentifier | grep -v Read | awk "{print \$2}" | sed "s/\"//g"'.execute() 

//Capture command output into buffer 
proc.consumeProcessOutput(sout, serr) 

//Time to wait for command to complete 
proc.waitForOrKill(1000) 

//Converts command output to a list of choices, split by whitespace 
return sout.tokenize() 

私はシェルでコマンドを実行すると、私は正しく出力を得る:

[[email protected] ~]$ aws rds describe-db-instances | grep DBInstanceIdentifier | grep -v Read | awk "{print \$2}" | sed "s/\"//g" 
company 
company-dev-70-mysql 
dev-rds-2017-10-02 
company-check-woocommerce 
prod 

しかしとき私は仕事を実行し、ドロップダウンメニューは空のままです。

私が間違っていることを知っていますか?

+0

はたぶん、あなたはそれを殺しましたか? --waitForOrKill(1000) – basiljames

+0

私はすでにそれを "20000"に変更しましたが、メニューは空です。 –

答えて

0

StringBuilderバッファではありません。それが完了する前に

はデフSOUT =新しいStringBufferを()、SERR =新しいStringBuilderの()

+0

ありがとう、私はそれを修正しましたが、それでもメニューには何も入力されません...他のアイデア? –

+0

jenkinsユーザーがコマンドを実行できるかどうかを確認します。 –

+0

はい、jenkinsユーザーは質問に示すように適切な出力を得ます。 –

関連する問題