diff --git a/pkg/registry/apis/provisioning/jobs/pullrequest.go b/pkg/registry/apis/provisioning/jobs/pullrequest/worker.go similarity index 98% rename from pkg/registry/apis/provisioning/jobs/pullrequest.go rename to pkg/registry/apis/provisioning/jobs/pullrequest/worker.go index 476a6bb70c6..2debd9e3a88 100644 --- a/pkg/registry/apis/provisioning/jobs/pullrequest.go +++ b/pkg/registry/apis/provisioning/jobs/pullrequest/worker.go @@ -1,4 +1,4 @@ -package jobs +package pullrequest import ( "bytes" @@ -17,7 +17,7 @@ import ( ) type PullRequestWorker interface { - ProcessPullRequest(ctx context.Context, + Process(ctx context.Context, repo repository.Repository, options provisioning.PullRequestJobOptions, progress func(provisioning.JobStatus) error, @@ -83,7 +83,7 @@ type pullRequestCommenter struct { renderer PreviewRenderer } -func NewPullRequestCommenter( +func NewPullRequestWorker( repo PullRequestRepo, parser *resources.Parser, renderer PreviewRenderer, @@ -108,7 +108,7 @@ func NewPullRequestCommenter( }, nil } -func (c *pullRequestCommenter) ProcessPullRequest(ctx context.Context, +func (c *pullRequestCommenter) Process(ctx context.Context, repo repository.Repository, options provisioning.PullRequestJobOptions, progress func(provisioning.JobStatus) error, diff --git a/pkg/registry/apis/provisioning/jobs/worker.go b/pkg/registry/apis/provisioning/jobs/worker.go index a10941ae329..43cfb49b4f0 100644 --- a/pkg/registry/apis/provisioning/jobs/worker.go +++ b/pkg/registry/apis/provisioning/jobs/worker.go @@ -13,6 +13,7 @@ import ( provisioning "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1" "github.com/grafana/grafana/pkg/registry/apis/provisioning/auth" "github.com/grafana/grafana/pkg/registry/apis/provisioning/jobs/export" + "github.com/grafana/grafana/pkg/registry/apis/provisioning/jobs/pullrequest" "github.com/grafana/grafana/pkg/registry/apis/provisioning/repository" "github.com/grafana/grafana/pkg/registry/apis/provisioning/resources" "github.com/grafana/grafana/pkg/services/rendering" @@ -98,7 +99,7 @@ func (g *JobWorker) Process(ctx context.Context, job provisioning.Job, progress case provisioning.JobActionSync: return g.syncWorker.Process(ctx, repo, job, progress) case provisioning.JobActionPullRequest: - prRepo, ok := repo.(PullRequestRepo) + prRepo, ok := repo.(pullrequest.PullRequestRepo) if !ok { return nil, fmt.Errorf("repository is not a github repository") } @@ -121,11 +122,11 @@ func (g *JobWorker) Process(ctx context.Context, job provisioning.Job, progress return nil, apierrors.NewBadRequest("missing spec.pr") } - commenter, err := NewPullRequestCommenter(prRepo, parser, renderer, baseURL) + commenter, err := pullrequest.NewPullRequestWorker(prRepo, parser, renderer, baseURL) if err != nil { return nil, fmt.Errorf("error creating pull request commenter: %w", err) } - return commenter.ProcessPullRequest(ctx, repo, *options, progress) + return commenter.Process(ctx, repo, *options, progress) case provisioning.JobActionExport: if job.Spec.Export == nil {