2016-10-27 6 views
0

私はJenskins 1.6をOpenshiftで実行しています。私はGitのリポジトリからのビルド簡単なジェンキンスパイプラインを構築しようとしている:基本的なJenkinsパイプラインが失敗します

node { 
    git url: 'https://github.com/fmarchioni/kitchensink-example.git' 
    def mvnHome = tool 'M3' 
    sh "${mvnHome}/bin/mvn clean install" 
} 

私はパイプラインを構築しようとするかは不明メッセージで失敗します。

[Pipeline] node 
Running on master in /var/lib/jenkins/jobs/pipeline/workspace 
[Pipeline] { 
[Pipeline] git 
> git rev-parse --is-inside-work-tree # timeout=10 
Fetching changes from the remote Git repository 
> git config remote.origin.url https://github.com/fmarchioni/kitchensink-example.git # timeout=10 
Fetching upstream changes from https://github.com/fmarchioni/kitchensink-example.git 
> git --version # timeout=10 
> git -c core.askpass=true fetch --tags --progress https://github.com/fmarchioni/kitchensink-example.git +refs/heads/*:refs/remotes/origin/* 
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10 
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 
Checking out Revision 90df980f2c86f9a59d872bc8650ecfd0800c51bd (refs/remotes/origin/master) 
> git config core.sparsecheckout # timeout=10 
> git checkout -f 90df980f2c86f9a59d872bc8650ecfd0800c51bd # timeout=10 
> git branch -a -v --no-abbrev # timeout=10 
> git branch -D master # timeout=10 
> git checkout -b master 90df980f2c86f9a59d872bc8650ecfd0800c51bd 
First time build. Skipping changelog. 
[Pipeline] tool 
[Pipeline] sh 
[workspace] Running shell script 
+ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/M3/bin/mvn clean install 
[Pipeline] } 
[Pipeline] // node 
[Pipeline] End of Pipeline 
ERROR: script returned exit code -1 
Finished: FAILURE 

はあなたがいずれかを持っていますか何が間違っているのだろうか? ありがとう

答えて

1

特定のシェルスクリプトmvn clean installが間違っていると思われます。可能であれば、SSHingをカートリッジに入れてMavinコマンドを直接実行してみてください。あなたはデバッグオプション(https://books.sonatype.com/mvnref-book/reference/running-sect-options.htmlから)を追加することができ、うまくいけばもっと役に立つ出力を見ることができます!

0

コマンドを囲むには、withMavenステップを使用してみてください。これにより、MavenツールのバージョンとJDK、および追加の設定オプションの指定が可能になります。

withMaven(jdk: '<JDK name>', maven: '<maven name>') { 
    sh 'mvn clean install' 
    } 

またbuild.log構成を文書化します:

[Pipeline] withMaven 
[withMaven] Options: [] 
[withMaven] Available options: 
[withMaven] use JDK installation <JDK name> 
[withMaven] use Maven installation '<maven name>' 
[Pipeline] sh 
[workspace] Running shell script 

あなたはパイプライン構文のリンクを使用して見てみたいことがあります。個々のステップに使用できるスニペットを生成できます。これは、withMavenのステップで使用可能なオプションを表示します。

enter image description here

関連する問題