app/controllers/mass_rollouts_controller.rb
def merge_stage(stage)
    template_stage = stage.template_stage

    return "has no template stage to merge into" unless template_stage
    return "is a template stage" if stage.is_template
    return "has no deploy groups" if stage.deploy_groups.count == 0
    return "has more than one deploy group" if stage.deploy_groups.count > 1
    return "commands in template stage differ" if stage.script != template_stage.script

    unless template_stage.deploy_groups.include?(stage.deploy_groups.first)
      template_stage.deploy_groups += stage.deploy_groups
      template_stage.save!
    end

    stage.project.stages.reload # need to reload to make verify_not_part_of_pipeline have current data and not fail
    stage.soft_delete!(validate: false)

    nil
  end
# returns nil on success, otherwise the reason this stage was skipped.
returns nil on success, otherwise the reason this stage was skipped.
returns nil on success otherwise the reason this stage was skipped .
def merge_stage(stage)
    template_stage = stage.template_stage
    return "has no template stage to merge into" unless template_stage
    return "is a template stage" if stage.is_template
    return "has no deploy groups" if stage.deploy_groups.count == 0
    return "has more than one deploy group" if stage.deploy_groups.count > 1
    return "commands in template stage differ" if stage.script != template_stage.script
    unless template_stage.deploy_groups.include?(stage.deploy_groups.first)
      template_stage.deploy_groups += stage.deploy_groups
      template_stage.save!
    end
    stage.project.stages.reload 
    stage.soft_delete!(validate: false)
    nil
  end
def merge_stage ( stage ) template_stage = stage . template_stage return "has no template stage to merge into" unless template_stage return "is a template stage" if stage . is_template return "has no deploy groups" if stage . deploy_groups . count == 0 return "has more than one deploy group" if stage . deploy_groups . count > 1 return "commands in template stage differ" if stage . script != template_stage . script unless template_stage . deploy_groups . include? ( stage . deploy_groups . first ) template_stage . deploy_groups += stage . deploy_groups template_stage . save! end stage . project . stages . reload stage . soft_delete! ( validate : false ) nil end
returns nil on success, otherwise the reason this stage was skipped.
returns nil on success otherwise the reason this stage was skipped .
# need to reload to make verify_not_part_of_pipeline have current data and not fail
stage