Repository navigation
fix(circleci): collect pipelines when the sync policy has no timeAfter - #9368
Open
ShivamSharma43 wants to merge 1 commit into
Open
ShivamSharma43 wants to merge 1 commit into
ShivamSharma43 wants to merge 1 commit into
Conversation
CollectPipelines dereferenced SyncPolicy().TimeAfter for every pipeline in the response. TimeAfter is nil for advanced mode blueprints, when the start date is cleared, and for directrun without timeAfter, so the response parser panicked and the subtask failed with a nil pointer dereference. Move the response parsing into parsePipelines, keep every pipeline when timeAfter is nil, and check that SyncPolicy() isn't nil before reading it. Closes apache#9367 Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.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
The CircleCI
collectPipelinessubtask failed withruntime error: invalid memory address or nil pointer dereferencewhen the sync policy had notimeAfter.Its response parser stopped at the first pipeline created before the time range:
SyncPolicy.TimeAfteris optional. It isnilfor advanced mode blueprints (config-ui creates them withtimeAfter: undefined), when the start date of a blueprint's time range is cleared, and fordirectrunwithout atimeAfter. The parser then panicked on the first pipeline, the worker scheduler recorded the panic as the task error, and nothing was collected.Changes:
tasks/pipeline_collector.go:parsePipelines(res, timeAfter). With aniltimeAfterit returns every pipeline on the page; otherwise it filters as before.CollectPipelineschecks thatSyncPolicy()isn'tnilbefore readingTimeAfter, like the collector helpers do.tasks/pipeline_collector_test.go(new):parsePipelineskeeps every pipeline without atimeAfter, and stops withErrFinishCollectat the first pipeline before it.Does this close any open issues?
Closes #9367
Screenshots
N/A
Other Information
go test ./plugins/circleci/tasks/: pass. With the old parsing body,TestParsePipelinesWithoutTimeAfterpanics with the nil pointer dereference.go build,go vetandgolangci-lint run ./plugins/circleci/...: clean, andgofmtis clean on the changed files. The circleci e2e tests needE2E_DB_URL, which I didn't run locally; they cover the extractors and converters, not the collectors.createdAfterthroughGetCreated.pr-type/bug-fix.Generated-by:trailer per the ASF generative tooling guidance.🤖 Generated with Claude Code