An error occurred while fetching the assigned iteration of the selected issue.
Verify stages statuses migration correctness on production
We recently migrated some data regarding pipelines and stages. The code snippet below should be executed in the rails console, to check if migration has been successful.
Ci::Pipeline.order('RANDOM()').limit(200).map do |pipeline|
pipeline.legacy_stages.map do |legacy_stage|
persisted_stage = pipeline.stages.find_by(name: legacy_stage.name)
if persisted_stage.nil?
"Persisted stage #{legacy_stage.name} for pipeline " \
"##{pipeline.id} not found!"
elsif persisted_stage.status != legacy_stage.status
"Stage `#{persisted_stage.name}` status mismatch: " \
"#{legacy_stage.status} / #{persisted_stage.status}"
end
end
end.flatten.compact
What we need is the value returned by this value, other logs (like ActiveRecord stuff printed into the console) are not relevant.
Please execute it more than once if this is fast enough, sample of 1000 pipelines (execute this 5 times) should be enough.
Thanks in advance!
/cc @ayufan