feat(pipeline): add search command#1269
Open
schurchleycci wants to merge 2 commits intonextfrom
Open
Conversation
9109194 to
6c71211
Compare
Wraps POST /pipeline/search with structured shorthand flags (--branch, --actor, --state) and a --filter escape hatch for raw expressions. Adds FlexTime to handle empty timestamp strings the search endpoint returns on early-lifecycle pipelines, scoped to SearchPipeline only. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6c71211 to
915a025
Compare
SearchPipelines treated len(all) >= limit as a stop condition without guarding for non-positive limit, so --limit -5 panicked on all[:-5] and --limit 0 returned an empty slice masking real results. Match the ListPipelines guard, and reject non-positive --limit at the cmd layer with ExitBadArguments so the contract is explicit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
circleci pipeline searchwrappingPOST /api/v2/pipeline/search. Takes a raw filter expression via--filterplus--after/--beforefor date scoping. For simple branch filtering usecircleci pipeline list; this command is the door to the filter-expression API.apiclient.FlexTimeso JSON decoding tolerates the empty timestamp strings the search endpoint returns on some pipelines.CircleCIserver with a/pipeline/searchhandler that records the most recent request body so tests can assert the filter passes through unchanged.Notes
--projectselects the project (slug likegh/org/repo) and defaults to the current git remote, matching the rest of thepipelinegroup.actor.idrequires a UUID, not a login. Called out inLong.--after/--beforeare omitted, the API applies its own ~2-week default window. Documented inLong.Test plan
task buildsucceedstask lintclean (only the pre-existinggosecfinding ininternal/iostream/drain_bsd.goremains, unrelated to this PR)go test -count=1 ./...)gh/CircleCI-Public/circleci-cli: default search,--filter 'pipeline.git.branch == "next"',pipeline.git.branch starts-with "feat/",--after,--json --jqTestPipelineSearch— golden table outputTestPipelineSearch_JSON— golden JSON outputTestPipelineSearch_WithFilter— raw filter passes through unchangedTestPipelineSearch_EmptyTimestamp— verifiesFlexTimehandles the empty-stringcreated_at/updated_atthe API returnsTestPipelineSearch_EmptyResults— empty result path🤖 Generated with Claude Code