2016-09-10 6 views
1

私はジェンキンスさんパイプラインthrouth私の仕事を構築し、このように私のコードを作成するスニペットジェネレータをuseing:前述したようにjenkinsのパイプラインのステップからユーザーの入力を取得する構文は何ですか?

node { 
    stage 'input' 
     input id: 'Tt', message: 'your password:', ok: 'ok', parameters: [string(defaultValue: 'mb', description: 'vbn', name: 'PARAM'), string(defaultValue: 'hj', description: 'kkkk', name: 'PARAM2')] 

    // here I need get the text user input , like `PARAM` or `PARAM2` 
} 

を、GETパラメータの構文は何ですか?

答えて

2

私は一種のコードをテストするために制限されていますが、私は次のようにそれがあるべきだと思う:、上記のコードは非常に再びJoschiための十分.Thanksの作品Joschiを与える考えと

node { 
    stage 'input' 
    def userPasswordInput = input(
     id: 'userPasswordInput', message: 'your password', parameters: [ 
      [$class: 'TextParameterDefinition', defaultValue='mb', description: 'vbn', name: 'password'] 
     ] 
    ) 
    echo ("Password was: " + userPasswordInput) 
} 
+1

お返事ありがとうございます。私はあなたのコードをコピーすると、それはエラーで解析されます。しかし、それは私にアイデアを与え、私は以下のコードを使用し、それは動作します。ノード ' ステージ'入力 def userPasswordInput =入力( id: 'パスワード'、メッセージ: 'パスワードを入力:'、OK: 'ok'、パラメータ:[文字列(defaultValue: 'マスター'、説明: ') (パスワードは: "+ userPasswordInput) } – jims

1
node { 
    stage 'input' 
    def userPasswordInput = input(
     id: 'Password', message: 'input your password: ', ok: 'ok', parameters: [string(defaultValue: 'master', description: '.....', name: 'LIB_TEST')] 
    ) 
    echo ("Password was: " + userPasswordInput) 
} 

+0

こんにちは@Joschi、コードスニペットのおかげで、私は同様の要件を持っていた、それは私をたくさん助けた。ただ、変数に "userPasswordInput"を格納したいのか、それをファイルに書きたいのか、どのように達成できるのかを確認したいのです。私は "file <<"構文を使ってファイルに書き込もうとしましたが、それは私のためには機能しませんでした。あなたの助けを前もってありがとう! – Yash

関連する問題