Skip to content

Add masked and hidden option to variables UI

What does this MR do and why?

#⃣ For Frontend (Variable drawer): Add "Masked and hid... (#29674 - closed)

Feature flag rollout issue: [Feature Flag] Rollout of `ci_hidden_variables` (#451326 - closed)

Add masked and hidden option to variables UI

Check feature flag value, pass areHiddenVariablesAvailable down
Show new "Masked and hidden" radio button
Save masked and hidden variables with masked: true, hidden: true
Load masked and hidden variables by translating booleans to options
Show "Hidden" badge if variable is hidden
Add exception: don't validate blank value when editing a hidden variable
Show different settings section text if flag is enabled
Update documentation to refer to "Visibility" instead of just "Masked"

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
group variables Screenshot_2024-07-18_at_11.23.40 Screen_Recording_2024-07-22_at_17.03.02
project variables Screenshot_2024-07-18_at_11.23.46 Screen_Recording_2024-07-22_at_17.18.29
instance variables Screenshot_2024-07-18_at_11.23.57 no change

How to set up and validate locally

  1. if !159937 (merged) has not been merged:

    !159937 (merged) includes the hidden attribute in the variable list response - without this, after you save a hidden variable, it will look like a masked variable. So to test out the full feature, check out this MR's branch and then rebase it on !159937 (merged)'s:

    git checkout 29674-expose-hidden-attribute-and-push-feature-flag
    git checkout 29674-add-masked-and-hidden-option-to-ui
    git rebase 29674-expose-hidden-attribute-and-push-feature-flag
  2. pick a group and note its ID

  3. enable the feature flag for the group (replace 83 in the example below with your group's ID):

    echo "Feature.enable(:ci_hidden_variables, Group.find(83))" | gdk rails c
  4. navigate to that group, and in the sidebar choose Settings => CI/CD

  5. verify the following behaviors:

    • in the drawer, when creating a hidden variable, its value is validated exactly like a masked variable's value would be
    • in the drawer, when editing a hidden variable, its visibility and value cannot be changed
    • in the table, hidden variables show a Hidden badge and don't show their value
  6. navigate to a project in that group, and in the sidebar choose Settings => CI/CD

  7. verify the behaviors from 5., and one more:

    • in the Group variables (inherited) table (shown below the main variables table if the group that the project belongs to has defined any variables), hidden variables from the group show a Hidden badge
  8. navigate to the admin area (Admin button at the bottom of the sidebar), then in that sidebar choose Settings => CI/CD

  9. verify that nothing has changed in this view (why? we don't plan to implement this feature for instance variables)

Edited by Miranda Fluharty

Merge request reports

Loading