director/lib/director/jobs/update_release.rb
def process_release
        @release_model = Models::Release.find_or_create(:name => @name)
        if @rebase
          @version = next_release_version
        end

        version_attrs = {
          :release => @release_model,
          :version => @version
        }
        version_attrs[:uncommitted_changes] = @uncommitted_changes if @uncommitted_changes
        version_attrs[:commit_hash] = @commit_hash if @commit_hash

        @release_version_model = Models::ReleaseVersion.new(version_attrs)
        unless @release_version_model.valid?
          raise ReleaseAlreadyExists,
                "Release `#{@name}/#{@version}' already exists"
        end

        @release_version_model.save

        single_step_stage("Resolving package dependencies") do
          resolve_package_dependencies(@manifest["packages"])
        end

        @packages = {}
        process_packages
        process_jobs

        unless @package_rebase_mapping.empty?
          event_log.begin_stage(
            "Rebased packages", @package_rebase_mapping.size)
          @package_rebase_mapping.each_pair do |name, transition|
            event_log.track("#{name}: #{transition}") {}
          end
        end

        unless @job_rebase_mapping.empty?
          event_log.begin_stage(
            "Rebased jobs", @job_rebase_mapping.size)
          @job_rebase_mapping.each_pair do |name, transition|
            event_log.track("#{name}: #{transition}") {}
          end
        end

        event_log.begin_stage("Release has been created", 1)
        event_log.track("#{@name}/#{@version}") {}
      end
# Processes uploaded release, creates jobs and packages in DB if needed
# @return [void]
Processes uploaded release, creates jobs and packages in DB if needed
Processes uploaded release creates jobs and packages in DB if needed
def process_release
        @release_model = Models::Release.find_or_create(:name => @name)
        if @rebase
          @version = next_release_version
        end
        version_attrs = {
          :release => @release_model,
          :version => @version
        }
        version_attrs[:uncommitted_changes] = @uncommitted_changes if @uncommitted_changes
        version_attrs[:commit_hash] = @commit_hash if @commit_hash
        @release_version_model = Models::ReleaseVersion.new(version_attrs)
        unless @release_version_model.valid?
          raise ReleaseAlreadyExists,
                "Release `#{@name}/#{@version}' already exists"
        end
        @release_version_model.save
        single_step_stage("Resolving package dependencies") do
          resolve_package_dependencies(@manifest["packages"])
        end
        @packages = {}
        process_packages
        process_jobs
        unless @package_rebase_mapping.empty?
          event_log.begin_stage(
            "Rebased packages", @package_rebase_mapping.size)
          @package_rebase_mapping.each_pair do |name, transition|
            event_log.track("#{name}: #{transition}") {}
          end
        end
        unless @job_rebase_mapping.empty?
          event_log.begin_stage(
            "Rebased jobs", @job_rebase_mapping.size)
          @job_rebase_mapping.each_pair do |name, transition|
            event_log.track("#{name}: #{transition}") {}
          end
        end
        event_log.begin_stage("Release has been created", 1)
        event_log.track("#{@name}/#{@version}") {}
      end
def process_release @release_model = Models :: Release . find_or_create ( :name => @name ) if @rebase @version = next_release_version end version_attrs = { :release => @release_model , :version => @version } version_attrs [ :uncommitted_changes ] = @uncommitted_changes if @uncommitted_changes version_attrs [ :commit_hash ] = @commit_hash if @commit_hash @release_version_model = Models :: ReleaseVersion . new ( version_attrs ) unless @release_version_model . valid? raise ReleaseAlreadyExists , "Release `#{@name}/#{@version}' already exists" end @release_version_model . save single_step_stage ( "Resolving package dependencies" ) do resolve_package_dependencies ( @manifest [ "packages" ] ) end @packages = { } process_packages process_jobs unless @package_rebase_mapping . empty? event_log . begin_stage ( "Rebased packages" , @package_rebase_mapping . size ) @package_rebase_mapping . each_pair do | name , transition | event_log . track ( "#{name}: #{transition}" ) { } end end unless @job_rebase_mapping . empty? event_log . begin_stage ( "Rebased jobs" , @job_rebase_mapping . size ) @job_rebase_mapping . each_pair do | name , transition | event_log . track ( "#{name}: #{transition}" ) { } end end event_log . begin_stage ( "Release has been created" , 1 ) event_log . track ( "#{@name}/#{@version}" ) { } end
Processes uploaded release, creates jobs and packages in DB if needed
Processes uploaded release creates jobs and packages in DB if needed
None
void