command || exit 1
「command
失敗した場合、 exit 1
(つまり失敗した場合)
コマンドが成功した場合にビルドを失敗させたいと言ったので、次のものが必要です。
command && exit 1 || exit 0
上記で、command
成功した場合はビルドが失敗としてマークされ、そうcommand
でない場合(成功しなかった場合)はビルドが成功としてマークされます
ジョブのコンソール出力は次のとおりです。
Started by upstream project "Cucumber - Devel Parent Build" build number 58
originally caused by:
Started by timer
Xvfb starting$ /usr/bin/Xvfb :75 -screen 0 1024x768x24 -fbdir /var/lib/jenkins/2013-01-25_22-24-203386303931627225842xvfb
Building remotely on dev548 in workspace /var/lib/jenkins/workspace/Cucumber - Known Issues Build
Checkout:Cucumber - Known Issues Build / /var/lib/jenkins/workspace/Cucumber - Known Issues Build - hudson.remoting.Channel@322535f5:dev548
Using strategy: Default
Last Built Revision: Revision f48428cc3128a0d6369ea99bbdbdf419bc29b173 (Cucumber/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from git@testdrivesite.beanstalkapp.com:/cucumber.git
Commencing build of Revision dad2f8792ec364e79dd76840f787d5e72676b03f (Cucumber/master)
Checking out Revision dad2f8792ec364e79dd76840f787d5e72676b03f (Cucumber/master)
Deleting old artifacts from #137
[Cucumber - Known Issues Build] $ /bin/bash /tmp/hudson3196742906607332265.sh
Using the wip profile...
Xvfb stopping
Archiving artifacts
[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] detected this build is running on a slave
[CucumberReportPublisher] copying json from: file:/var/lib/jenkins/workspace/Cucumber%20-%20Known%20Issues%20Build/to reports directory: file:/var/lib/jenkins/jobs/Cucumber%20-%20Known%20Issues%20Build/builds/2013-01-25_22-24-20/cucumber-html-reports/
[CucumberReportPublisher] Generating HTML reports
Build step 'Publish cucumber results as a report' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE
これは私の構成のビルドステップです:
#!/bin/bash
source /usr/local/rvm/environments/default
/usr/local/rvm/gems/ruby-1.9.2-p320/bin/cucumber --profile wip --format json -o cucumber.json /var/lib/jenkins/workspace/Cucumber\ -\ Known\ Issues\ Build/ SITE=devel && exit 1 || exit 0