can_start_deployment?

in lib/release_tools/auto_deploy/deployment_pipeline/sequencer.rb [19:62]


          def can_start_deployment?
            pipeline = Latest.pipeline
            bridge_jobs = GitlabOpsClient.pipeline_bridges(Project::ReleaseTools, pipeline.id).auto_paginate
            prod_canary = bridge_jobs.detect { |job| job.name == 'deploy:gprd-cny' }

            if job_completed?(prod_canary)
              logger.info(
                'Latest pipeline has completed deploying to gprd-cny, new pipeline can be started',
                pipeline_url: pipeline.web_url,
                gprd_cny_job_status: prod_canary.status
              )
              return true
            end

            if canceled?(prod_canary, pipeline)
              logger.info(
                'Latest gprd-cny deployment or coordinated pipeline has been canceled, new pipeline can be started',
                pipeline_status: pipeline.status,
                gprd_cny_job_status: prod_canary.status,
                pipeline_url: pipeline.web_url
              )
              return true
            end

            if job_failed?(prod_canary, pipeline)
              logger.info(
                'Latest pipeline has not completed deploying to gprd-cny, but sufficient time has passed, so new pipeline can be started',
                pipeline_status: pipeline.status,
                pipeline_url: pipeline.web_url,
                gprd_cny_job_status: prod_canary.status
              )
              return true
            end

            logger.info(
              'New pipeline cannot be started since previous pipeline has not completed deploying to gprd-cny',
              pipeline_status: pipeline.status,
              pipeline_url: pipeline.web_url,
              gprd_cny_job_status: prod_canary.status
            )

            false
          end