Project

General

Profile

Download (838 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / app / lib / actions / foreman_pipeline / job / promote.rb @ be52ca64

1
module Actions
2
  module ForemanPipeline
3
    module Job
4
      class Promote < Actions::EntryAction
5
        middleware.use ::Actions::Middleware::KeepCurrentUser
6

    
7
        def plan(opts)
8
          plan_self(opts)
9
        end
10

    
11
        def run
12
          promote_env unless target_environment.nil?
13
        end
14

    
15
        private
16

    
17
        def promote_env
18
          ForemanTasks.trigger(::Actions::Katello::ContentView::Promote, job.target_cv_version, target_environment, false)
19
          output[:cv_to_promote] = job.content_view.name
20
          output[:target_environment] = target_environment.name
21
          output[:in_job] = job.name
22
        end
23

    
24
        def target_environment
25
          job.environment.successor
26
        end
27

    
28
        def job
29
          j = ::ForemanPipeline::Job.find input.fetch(:job_id)
30
        end
31
      end
32
    end
33
  end
34
end