Skip to content

Commit

Permalink
Use repository settings from piped config
Browse files Browse the repository at this point in the history
  • Loading branch information
golemiso committed Dec 26, 2023
1 parent 2cbcef3 commit 989d485
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
10 changes: 6 additions & 4 deletions pkg/app/piped/controller/planner.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ func (p *planner) Run(ctx context.Context) error {
p.done.Store(true)
}()

repoCfg := config.PipedRepository{
RepoID: p.deployment.GitPath.Repo.Id,
Remote: p.deployment.GitPath.Repo.Remote,
Branch: p.deployment.GitPath.Repo.Branch,
repoID := p.deployment.GitPath.Repo.Id
repoCfg, ok := p.pipedConfig.GetRepository(repoID)
if !ok {
p.doneDeploymentStatus = model.DeploymentStatus_DEPLOYMENT_FAILURE
reason := fmt.Sprintf("Repository %s was not found in piped configuration", repoID)
return p.reportDeploymentFailed(ctx, reason)
}

in := pln.Input{
Expand Down
10 changes: 6 additions & 4 deletions pkg/app/piped/controller/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ func (s *scheduler) Run(ctx context.Context) error {
)
deploymentStatus = model.DeploymentStatus_DEPLOYMENT_SUCCESS

repoCfg := config.PipedRepository{
RepoID: s.deployment.GitPath.Repo.Id,
Remote: s.deployment.GitPath.Repo.Remote,
Branch: s.deployment.GitPath.Repo.Branch,
repoID := s.deployment.GitPath.Repo.Id
repoCfg, ok := s.pipedConfig.GetRepository(repoID)
if !ok {
deploymentStatus := model.DeploymentStatus_DEPLOYMENT_FAILURE
statusReason := fmt.Sprintf("Repository %s was not found in piped configuration", repoID)
return s.reportDeploymentCompleted(ctx, deploymentStatus, statusReason, "")
}

s.targetDSP = deploysource.NewProvider(
Expand Down
6 changes: 0 additions & 6 deletions pkg/app/piped/planpreview/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,6 @@ func (b *builder) listApplications(repo config.PipedRepository) []*model.Applica
if app.GitPath.Repo.Id != repo.RepoID {
continue
}
if app.GitPath.Repo.Remote != repo.Remote {
continue
}
if app.GitPath.Repo.Branch != repo.Branch {
continue
}
out = append(out, app)
}

Expand Down

0 comments on commit 989d485

Please sign in to comment.