The original intention of `get_build` was as a workaround not to violate
`CodeReuse/ActiveRecord`. `find_by_id` does the exact same thing but
does not violate the rubocop rule.
Inside of `Projects::ArtifactsController` and
`Projects::BuildArtifactsController` we fetching the build by id using
active record directly which violates `CodeReuse/ActiveRecord` rubocop
rule. Create `get_build` inside of `project` model which does the same
thing.
`project.latest_successful_builds_for(ref)` is being used to find a
single job all the time. This results into us having to call `find_by`
inside of the controller which violates our CodeReuse/ActiveRecord
rubocop rule.
Refactor `project.latest_successful_builds_for(ref)` to
`project.latest_successful_build_for(job_name, ref)` which will execute
the `find_by` inside of the model.
Also create `project.latest_successful_build_for!(job_name, ref)` which
raises an exception instead of returning nil.
Enables frozen string for some vestigial files as
well as the following:
* app/controllers/projects/**/*.rb
* app/controllers/sherlock/**/*.rb
* app/controllers/snippets/**/*.rb
* app/controllers/users/**/*.rb
Partially addresses #47424.
Since Rails 5 request.format gets set by extension if it's not explicitly
set.
That means artifacts_controller#file no longer works as expected.
This commit explicitly sets request.format for artifacts_controller#file.
Rename other URL generators
admin_builds_path -> admin_jobs_path
Fix tests and more renaming
Fix more tests
Also change build_id to job_id in the controller
* master: (335 commits)
Disable transaction when adding index for Ci::Pipeline
added changelog
allow empty repos on import/export
Modify test for Build tabs
Add tests to project builds for pending tab
Remove unused .js-running-count class
Add test for new pending tab and update tests for running tab
Add Pending Tab to Admin Builds
added changelog
limit project expor retry to only 3
use method in validates statement
Fix spec to set import_url before attempting to create import_data
Allow a project import URL to be blank to prevent false positives preventing settings from being saved
Refactor gitlab_ci_yaml_processor variables tests
Fix CI yaml example
Align cancel and retry buttons
Remove deploy to production button
Remove irrelevant comments
Fix gitlab_ci_yaml_processor_spec.rb
Fix AddWhenAndYamlVariablesToCiBuilds migration
...
It turns out they are different:
builds.success.latest.first
and
builds.latest.success.first
If we put success first, that latest would also filter via success,
and which is what we want here.
So we redirect from ref and build_name to the particular build, namely:
* /u/r/artifacts/ref/build_name/* -> /u/r/builds/:build_id/artifacts/*
For:
* download
* browse
* file