Skip to content

Follow up api bridge endpoint

Laura Montemayor requested to merge lm-follow-up-bridge-api-endpoint into master

Query details

Query: SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND "ci_builds"."commit_id" = 182409746 AND "ci_builds"."status" = 'running'

Plan with execution:

  Index Scan using index_ci_builds_on_commit_id_and_status_and_type on public.ci_builds  (cost=0.70..3.72 rows=1 width=1596) (actual time=17.447..17.447 rows=0 loops=1)
   Index Cond: ((ci_builds.commit_id = 182409746) AND ((ci_builds.status)::text = 'running'::text) AND ((ci_builds.type)::text = 'Ci::Build'::text))
   Buffers: shared read=5
   I/O Timings: read=17.386

Summary:

Time: 17.948 ms
  - planning: 0.460 ms
  - execution: 17.488 ms
    - I/O read: 17.386 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 0 from the buffer pool
  - reads: 5 (~40.00 KiB) from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

🤖 Joe says: Looks good 😄

Preload Queries

builds.with_preloads

SELECT "ci_job_artifacts".* FROM "ci_job_artifacts" WHERE "ci_job_artifacts"."job_id" IN (156158378, 121896538, 673784020, 409207962, 411364719, 173998826)
 Index Scan using index_ci_job_artifacts_on_job_id_and_file_type on public.ci_job_artifacts  (cost=0.57..54.35 rows=54 width=131) (actual time=0.038..49.891 rows=11 loops=1)
   Index Cond: (ci_job_artifacts.job_id = ANY ('{156158378,121896538,673784020,409207962,411364719,173998826}'::integer[]))
   Buffers: shared hit=17 read=18
   I/O Timings: read=49.638
Time: 50.110 ms
  - planning: 0.183 ms
  - execution: 49.927 ms
    - I/O read: 49.638 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 17 (~136.00 KiB) from the buffer pool
  - reads: 18 (~144.00 KiB) from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

bridges.with_preloads

explain SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND "ci_builds"."commit_id" = 182409746 AND "ci_builds"."type" = 'Ci::Bridge'
Result  (cost=0.70..136.72 rows=1 width=1596) (actual time=0.001..0.001 rows=0 loops=1)
   ->  Index Scan using index_ci_builds_on_commit_id_and_status_and_type on public.ci_builds  (cost=0.70..136.72 rows=1 width=1596) (actual time=0.000..0.000 rows=0 loops=0)
         Index Cond: ((ci_builds.commit_id = 182409746) AND ((ci_builds.type)::text = 'Ci::Build'::text))
Time: 0.803 ms
  - planning: 0.754 ms
  - execution: 0.049 ms
    - I/O read: 0.000 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 0 from the buffer pool
  - reads: 0 from the OS file cache, including disk I/O
  - dirtied: 0
  - writes: 0

What does this MR do?

In !31370 (merged) a new API endpoint was added to list the bridge jobs for a given pipeline.

There are a few follow-up issues that need to be resolved:

  • move :id/pipelines/:pipeline_id/jobs to lib/api/pipelines.rb
  • move :id/pipelines/:pipeline_id/bridges to lib/api/pipelines.rb
  • Refactor both /bridges and /jobs to remove duplication:
    • Rubocop offenses about ActiveRecord code reuse
    • use project.all_pipelines instead of project.ci_pipelines
    • consider implementing a Finder that could work for both Ci::Build and Ci::Bridge

Does this MR meet the acceptance criteria?

Conformity

#222307 (closed)

Edited by Laura Montemayor

Merge request reports