1
|
module Actions
|
2
|
module ForemanPipeline
|
3
|
module Jenkins
|
4
|
class BuildProject < AbstractJenkinsAction
|
5
|
|
6
|
def plan(options)
|
7
|
sequence do
|
8
|
build_task = plan_action(Build, options)
|
9
|
wait_task = plan_action(WaitForBuild, :job_id => options[:job_id],
|
10
|
:name => options[:project_name],
|
11
|
:build_num => build_task.output[:build_num])
|
12
|
|
13
|
plan_self(:build_status => wait_task.output[:details][:result], :name => options[:project_name])
|
14
|
end
|
15
|
end
|
16
|
|
17
|
def run
|
18
|
output[:status] = input[:build_status]
|
19
|
Dynflow::Action::Rescue::Skip if input[:build_status].match /^FAILURE$/
|
20
|
end
|
21
|
|
22
|
def rescue_strategy_for_self
|
23
|
Dynflow::Action::Rescue::Skip
|
24
|
end
|
25
|
|
26
|
def humanized_name
|
27
|
"Build Jenkins Project: %s" % input[:name]
|
28
|
end
|
29
|
end
|
30
|
end
|
31
|
end
|
32
|
end
|