Skip to content

Backfill StatusPage::PublishedIncidents and add /publish quick action

Sarah Yasonik requested to merge sy-publish-command into master

What does this MR do?

  • Backfills table for ::StatusPage::PublishedIncident with entries for all public issues for which status page is enabled & are not confidential (idempotent). This is a new feature with low usage, so this will be fairly few rows.
  • Updates PublishService to determine whether to publish an issue based on whether an entry in ::StatusPage::PublishedIncident exists (was & still is idempotent)
  • Adds a /publish quick action which only appears for developers+ on non-published issues.
  • Not changed: confidential issues still cannot be published.

Related issue: #209849 (closed)

MRs for full feature:

Migration output:

$ rake db:migrate
== 20200421195234 BackfillStatusPagePublishedIncidents: migrating =============
== 20200421195234 BackfillStatusPagePublishedIncidents: migrated (0.0630s) ====

$ rake db:migrate:down VERSION=20200421195234
== 20200421195234 BackfillStatusPagePublishedIncidents: reverting =============
== 20200421195234 BackfillStatusPagePublishedIncidents: reverted (0.0000s) ====

Migration query execution plan:

SELECT * FROM issues 
INNER JOIN status_page_settings 
ON status_page_settings.project_id = issues.project_id
WHERE status_page_settings.enabled = true 
AND issues.confidential = false
Nested Loop  (cost=0.56..263.10 rows=137 width=3572) (actual time=9.835..24.239 rows=6 loops=1)
   Buffers: shared hit=5 read=13
   I/O Timings: read=24.054
   ->  Seq Scan on public.status_page_settings  (cost=0.00..4.02 rows=1 width=2265) (actual time=0.889..0.891 rows=2 loops=1)
         Filter: status_page_settings.enabled
         Rows Removed by Filter: 0
         Buffers: shared read=1
         I/O Timings: read=0.878
   ->  Index Scan using index_issues_on_project_id_and_iid on public.issues  (cost=0.56..257.71 rows=137 width=1307) (actual time=7.107..11.666 rows=3 loops=2)
         Index Cond: (issues.project_id = status_page_settings.project_id)
         Filter: (NOT issues.confidential)
         Rows Removed by Filter: 0
         Buffers: shared hit=5 read=12
         I/O Timings: read=23.176
Time: 24.774 ms
  - planning: 0.476 ms
  - execution: 24.298 ms
    - I/O read: 24.054 ms
    - I/O write: 0.000 ms

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

Screenshots

On issue creation: Upon adding a note: Failure message (not reproducible outside of specs; only unforeseen issues):
Screen_Shot_2020-05-20_at_11.43.44_AM Screen_Shot_2020-05-20_at_11.06.57_AM Screen_Shot_2020-05-21_at_5.50.28_PM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Leitzen

Merge request reports