Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GetReadOnly from deploysource.Provider interface #5048

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/controller/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
*s.deployment.GitPath,
nil,
)
ds, err := configDSP.GetReadOnly(ctx, io.Discard)
ds, err := configDSP.Get(ctx, io.Discard)

Check warning on line 258 in pkg/app/pipedv1/controller/scheduler.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/controller/scheduler.go#L258

Added line #L258 was not covered by tests
if err != nil {
deploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE
statusReason = fmt.Sprintf("Unable to prepare application configuration source data at target commit (%v)", err)
Expand Down
20 changes: 0 additions & 20 deletions pkg/app/pipedv1/deploysource/deploysource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/app/pipedv1/executor/cloudrun/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

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)

Check warning on line 47 in pkg/app/pipedv1/executor/cloudrun/deploy.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/cloudrun/deploy.go#L47

Added line #L47 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down Expand Up @@ -152,7 +152,7 @@
return model.StageStatus_STAGE_FAILURE
}

runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister)
runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister)

Check warning on line 155 in pkg/app/pipedv1/executor/cloudrun/deploy.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/cloudrun/deploy.go#L155

Added line #L155 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/executor/cloudrun/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
return model.StageStatus_STAGE_FAILURE
}

runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister)
runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister)

Check warning on line 68 in pkg/app/pipedv1/executor/cloudrun/rollback.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/cloudrun/rollback.go#L68

Added line #L68 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/executor/ecs/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

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)

Check warning on line 39 in pkg/app/pipedv1/executor/ecs/deploy.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/ecs/deploy.go#L39

Added line #L39 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/executor/ecs/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
return model.StageStatus_STAGE_FAILURE
}

runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister)
runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister)

Check warning on line 59 in pkg/app/pipedv1/executor/ecs/rollback.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/ecs/rollback.go#L59

Added line #L59 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/executor/lambda/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

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)

Check warning on line 42 in pkg/app/pipedv1/executor/lambda/deploy.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/lambda/deploy.go#L42

Added line #L42 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare target deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/pipedv1/executor/lambda/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
return model.StageStatus_STAGE_FAILURE
}

runningDS, err := e.RunningDSP.GetReadOnly(ctx, e.LogPersister)
runningDS, err := e.RunningDSP.Get(ctx, e.LogPersister)

Check warning on line 56 in pkg/app/pipedv1/executor/lambda/rollback.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/executor/lambda/rollback.go#L56

Added line #L56 was not covered by tests
if err != nil {
e.LogPersister.Errorf("Failed to prepare running deploy source data (%v)", err)
return model.StageStatus_STAGE_FAILURE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
ps.Decrypter,
)

ds, err := p.GetReadOnly(ctx, io.Discard /* TODO */)
ds, err := p.Get(ctx, io.Discard /* TODO */)

Check warning on line 100 in pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/plugin/platform/kubernetes/planner/server.go#L100

Added line #L100 was not covered by tests
if err != nil {
return nil, err
}
Expand Down
Loading