app/models/commit_status.rb
def release_status
    return unless DeployGroup.enabled?
    return unless current_version = version(@reference)
    return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence

    # code above is hot ... so keep it optimized and re-fetch here only if something bad was found
    interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)
    interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)

    {
      state: "error", # `pending` is also supported in deploys.js, but that seems even worse
      statuses: [{
        state: "Old Release",
        description:
          "#{higher_references.join(', ')} was deployed to deploy groups in this stage" \
          " by #{interfering_stages.join(", ")}"
      }]
    }
  end
# checks if other stages that deploy to the same hosts as this stage have deployed a newer release
# @return [nil, Hash]
checks if other stages that deploy to the same hosts as this stage have deployed a newer release
checks if other stages that deploy to the same hosts as this stage have deployed a newer release
def release_status
    return unless DeployGroup.enabled?
    return unless current_version = version(@reference)
    return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence
    interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)
    interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)
    {
      state: "error", 
      statuses: [{
        state: "Old Release",
        description:
          "#{higher_references.join(', ')} was deployed to deploy groups in this stage" \
          " by #{interfering_stages.join(", ")}"
      }]
    }
  end
def release_status return unless DeployGroup . enabled? return unless current_version = version ( @reference ) return unless higher_references = last_deployed_references . select { | n | version ( n ) &. > current_version } . presence interfering_stage_ids = deploy_scope . where ( reference : higher_references ) . pluck ( :stage_id ) interfering_stages = Stage . where ( id : interfering_stage_ids ) . pluck ( :name ) { state : "error" , statuses : [ { state : "Old Release" , description : "#{higher_references.join(', ')} was deployed to deploy groups in this stage" " by #{interfering_stages.join(", ")}" } ] } end
checks if other stages that deploy to the same hosts as this stage have deployed a newer release
checks if other stages that deploy to the same hosts as this stage have deployed a newer release
# code above is hot ... so keep it optimized and re-fetch here only if something bad was found # `pending` is also supported in deploys.js, but that seems even worse
None
nil, Hash