Support multiple Code Quality jobs/reports
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label: - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary When pipeline has multiple [Code Quality](https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html) jobs and reports, it should merge their result ### Steps to reproduce 1. Create Gitlab CI pipeline configuration 2. Create multiple jobs with `code_quality` report (e.g. php-cs and ESLint) OR create a job that uploads multiple `code_quality` reports (e.g. php-cs-fixer) ### Example Project ```yaml eslint: stage: test script: - yarn eslint --format gitlab --ext .js,.vue --ignore-path .gitignore . artifacts: reports: codequality: gl-codequality.json phpcs: stage: test script: - php -d memory_limit=512M ./vendor/bin/phpcs --report=\\Satesh\\Phpcs\\CodeQualityReport artifacts: reports: codequality: gl-code-quality-report.json ``` ### What is the current *bug* behavior? Merge Requests' Code quality widget only applies latest job report and ignores other So in example above, if job `phpcs` finished **after** `eslint`, all `eslint` will be ignored, or marked ad fixed, if they existed in previous pipeline ### What is the expected *correct* behavior? Jobs' reports should 'merge' #### E.g.: `eslint` job report ```json [ { "description": "Custom elements in iteration require 'v-bind:key' directives.", "fingerprint": "30e8eb83b421216fd8bf20bc61a9b816", "location": { "path": "components/ClientSearchDialog.vue", "lines": { "begin": 71 } } } ] ``` `phpcs` job report ```json [ { "description": "Static property App\\Http\\Controllers\\ActivityController::$model (App\\Models\\BaseModel) does not accept default value of type string.", "fingerprint": "e2242bd5e3963fcc51d04c23275a2a7e1fea0bd9e5bf1b7b1c28172effd67e19", "location": { "path": "/home/leon0399/Documents/Programming/Explabs/fitness-backend/app/Http/Controllers/ActivityController.php", "lines": { "begin": 9 } } } ] ``` Should transform into ```json [ { "description": "Custom elements in iteration require 'v-bind:key' directives.", "fingerprint": "30e8eb83b421216fd8bf20bc61a9b816", "location": { "path": "components/ClientSearchDialog.vue", "lines": { "begin": 71 } } }, { "description": "Static property App\\Http\\Controllers\\ActivityController::$model (App\\Models\\BaseModel) does not accept default value of type string.", "fingerprint": "e2242bd5e3963fcc51d04c23275a2a7e1fea0bd9e5bf1b7b1c28172effd67e19", "location": { "path": "/home/leon0399/Documents/Programming/Explabs/fitness-backend/app/Http/Controllers/ActivityController.php", "lines": { "begin": 9 } } } ] ``` ### Relevant logs and/or screenshots Latest **finished** target branch pipeline job with `code_quality` report ![image](/uploads/29ce7142706094c3cf33830ea33c3771/image.png) Latest **finished** source branch pipeline job with `code_quality` report ![image](/uploads/504d0eafd0b6a89c39da581b834c9421/image.png) ### Output of checks This bug happens on GitLab.com, and on Gitlab EE #### Results of GitLab environment info <details> <summary>Expand for output related to GitLab environment info</summary> <pre> ``` System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.24.1 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 12.7.5-ee Revision: 19edff260da Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.9 URL: https://gitlab.*******.ru HTTP Clone URL: https://gitlab.*******.ru/some-group/some-project.git SSH Clone URL: git@gitlab.*******.ru:some-group/some-project.git Elasticsearch: no Geo: yes Geo node: Primary Using LDAP: no Using Omniauth: yes Omniauth Providers: gitlab, github, google_oauth2, bitbucket GitLab Shell Version: 11.0.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git ``` </pre> </details> #### Results of GitLab application Check <details> <summary>Expand for output related to the GitLab application check</summary> <pre> ``` Checking GitLab subtasks ... Checking GitLab Shell ... GitLab Shell: ... GitLab Shell version >= 11.0.0 ? ... OK (11.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful Checking GitLab Shell ... Finished Checking Gitaly ... Gitaly: ... default ... OK Checking Gitaly ... Finished Checking Sidekiq ... Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1 Checking Sidekiq ... Finished Checking Incoming Email ... Incoming Email: ... Checking Reply by email ... IMAP server credentials are correct? ... yes Init.d configured correctly? ... skipped MailRoom running? ... skipped Checking Reply by email ... Finished Checking Incoming Email ... Finished Checking LDAP ... LDAP: ... LDAP is disabled in config/gitlab.yml Checking LDAP ... Finished Checking GitLab App ... Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 1/3 ... yes 4/4 ... yes 6/5 ... yes 30/6 ... yes 6/7 ... yes 9/8 ... yes 41/9 ... yes 25/10 ... yes 17/11 ... yes 26/12 ... yes 23/13 ... yes 23/14 ... yes 23/15 ... yes 26/16 ... yes 35/17 ... yes 28/19 ... yes 28/20 ... yes 30/21 ... yes 5/22 ... yes 13/23 ... yes 34/24 ... yes 34/25 ... yes 4/26 ... yes 34/27 ... yes 30/28 ... yes 35/29 ... yes 9/30 ... yes 30/31 ... yes 20/32 ... yes 22/33 ... yes 24/34 ... yes 22/35 ... yes 40/36 ... yes 39/37 ... yes 41/38 ... yes 35/39 ... yes 22/40 ... yes 44/41 ... yes 45/42 ... yes 22/43 ... yes 50/45 ... yes 50/46 ... yes 52/47 ... yes 38/48 ... yes 1/49 ... yes 53/50 ... yes 50/51 ... yes 54/52 ... yes 55/53 ... yes 6/54 ... yes 22/55 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.5) Git version >= 2.22.0 ? ... yes (2.24.1) Git user has default SSH configuration? ... yes Active users: ... 21 Is authorized keys file accessible? ... skipped (authorized keys not enabled) Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled) Checking GitLab App ... Finished Checking Geo ... GitLab Geo is available ... yes GitLab Geo is enabled ... yes This machine's Geo node name matches a database record ... yes, found a primary node named "https://gitlab.explabs.ru/" HTTP/HTTPS repository cloning is enabled ... yes Machine clock is synchronized ... yes Git user has default SSH configuration? ... yes OpenSSH configured to use AuthorizedKeysCommand ... yes GitLab configured to disable writing to authorized_keys file ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Checking Geo ... Finished Checking GitLab subtasks ... Finished ``` </pre> </details> ### Possible fixes (If you can, link to the line of code that might be responsible for the problem)
issue