CI/CD Fundamentals

Masked variables

< >

5. Masked variables

You can mask a project, group, or instance CI/CD variable so the value of the variable does not display in job logs. The method used to mask variables limits what can be included in a masked variable. The value of the variable must:

  • Be a single line.
  • Be 8 characters or longer.
  • Not matching the name of an existing predefined or custom CI/CD variable.ci_beginner_course

To mask a variable:

  1. Navigate to your project in GitLab.
  2. Go to Settings > CI/CD.
  3. Expand the Variables section.
  4. Click on Add variable.
  5. Enter the Key and Value for the variable.
    • We will create a variable for this example:
      • Key: MASKED_VAR
      • Value: ThisIsMaskedValue
  6. Set the scope of the variable (Project-Level or Group-Level).
  7. Mark the variable as Masked.
  8. **Click Add variable to save the masked variable.