Reduce number of database queries on builds tab

Paco Guzman requested to merge 13912-reduce-pipeline-db-queries into master

What does this MR do?

Reduce number of db queries including project and namespace which are used to render some links for the builds. Beside instead access to the filesystem to check for the presence of an artifact we just check for any value on the database column see.

I wasn't able to compute the number of database queries that we reduce but is bigger with the number of builds per pipeline, and builds retried

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

What are the relevant issue numbers?

Relates #13912 (closed)

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

Merge request reports