Skip to main content

Sampling of proposed runs

In working directories referenced with many stacks, PRs can be extremely noisy, as they can trigger many proposed runs and very often.

It would be great to have a way of sampling the proposed runs, so lets say only 10% of the stacks targeting the modified directory get a proposed run.

Alternatively, the number of runs triggered by a git event should be configurable between tracked and proposed runs.

Workaround
Problem
Status: ✅ Completed6 comments

Log in to comment and vote

Comments6

  • Black Breeze

    •

    Jul 19, 2025

    package spacelift
    
    propose {
      ratio := 10 # Trigger only 10% of stacks
      (input.stack.created_at % ratio) == (input.spacelift.request.timestamp_ns % ratio)
      
      # The rest of your logic
    }

    Would something like this work? If so, we’d just need to add input.stack.created_at to our policy document. Please let me know your thoughts.