Skip to content
Snippets Groups Projects

Draft: Hack second cell so can login with shared user

Closed Thong Kuah requested to merge wip_login_with_shared_user into master
4 unresolved threads

What does this MR do and why?

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • assigned to @tkuah

  • A deleted user added backend label

    added backend label

  • Contributor
    4 Warnings
    :warning: This merge request does not refer to an existing milestone.
    :warning: You've made some app changes, but didn't add any tests.
    That's OK as long as you're refactoring existing code,
    but please consider adding any of the maintenancepipelines, maintenancerefactor, maintenanceworkflow, documentation, QA labels.
    :warning: Please add a merge request subtype to this merge request.
    :warning: Please add a merge request type to this merge request.
    2 Messages
    :book: CHANGELOG missing:

    If you want to create a changelog entry for GitLab FOSS, add the Changelog trailer to the commit message you want to add to the changelog.

    If you want to create a changelog entry for GitLab EE, also add the EE: true trailer to your commit message.

    If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.

    :book: This merge request adds or changes files that require a review from the Database team.

    This merge request requires a database review. To make sure these changes are reviewed, take the following steps:

    1. Ensure the merge request has database and databasereview pending labels. If the merge request modifies database files, Danger will do this for you.
    2. Prepare your MR for database review according to the docs.
    3. Assign and mention the database reviewer suggested by Reviewer Roulette.

    The following files require a review from the Database team:

    • lib/gitlab/database/query_analyzers/gitlab_schemas_validate_connection.rb

    Reviewer roulette

    Changes that require review have been detected!

    Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:

    Category Reviewer Maintainer
    backend Patrick Cyiza current availability (@jpcyiza) (UTC+2, 10 hours behind @tkuah) Vitali Tatarintev current availability (@ck3g) (UTC+2, 10 hours behind @tkuah)
    database Doug Stull current availability (@dstull) (UTC-4, 16 hours behind @tkuah) Adam Hegyi current availability (@ahegyi) (UTC+2, 10 hours behind @tkuah)
    ~"group::authentication and authorization" Reviewer review is optional for ~"group::authentication and authorization" Drew Blessing current availability (@dblessing) (UTC-5, 17 hours behind @tkuah)

    To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.

    Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • mentioned in issue #409841 (closed)

  • mentioned in issue #409842 (closed)

  • Setting label grouptenant scale based on @tkuah's group.

    • Author Maintainer

      One FK needed adjusting. TODO: @tkuah to make a new issue

      (arm64) tkgl2:gitlab tkuah$ gdk psql
      selpsql (13.11)
      Type "help" for help.
      
      gitlabhq_development=# \d members
                                                   Table "public.members"
              Column        |            Type             | Collation | Nullable |               Default               
      ----------------------+-----------------------------+-----------+----------+-------------------------------------
       id                   | integer                     |           | not null | nextval('members_id_seq'::regclass)
       access_level         | integer                     |           | not null | 
       source_id            | integer                     |           | not null | 
       source_type          | character varying           |           | not null | 
       user_id              | integer                     |           |          | 
       notification_level   | integer                     |           | not null | 
       type                 | character varying           |           |          | 
       created_at           | timestamp without time zone |           |          | 
       updated_at           | timestamp without time zone |           |          | 
       created_by_id        | integer                     |           |          | 
       invite_email         | character varying           |           |          | 
       invite_token         | character varying           |           |          | 
       invite_accepted_at   | timestamp without time zone |           |          | 
       requested_at         | timestamp without time zone |           |          | 
       expires_at           | date                        |           |          | 
       ldap                 | boolean                     |           | not null | false
       override             | boolean                     |           | not null | false
       state                | smallint                    |           |          | 0
       invite_email_success | boolean                     |           | not null | true
       member_namespace_id  | bigint                      |           |          | 
       member_role_id       | bigint                      |           |          | 
      Indexes:
          "members_pkey" PRIMARY KEY, btree (id)
          "idx_members_created_at_user_id_invite_token" btree (created_at) WHERE invite_token IS NOT NULL AND user_id IS NULL
          "idx_members_on_user_and_source_and_source_type_and_member_role" btree (user_id, source_id, source_type, member_role_id)
          "index_members_on_access_level" btree (access_level)
          "index_members_on_expires_at" btree (expires_at)
          "index_members_on_invite_email" btree (invite_email)
          "index_members_on_invite_token" UNIQUE, btree (invite_token)
          "index_members_on_member_namespace_id" btree (member_namespace_id)
          "index_members_on_member_namespace_id_compound" btree (member_namespace_id, type, requested_at, id)
          "index_members_on_member_role_id" btree (member_role_id)
          "index_members_on_requested_at" btree (requested_at)
          "index_members_on_source_and_type_and_access_level" btree (source_id, source_type, type, access_level)
          "index_members_on_source_state_type_access_level_and_user_id" btree (source_id, source_type, state, type, access_level, user_id) WHERE requested_at IS NULL AND invite_token IS NULL
          "index_members_on_user_id_and_access_level_requested_at_is_null" btree (user_id, access_level) WHERE requested_at IS NULL
          "index_members_on_user_id_created_at" btree (user_id, created_at) WHERE ldap = true AND type::text = 'GroupMember'::text AND source_type::text = 'Namespace'::text
          "index_non_requested_project_members_on_source_id_and_type" btree (source_id, source_type) WHERE requested_at IS NULL AND type::text = 'ProjectMember'::text
          "index_project_members_on_id_temp" btree (id) WHERE source_type::text = 'Project'::text
          "tmp_index_for_null_member_namespace_id" btree (member_namespace_id) WHERE member_namespace_id IS NULL
          "tmp_index_members_on_state" btree (state) WHERE state = 2
      Check constraints:
          "check_508774aac0" CHECK (member_namespace_id IS NOT NULL)
      Foreign-key constraints:
          "fk_2e88fb7ce9" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
          "fk_2f85abf8f1" FOREIGN KEY (member_namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE
          "fk_5e12d50db3" FOREIGN KEY (member_role_id) REFERENCES member_roles(id) ON DELETE CASCADE
      Referenced by:
          TABLE "member_tasks" CONSTRAINT "fk_12816d4bbb" FOREIGN KEY (member_id) REFERENCES members(id) ON DELETE CASCADE
      
      gitlabhq_development=# ALTER TABLE members DROP CONSTRAINT fk_2e88fb7ce9;
      ALTER TABLE
      
      
      
      
      
      Edited by Thong Kuah
    • Author Maintainer

      Can create a new group in Cell 2 !

      gitlabhq_development=# select * from namespaces;
       id |     name      |    path     | owner_id |         created_at         |         updated_at         | type  | description | avatar | membership_lock | share_with_group_lock | visibility_level | request_access_enabled | ldap_sync_status | ldap_sync_error | ldap_sync_last_update_at | ldap_sync_last_successful_update_at | ldap_sync_last_sync_at | description_html | lfs_enabled | parent_id | shared_runners_minutes_limit | repository_size_limit | require_two_factor_authentication | two_factor_grace_period | cached_markdown_version | project_creation_level | runners_token | file_template_project_id | saml_discovery_token | runners_token_encrypted | custom_project_templates_group_id | auto_devops_enabled | extra_shared_runners_minutes_limit | last_ci_minutes_notification_at | last_ci_minutes_usage_notification_level | subgroup_creation_level | emails_disabled | max_pages_size | max_artifacts_size | mentions_disabled | default_branch_protection | unlock_membership_to_ldap | max_personal_access_token_lifetime | push_rule_id | shared_runners_enabled | allow_descendants_override_disabled_shared_runners | traversal_ids | organization_id 
      ----+---------------+-------------+----------+----------------------------+----------------------------+-------+-------------+--------+-----------------+-----------------------+------------------+------------------------+------------------+-----------------+--------------------------+-------------------------------------+------------------------+------------------+-------------+-----------+------------------------------+-----------------------+-----------------------------------+-------------------------+-------------------------+------------------------+---------------+--------------------------+----------------------+-------------------------+-----------------------------------+---------------------+------------------------------------+---------------------------------+------------------------------------------+-------------------------+-----------------+----------------+--------------------+-------------------+---------------------------+---------------------------+------------------------------------+--------------+------------------------+----------------------------------------------------+---------------+-----------------
        1 | Administrator | root        |        1 | 2023-07-16 22:50:58.280337 | 2023-07-16 22:50:58.280337 | User  |             |        | f               | f                     |               20 | t                      | ready            |                 |                          |                                     |                        |                  |             |           |                              |                       | f                                 |                      48 |                 2097152 |                        |               |                          |                      |                         |                                   |                     |                                    |                                 |                                          |                       1 |                 |                |                    |                   |                           |                           |                                    |              | t                      | f                                                  | {1}           |               1
        7 | group-cell2   | group-cell2 |          | 2023-07-18 23:40:19.300664 | 2023-07-18 23:40:19.300664 | Group |             |        | f               | f                     |               10 | t                      | ready            |                 |                          |                                     |                        |                  |             |           |                              |                       | f                                 |                      48 |                 2097152 |                        |               |                          |                      |                         |                                   |                     |                                    |                                 |                                          |                       1 |                 |                |                    |                   |                           |                           |                                    |              | t                      | f                                                  | {7}           |               1
      (2 rows)
    • Please register or sign in to reply
  • Thong Kuah added 1 commit

    added 1 commit

    • 83d4d166 - Make more user adjacent tables main_clusterwide

    Compare with previous version

  • Contributor

    Allure report

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :exclamation: test report for 5a51a255

    expand test summary
    +-----------------------------------------------------------------------+
    |                            suites summary                             |
    +------------------+--------+--------+---------+-------+-------+--------+
    |                  | passed | failed | skipped | flaky | total | result |
    +------------------+--------+--------+---------+-------+-------+--------+
    | Create           | 46     | 0      | 1       | 10    | 47    | ❗     |
    | Plan             | 51     | 0      | 0       | 6     | 51    | ❗     |
    | Govern           | 36     | 0      | 0       | 7     | 36    | ❗     |
    | Manage           | 13     | 0      | 1       | 12    | 14    | ❗     |
    | Package          | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Verify           | 8      | 0      | 0       | 2     | 8     | ❗     |
    | Data Stores      | 22     | 0      | 0       | 7     | 22    | ❗     |
    | Monitor          | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Framework sanity | 0      | 0      | 1       | 0     | 1     | ➖     |
    +------------------+--------+--------+---------+-------+-------+--------+
    | Total            | 180    | 0      | 4       | 44    | 184   | ❗     |
    +------------------+--------+--------+---------+-------+-------+--------+
  • mentioned in epic &9813 (closed)

  • Thong Kuah added 1 commit

    added 1 commit

    • f3aba4a8 - Debug why User is using `main` connection sometimes

    Compare with previous version

  • Thong Kuah added 1435 commits

    added 1435 commits

    • f3aba4a8...6c57b734 - 1432 commits from branch master
    • 2e22448a - Draft: Hack second cell so can login with shared user
    • ff2986ed - Make more user adjacent tables main_clusterwide
    • c208888b - Debug why User is using `main` connection sometimes

    Compare with previous version

  • mentioned in issue #415201 (closed)

  • Thong Kuah
  • Thong Kuah added 1 commit

    added 1 commit

    Compare with previous version

  • Thong Kuah
    Thong Kuah @tkuah started a thread on the diff
  • 273 273 end
    274 274
    275 275 def log_user_activity(user)
    276 login_counter.increment
    277 Users::ActivityService.new(author: user).execute
    276 #login_counter.increment
    277 #Users::ActivityService.new(author: user).execute
  • Thong Kuah
  • Thong Kuah added 1 commit

    added 1 commit

    • 8bce8101 - Convert authentication_events to main_clusterwide

    Compare with previous version

  • Thong Kuah
    Thong Kuah @tkuah started a thread on the diff
  • 12 12 before_action only: [:new] do
    13 13 push_frontend_feature_flag(:arkose_labs_login_challenge)
    14 14 end
    15 prepend_before_action :complete_identity_verification, only: :create
    15 #prepend_before_action :complete_identity_verification, only: :create
  • Thong Kuah added 1 commit

    added 1 commit

    • eda2d489 - Un-comment now authentication_events is fixed

    Compare with previous version

  • mentioned in issue #420392 (closed)

  • Thong Kuah added 2474 commits

    added 2474 commits

    • eda2d489...31bcd22a - 2469 commits from branch master
    • 09655065 - Draft: Hack second cell so can login with shared user
    • 8192c24e - Make more user adjacent tables main_clusterwide
    • cbc2327a - Debug why User is using `main` connection sometimes
    • 15354749 - No need to comment this out
    • 5a51a255 - Un-comment now authentication_events is fixed

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading