Skip to content

Allow jobs need to refer to a job in the same stage [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Laura Montemayor requested to merge lm-allow-need-jobs-same-stage into master

What does this MR do?

Allows needs to refer to jobs from the same stage.

Screenshots (strongly suggested)

Ci Lint:
Screen_Shot_2021-05-14_at_3.55.04_PM

Visualize:
Screen_Shot_2021-05-14_at_3.55.10_PM

Needs: Screen_Shot_2021-05-14_at_3.56.51_PM

Screen_Shot_2021-05-14_at_3.59.25_PM

Screen_Shot_2021-05-14_at_3.59.37_PM

Does this MR meet the acceptance criteria?

EXPLAIN ANALYZE
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" IN ('Ci::Processable', 'Ci::Build', 'Ci::Bridge')
  AND ("ci_builds"."commit_id" IN (SELECT MAX(id) FROM ci_pipelines))
  AND ("ci_builds"."status" IN ('skipped'))
  AND "ci_builds"."scheduling_type" = 0
  AND (stage_idx > 0)
 Nested Loop  (cost=1.30..38.11 rows=14 width=1286) (actual time=0.107..0.108 rows=0 loops=1)
   ->  Result  (cost=0.60..0.61 rows=1 width=4) (actual time=0.082..0.082 rows=1 loops=1)
         InitPlan 1 (returns $0)
           ->  Limit  (cost=0.57..0.60 rows=1 width=4) (actual time=0.079..0.080 rows=1 loops=1)
                 ->  Index Only Scan Backward using ci_pipelines_pkey on ci_pipelines  (cost=0.57..8771550.02 rows=311217263 width=4) (actual time=0.079..0.079 rows=1 loops=1
)
                       Index Cond: (id IS NOT NULL)
                       Heap Fetches: 2
   ->  Index Scan using index_ci_builds_on_commit_id_and_status_and_type on ci_builds  (cost=0.70..37.35 rows=14 width=1286) (actual time=0.024..0.024 rows=0 loops=1)
         Index Cond: ((commit_id = ($0)) AND ((status)::text = 'skipped'::text))
         Filter: ((stage_idx > 0) AND (scheduling_type = 0) AND ((type)::text = ANY ('{Ci::Processable,Ci::Build,Ci::Bridge}'::text[])))
 Planning Time: 24.519 ms
 Execution Time: 0.156 ms
(12 rows)

Conformity

Relates to: #30632 (closed)

Checklist ported over from the POC:

  • Handling circular dependencies.
  • Handling .before_stage, .for_stage and .after_stage as this will break that, ex.: retry of build, dependencies, analytics
  • UX / some designs.
  • A feature flag
  • documentation changes
Edited by Laura Montemayor

Merge request reports