Skip to content

Persist and surface prefilled variables from PEP

What does this MR do and why?

Variables defined as a hash with description can be prefilled when running pipeline manually.

This change collects and persists these variables from pipeline execution policy configs and surfaces them together with the project variables.

References

Screenshots or screen recordings

PEP variables showing up when running a pipeline manually:

CleanShot_2025-10-07_at_17.04.59_2x

Recording of applying the variable values with multiple PEPs:

CleanShot_2025-10-07_at_17.05.53

How to set up and validate locally

  1. Create a project

  2. Create a new pipeline execution policy and define some prefill variables, declaring description attribute. Don't forget to allowlist the variables that are expected to receive user input:

    • pep.yml:
      variables:
        POLICY_VAR:
          value: 'a'
          description: 'Policy var'
          options:
          - 'a'
          - 'b'
          - 'c'
        POLICY_MODE:
          value: 'strict'
          description: 'Mode of the policy.'
          options:
          - 'strict'
          - 'loose'
        FREETEXT_VAR:
          description: 'free text var'
        OTHER_VAR: 'not a prefill variable'
      
      policy-job:
        script:
          - echo "POLICY_VAR = $POLICY_VAR"
          - echo "POLICY_MODE = $POLICY_MODE"
          - echo "FREETEXT_VAR = $FREETEXT_VAR"
          - echo "OTHER_VAR = $OTHER_VAR"
          - echo "DISALLOWED_VAR = $DISALLOWED_VAR"
    • policy.yml:
      ---
      pipeline_execution_policy:
      - name: Prefilled variables
        description: ''
        enabled: true
        pipeline_config_strategy: inject_policy
        content:
          include:
          - project: gitlab-org/pep/prefilled-variables
            file: policy.yml
        skip_ci:
          allowed: false
        variables_override:
          allowed: false
          exceptions:
          - POLICY_VAR
          - POLICY_MODE
          - FREETEXT_VAR
      
  3. In the project, run a new pipeline manually

  4. Verify that policy variables show up in the list of prefilled variables

MR acceptance checklist

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

Related to #527021

Edited by Martin Čavoj

Merge request reports

Loading