Add instrumentation for inputs keyword usage tracking
What does this MR do and why?
- Add instrumentation for inputs keyword usage tracking
- Add tracking for the 'inputs:' keyword in pipeline configs and sets ups header level foundational instrumentation.
Validation Steps
-
Test basic inputs tracking:
- Create a test project
- Add this
.gitlab-ci.yml:spec: inputs: environment: default: 'staging' --- test_job: script: echo "Environment is $[[ inputs.environment ]]" - Push and run pipeline
- Check Rails console:
Gitlab::InternalEvents.track_event('use_inputs_keyword_in_cicd_yaml', project: Project.find(PROJECT_ID)) - Verify event was recorded in
eventstable
-
Test input rules tracking:
- Update
.gitlab-ci.ymlto:spec: inputs: environment: rules: - if: '$CI_COMMIT_REF_NAME == "main"' default: 'production' - default: 'staging' --- test_job: script: echo "Environment is $[[ inputs.environment ]]" - Push and run pipeline
- Verify
use_input_rules_keyword_in_cicd_yamlevent was recorded
- Update
-
Test no false positives:
- Create pipeline with regular
.gitlab-ci.yml(no spec/inputs) - Verify neither event is tracked
- Create pipeline with
spec:but noinputs: - Verify neither event is tracked
- Create pipeline with regular
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.
Edited by Laura Montemayor