Skip to content

Add feature-flagged secrets page

Miranda Fluharty requested to merge tanukey-ui-boilerplate into master

What does this MR do and why?

For Frontend (Tanu-Key): Create feature flag and ba... (#424452 - closed)

This MR adds a feature-flagged empty page (at the project level and at the group level) with an empty vue app that we can build the Frontend: Tanu-Key MVC (&11373) inside of.

This is in ee/ for now because we're unsure what the pricing model will be, we can always move it out later if we need to 🤷🏻

It may be helpful to review this commit-by-commit because the first commit sets this up for projects, then the second commit builds on that to make it work for groups:

  • Add feature-flagged project secrets page (!131224 (737b7da6))

    • Create tanukey_ui feature flag, render 404 unless enabled
    • Add project secrets route, basic controller+spec, basic helper+spec
    • Add page haml, page index.js, root index.js, empty SecretsApp component
  • Do the same for group secrets (!131224 (4bd868ca))

    • Add group secrets route, controller+spec, page haml, page index.js
    • Add group params into helper+spec, root index.js, SecretsApp

... and further commits make changes to the files established above.

Screenshots or screen recordings

Before After
Screenshot_2023-09-07_at_22.42.03 Screenshot_2023-09-21_at_16.19.45

How to set up and validate locally

Check out the branch and enable the feature flag for a root group:

git checkout tanukey-ui-boilerplate
echo "Feature.enable(:ci_tanukey_ui, Group.find_by_full_path(\"gitlab-org\"))" | gdk rails c
  1. have developer-or-higher access to a root group and enable the feature flag for that group
    • note: make sure this is a root group - enabling the flag for a subgroup will have no effect because we check for the flag on the project.group.root_ancestor/project.root_ancestor
  2. navigate to the root group, for example: http://gdk.test:3000/gitlab-org
  3. insert /groups into the url and add /-/secrets onto the end of the url: http://gdk.test:3000/groups/gitlab-org/-/secrets
  4. open Vue devtools and verify that there is a <GroupSecretsApp> on the page which is receiving the correct groupId and groupPath
  5. all descendants of the group for which the feature flag is enabled should show secrets pages - so navigate to any subgroups and projects that belong to the group (that you also have developer-or-higher access to) and repeat the process:
    1. navigate to the project: http://gdk.test:3000/gitlab-org/gitlab-test
    2. add /-/secrets onto the end of the url: http://gdk.test:3000/gitlab-org/gitlab-test/-/secrets
    3. open Vue devtools and verify that there is a <ProjectSecretsApp> on the page which is receiving the correct projectId and projectPath
    4. navigate to some subgroup: http://gdk.test:3000/gitlab-org/gitlab-test/some-subgroup
    5. insert /groups into the url and add /-/secrets onto the end of the url: http://gdk.test:3000/groups/gitlab-org/gitlab-test/some-subgroup/-/secrets
    6. open Vue devtools and verify that there is a <GroupSecretsApp> on the page which is receiving the correct groupId and groupPath
  6. any groups and projects outside the root group for which the feature flag is enabled should not show secrets pages

additional optional testing:

  • add any path onto the end of the secrets url, i.e. [group or project url]/-/secrets/123/456, and verify that the secrets page is still displayed (this will allow us to link directly to specific pages in this vue app later on)

to run specs:

yarn install
yarn jest frontend/secrets
bundle install
bundle exec rspec ee/spec/requests/projects/secrets_controller_spec.rb ee/spec/requests/groups/secrets_controller_spec.rb ee/spec/helpers/secrets_helper_spec.rb

MR acceptance checklist

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

Edited by Miranda Fluharty

Merge request reports