Skip to content

Add job count metric for pipeline execution policy

What does this MR do and why?

This MR adds a new metric to count the number of jobs executed by pipeline execution policies.

Related to: #436055 (closed)

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

Screenshot_2024-07-19_at_5.16.35_PM

How to set up and validate locally

  1. Enable the pipeline_execution_policy_type feature flag
Feature.enable(:pipeline_execution_policy_type)
  1. Create a new Group
  2. Create a new project
  3. Add a .gitlab-ci.yml with the content
test1:
  stage: test
  script:
    - echo "Do a test here"
    - echo "For example run a test suite"

test2:
  stage: test
  script:
    - echo "Do another parallel test here"
    - echo "For example run a lint test"
  1. Create another project

  2. Go to Secure > Policies

  3. Click in New policy

  4. Select Pipeline execution policy

  5. Create a new policy injecting the content from the .gitlab-ci.yml created in the step 3

  6. Click in update via merge request

  7. Start the event monitoring running the command bellow in the gdk-folder/gitlab directory

rails runner scripts/internal_events/monitor.rb execute_job_pipeline_execution_policy
  1. Go to Build > Pipelines and run a pipeline
  2. Check if the counter was increased by 2 in the event monitoring.
Edited by Marcos Rocha

Merge request reports