Uses `list_commits_by_oid` on the CommitService, to request the needed
commits for pipelines. These commits are needed to display the user that
created the commit and the commit title.
This includes fixes for tests failing that depended on the commit
being `nil`. However, now these are batch loaded, this doesn't happen
anymore and the commits are an instance of BatchLoader.
This changes Ci::Pipeline#latest_builds_with_artifacts so it returns an
Array instead of a relation. Whenever we use this data we do so in two
steps:
1. Count the number of rows
2. If this number is greater than 0, iterate over the rows
By returning an Array instead we only execute 1 query of which the total
time/work is less than running either just a COUNT(*) or both queries
(in the worst case).
On GitLab.com this change should save us a few milliseconds per request
to ProjectsController#show.
Without this fix, pipeline could go from skipped to
running directly, bypassing the transition for:
[:created, :pending] => :running
And this is responsible for setting up started_at.
Without this fix, started_at would never be set.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/39884
Now, when requesting a commit from the Repository model, the results are
not cached. This means we're fetching the same commit by oid multiple times
during the same request. To prevent us from doing this, we now cache
results. Caching is done only based on object id (aka SHA).
Given we cache on the Repository model, results are scoped to the
associated project, eventhough the change of two repositories having the
same oids for different commits is small.
Given the user can soon have multiple config sources for CI, we now store
what type at the time of the pipeline run we chose. This will give us
insight into what triggered the new pipeline so we can display it to the
enduser.
Behind an application setting, which defaults to false, this commit
implements the implied CI/CD config. Which means that in the case we
can't find the `.gitlab-ci.yml` on the commit we want to start a
pipeline for, we fall back to an implied configuration.
For now the Bash template has been copied to
`Auto-Devops.gitlab-ci.yml` so the tests actually work.
Fixes#34777
* master: (275 commits)
Decrease Metrics/PerceivedComplexity threshold to 17
Upgrade mail and nokogiri gems due to security issues
Link out to stackoverflow answer on setting swappiness
Document swappiness recomendations in the requirements doc
Fix invalid attribute used for time-ago-tooltip component
Update latest artifacts doc
Add changelog entry for flipping verify_certificates
Default LDAP config verify_certificates to true
Update share project with groups docs
remove accidental console.log from karma tests
update specs to match reorganized monitoring components
Remove tooltips from new sidebar
Use `git update-ref --stdin -z` to delete refs
Don't use public_send in destroy_conditionally! helper
Remove unused expressions policy from ci/cd config
Simplify code for appending strategies in CI/CD config
Raise exception when simplifiable ci entry incomplete
Add changelog entry
Fix MySQL failure for emoji autocomplete
max-width for lazy-loaded images (this was removed in the original MR through merge resolution most probably)
...
Conflicts:
lib/gitlab/ci/config/entry/policy.rb
* upstream/master: (638 commits)
Simplify background migrations stealing code
Expire cached user IDs that can see the performance after 5 minutes
Promote visibility level helpers from Group to Namespace
Fix off-by-one error in background migration retries
Recover from all exceptions when stealing bg migration
Fix label creation from new list for subgroup projects
move click handler to button. when on the icon it wasn't triggered in firefox
Fix incorrect AWS ELB metrics.
Fix wrong link to docs in docs styleguide
Update issue-related docs
Refactor groups docs
Add subgroups limitations to Pages docs
Update Google launcher details
Split docs on IP whitelist for monitoring access
Update health check docs
Bump fog-core to 1.44.3 and fog providers' plugins to latest
Introduce have_gitlab_http_status
Remove Repository#search_files
Update Pipeline's badge count in Merge Request and Commits view to match real-time content
Fixes the user order being overriden in the autocomplete controller
...
This is allowed for existing instances so we don't end up 76 offenses
right away, but for new code one should _only_ use this if they _have_
to remove non database data. Even then it's usually better to do this in
a service class as this gives you more control over how to remove the
data (e.g. in bulk).