Skip to content

a8n: Implement `previewCampaignPlan`

Warren Gifford requested to merge a8n/preview-campaign into master

Created by: mrnugget

This is part of https://github.com/sourcegraph/sourcegraph/issues/6085 and implements the GraphQL previewCampaign mutation.

It validates arguments, creates a CampaignPlan and multiple CampaignJobs (one for each repo yielded by the CampaignTypes search query).

The single CampaignType that's currently implemented is "comby", which does search&replace across repositories.

What's in this PR already works: a plan is created, jobs are launched, executed and their Diff field is updated.

There are a few things missing that I want to address in follow-up PRs in order to make reviewing easier and to unblock @felixfbecker and @eseliger:

  • See comment below The diff produced by reading json-lines from the replacer service is not a valid multi-file diff. While it can be parsed again by diff.ParseMultiFile the produced []*diff.FileDiff only has a single element. That's enough to use the API for now, which is why I don't want it to block the merging of this PR. I will address this in a separate PR that also adds tests for comby (which right now only does a single HTTP request which we likely need to change)
  • CampaignPlans are not cleaned up yet. I already discussed this with @tsenart.
  • The CampaignPlan.status is still a dummy implementation.

Merge request reports

Loading