Skip to content

dev/ci: make branches that require arguments explicit

Administrator requested to merge argument-matchers into main

Created by: bobheadxi

Adds a new matcher option, BranchArgumentRequired, that indicates the run type requires an argument within the branch name - namely docker-images-patch and docker-images-patch-notest. This removes the need for magic numbers as pointed out in https://github.com/sourcegraph/sourcegraph/pull/31100#discussion_r805828674

This also allows sg ci build to identify branches that requires special arguments and prompt for one:

Screen Shot 2022-02-14 at 11 27 24 AM

This can also be provided directly:

sg ci build docker-images-patch cadvisor

gen-pipeline -docs now also more intelligently skips over branches that requires arguments, though it retains the panic recovery introduced in https://github.com/sourcegraph/sourcegraph/pull/31100 with a note that we should introduce better testing on that front instead of relying on -docs to error out.

Test plan

Unit tests for the argument extraction. Also manual testing, indicated above, e.g. https://buildkite.com/sourcegraph/sourcegraph/builds/131387 which generates the expected pipeline.

Documentation: https://github.com/sourcegraph/handbook/pull/2336

Merge request reports

Loading