Skip to content

Commit

Permalink
fix: specify isRollback since deployment.Status is always Planned
Browse files Browse the repository at this point in the history
Signed-off-by: t-kikuc <tkikuchi07f@gmail.com>
  • Loading branch information
t-kikuc committed Dec 27, 2024
1 parent b6faf9b commit df5a70c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/app/piped/executor/kubernetes/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (e *rollbackExecutor) ensureScriptRunRollback(ctx context.Context) model.St
}
}

ci := scriptrun.NewContextInfo(e.Deployment)
ci := scriptrun.NewContextInfo(e.Deployment, true)

Check warning on line 217 in pkg/app/piped/executor/kubernetes/rollback.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/executor/kubernetes/rollback.go#L217

Added line #L217 was not covered by tests
ciEnv, err := ci.BuildEnv()
if err != nil {
e.LogPersister.Errorf("failed to build srcipt run context info: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/app/piped/executor/scriptrun/scriptrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (e *Executor) executeCommand() model.StageStatus {
}
}

ci := NewContextInfo(e.Deployment)
ci := NewContextInfo(e.Deployment, false)
ciEnv, err := ci.BuildEnv()
if err != nil {
e.LogPersister.Errorf("failed to build srcipt run context info: %w", err)
Expand Down Expand Up @@ -144,7 +144,7 @@ type ContextInfo struct {
}

// NewContextInfo creates a new ContextInfo from the given deployment.
func NewContextInfo(d *model.Deployment) *ContextInfo {
func NewContextInfo(d *model.Deployment, isRollback bool) *ContextInfo {
return &ContextInfo{
DeploymentID: d.Id,
ApplicationID: d.ApplicationId,
Expand All @@ -155,7 +155,7 @@ func NewContextInfo(d *model.Deployment) *ContextInfo {
RepositoryURL: d.GitPath.Repo.Remote,
Summary: d.Summary,
Labels: d.Labels,
IsRollback: d.Status == model.DeploymentStatus_DEPLOYMENT_ROLLING_BACK,
IsRollback: isRollback,

Check warning on line 158 in pkg/app/piped/executor/scriptrun/scriptrun.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/piped/executor/scriptrun/scriptrun.go#L158

Added line #L158 was not covered by tests
}
}

Expand Down

0 comments on commit df5a70c

Please sign in to comment.