diff --git a/pkg/app/pipedv1/controller/scheduler.go b/pkg/app/pipedv1/controller/scheduler.go index 5218bb16ba..0697f30a4f 100644 --- a/pkg/app/pipedv1/controller/scheduler.go +++ b/pkg/app/pipedv1/controller/scheduler.go @@ -255,7 +255,7 @@ func (s *scheduler) Run(ctx context.Context) error { *s.deployment.GitPath, nil, ) - ds, err := configDSP.GetReadOnly(ctx, io.Discard) + ds, err := configDSP.Get(ctx, io.Discard) if err != nil { deploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE statusReason = fmt.Sprintf("Unable to prepare application configuration source data at target commit (%v)", err) diff --git a/pkg/app/pipedv1/deploysource/deploysource.go b/pkg/app/pipedv1/deploysource/deploysource.go index ed14093465..ffeec4250b 100644 --- a/pkg/app/pipedv1/deploysource/deploysource.go +++ b/pkg/app/pipedv1/deploysource/deploysource.go @@ -39,7 +39,6 @@ type DeploySource struct { type Provider interface { Revision() string Get(ctx context.Context, logWriter io.Writer) (*DeploySource, error) - GetReadOnly(ctx context.Context, logWriter io.Writer) (*DeploySource, error) } type secretDecrypter interface { @@ -106,25 +105,6 @@ func (p *provider) Get(ctx context.Context, lw io.Writer) (*DeploySource, error) return ds, nil } -func (p *provider) GetReadOnly(ctx context.Context, lw io.Writer) (*DeploySource, error) { - fmt.Fprintf(lw, "Preparing deploy source at %s commit (%s)\n", p.revisionName, p.revision) - - p.mu.Lock() - defer p.mu.Unlock() - - if !p.done { - p.source, p.err = p.prepare(ctx, lw) - p.done = true - } - - if p.err != nil { - return nil, p.err - } - - fmt.Fprintf(lw, "Successfully prepared deploy source at %s commit (%s)\n", p.revisionName, p.revision) - return p.source, nil -} - func (p *provider) prepare(ctx context.Context, lw io.Writer) (*DeploySource, error) { // Ensure the existence of the working directory. if err := os.MkdirAll(p.workingDir, 0700); err != nil { diff --git a/pkg/app/pipedv1/executor/cloudrun/deploy.go b/pkg/app/pipedv1/executor/cloudrun/deploy.go index 6c376ef529..a5acd0e12d 100644 --- a/pkg/app/pipedv1/executor/cloudrun/deploy.go +++ b/pkg/app/pipedv1/executor/cloudrun/deploy.go @@ -44,7 +44,7 @@ type deployExecutor struct { func (e *deployExecutor) Execute(sig executor.StopSignal) model.StageStatus { ctx := sig.Context() - ds, err := e.TargetDSP.GetReadOnly(ctx, e.LogPersister) + ds, err := e.TargetDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE @@ -152,7 +152,7 @@ func (e *deployExecutor) ensurePromote(ctx context.Context) model.StageStatus { return model.StageStatus_STAGE_FAILURE } - runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister) + runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/executor/cloudrun/rollback.go b/pkg/app/pipedv1/executor/cloudrun/rollback.go index 934ad2e99e..3b7edb7b57 100644 --- a/pkg/app/pipedv1/executor/cloudrun/rollback.go +++ b/pkg/app/pipedv1/executor/cloudrun/rollback.go @@ -65,7 +65,7 @@ func (e *rollbackExecutor) ensureRollback(ctx context.Context) model.StageStatus return model.StageStatus_STAGE_FAILURE } - runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister) + runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/executor/ecs/deploy.go b/pkg/app/pipedv1/executor/ecs/deploy.go index 08c4f1730e..4f93de0435 100644 --- a/pkg/app/pipedv1/executor/ecs/deploy.go +++ b/pkg/app/pipedv1/executor/ecs/deploy.go @@ -36,7 +36,7 @@ type deployExecutor struct { func (e *deployExecutor) Execute(sig executor.StopSignal) model.StageStatus { ctx := sig.Context() - ds, err := e.TargetDSP.GetReadOnly(ctx, e.LogPersister) + ds, err := e.TargetDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/executor/ecs/rollback.go b/pkg/app/pipedv1/executor/ecs/rollback.go index 106f3f1521..32e7c6f106 100644 --- a/pkg/app/pipedv1/executor/ecs/rollback.go +++ b/pkg/app/pipedv1/executor/ecs/rollback.go @@ -56,7 +56,7 @@ func (e *rollbackExecutor) ensureRollback(ctx context.Context) model.StageStatus return model.StageStatus_STAGE_FAILURE } - runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister) + runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/executor/lambda/deploy.go b/pkg/app/pipedv1/executor/lambda/deploy.go index e0b0636223..23724fddf7 100644 --- a/pkg/app/pipedv1/executor/lambda/deploy.go +++ b/pkg/app/pipedv1/executor/lambda/deploy.go @@ -39,7 +39,7 @@ type deployExecutor struct { func (e *deployExecutor) Execute(sig executor.StopSignal) model.StageStatus { ctx := sig.Context() - ds, err := e.TargetDSP.GetReadOnly(ctx, e.LogPersister) + ds, err := e.TargetDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/executor/lambda/rollback.go b/pkg/app/pipedv1/executor/lambda/rollback.go index b2f4433d67..84e44f467a 100644 --- a/pkg/app/pipedv1/executor/lambda/rollback.go +++ b/pkg/app/pipedv1/executor/lambda/rollback.go @@ -53,7 +53,7 @@ func (e *rollbackExecutor) ensureRollback(ctx context.Context) model.StageStatus return model.StageStatus_STAGE_FAILURE } - runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister) + runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister) if err != nil { e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err) return model.StageStatus_STAGE_FAILURE diff --git a/pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go b/pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go index 31e1e0628c..83fb389452 100644 --- a/pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go +++ b/pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go @@ -97,7 +97,7 @@ func (ps *PlannerService) QuickSyncPlan(ctx context.Context, in *platform.QuickS ps.Decrypter, ) - ds, err := p.GetReadOnly(ctx, io.Discard /* TODO */) + ds, err := p.Get(ctx, io.Discard /* TODO */) if err != nil { return nil, err }