Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {
// Redirect /docs/ to /docs-{latest-version}/
mux.HandleFunc("/docs/", func(w http.ResponseWriter, r *http.Request) {
latestPattern := strings.Replace(r.URL.Path, "/docs/", latestPath, 1)
http.Redirect(w, r, latestPattern, 307)
http.Redirect(w, r, latestPattern, http.StatusTemporaryRedirect)
})

defer func() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/app/piped/executor/analysis/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ func (e *Executor) Execute(sig executor.StopSignal) model.StageStatus {
})
}
// Run analyses with http providers.
for i := range options.Https {
analyzer, err := e.newAnalyzerForHTTP(i, &options.Https[i], templateCfg)
for i := range options.HTTPS {
analyzer, err := e.newAnalyzerForHTTP(i, &options.HTTPS[i], templateCfg)
if err != nil {
e.LogPersister.Errorf("Failed to spawn analyzer for HTTP: %v", err)
return model.StageStatus_STAGE_FAILURE
Expand Down Expand Up @@ -312,7 +312,7 @@ func (e *Executor) getHTTPConfig(templatableCfg *config.TemplatableAnalysisHTTP,
return &templatableCfg.AnalysisHTTP, nil
}

cfg, ok := templateCfg.HTTPs[name]
cfg, ok := templateCfg.HTTPS[name]
if !ok {
return nil, fmt.Errorf("analysis template %s not found despite template specified", name)
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/app/piped/planner/cloudrun/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
)

for i, s := range stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -58,7 +58,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -79,7 +79,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
)

for i, s := range pp.Stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -105,7 +105,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand Down
8 changes: 4 additions & 4 deletions pkg/app/piped/planner/ecs/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
)

for i, s := range stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -58,7 +58,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -79,7 +79,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
)

for i, s := range pp.Stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -105,7 +105,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand Down
8 changes: 4 additions & 4 deletions pkg/app/piped/planner/kubernetes/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
)

for i, s := range stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -58,7 +58,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -79,7 +79,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
)

for i, s := range pp.Stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -105,7 +105,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand Down
10 changes: 5 additions & 5 deletions pkg/app/piped/planner/lambda/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
)

for i, s := range stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -58,7 +58,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -80,7 +80,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,

shouldRollbackCustomSync := false
for i, s := range pp.Stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
if shouldRollbackCustomSync {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageCustomSyncRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -122,7 +122,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
} else {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand Down
14 changes: 7 additions & 7 deletions pkg/app/piped/planner/predefined_stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,37 @@ const (

var predefinedStages = map[string]config.PipelineStage{
PredefinedStageK8sSync: {
Id: PredefinedStageK8sSync,
ID: PredefinedStageK8sSync,
Name: model.StageK8sSync,
Desc: "Sync by applying all manifests",
},
PredefinedStageTerraformSync: {
Id: PredefinedStageTerraformSync,
ID: PredefinedStageTerraformSync,
Name: model.StageTerraformSync,
Desc: "Sync by automatically applying any detected changes",
},
PredefinedStageCloudRunSync: {
Id: PredefinedStageCloudRunSync,
ID: PredefinedStageCloudRunSync,
Name: model.StageCloudRunSync,
Desc: "Deploy the new version and configure all traffic to it",
},
PredefinedStageLambdaSync: {
Id: PredefinedStageLambdaSync,
ID: PredefinedStageLambdaSync,
Name: model.StageLambdaSync,
Desc: "Deploy the new version and configure all traffic to it",
},
PredefinedStageECSSync: {
Id: PredefinedStageECSSync,
ID: PredefinedStageECSSync,
Name: model.StageECSSync,
Desc: "Deploy the new version and configure all traffic to it",
},
PredefinedStageRollback: {
Id: PredefinedStageRollback,
ID: PredefinedStageRollback,
Name: model.StageRollback,
Desc: "Rollback the deployment",
},
PredefinedStageCustomSyncRollback: {
Id: PredefinedStageCustomSyncRollback,
ID: PredefinedStageCustomSyncRollback,
Name: model.StageCustomSyncRollback,
Desc: "Rollback the custom stages",
},
Expand Down
8 changes: 4 additions & 4 deletions pkg/app/piped/planner/terraform/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
)

// Append SYNC stage.
id := s.Id
id := s.ID
if id == "" {
id = "stage-0"
}
Expand All @@ -52,7 +52,7 @@ func buildQuickSyncPipeline(autoRollback bool, now time.Time) []*model.PipelineS
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand All @@ -73,7 +73,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
)

for i, s := range pp.Stages {
id := s.Id
id := s.ID
if id == "" {
id = fmt.Sprintf("stage-%d", i)
}
Expand All @@ -99,7 +99,7 @@ func buildProgressivePipeline(pp *config.DeploymentPipeline, autoRollback bool,
if autoRollback {
s, _ := planner.GetPredefinedStage(planner.PredefinedStageRollback)
out = append(out, &model.PipelineStage{
Id: s.Id,
Id: s.ID,
Name: s.Name.String(),
Desc: s.Desc,
Predefined: true,
Expand Down
8 changes: 4 additions & 4 deletions pkg/app/piped/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ func (t *Trigger) checkCandidates(ctx context.Context, cs []candidate) (err erro
// Group candidates by repository to reduce the number of Git operations on each repo.
csm := make(map[string][]candidate)
for _, c := range cs {
repoId := c.application.GitPath.Repo.Id
if _, ok := csm[repoId]; !ok {
csm[repoId] = []candidate{c}
repoID := c.application.GitPath.Repo.Id
if _, ok := csm[repoID]; !ok {
csm[repoID] = []candidate{c}
continue
}
csm[repoId] = append(csm[repoId], c)
csm[repoID] = append(csm[repoID], c)
}

// Iterate each repository and check its candidates.
Expand Down
20 changes: 10 additions & 10 deletions pkg/app/server/grpcapi/piped_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/pipe-cd/pipecd/pkg/rpc/rpcauth"
)

type pipedApiApplicationStore interface {
type pipedAPIApplicationStore interface {
Get(ctx context.Context, id string) (*model.Application, error)
List(ctx context.Context, opts datastore.ListOptions) ([]*model.Application, string, error)
UpdateSyncState(ctx context.Context, id string, state *model.ApplicationSyncState) error
Expand All @@ -51,7 +51,7 @@ type pipedApiApplicationStore interface {
UpdateMostRecentDeployment(ctx context.Context, id string, status model.DeploymentStatus, d *model.ApplicationDeploymentReference) error
}

type pipedApiDeploymentStore interface {
type pipedAPIDeploymentStore interface {
Add(ctx context.Context, app *model.Deployment) error
Get(ctx context.Context, id string) (*model.Deployment, error)
List(ctx context.Context, opts datastore.ListOptions) ([]*model.Deployment, string, error)
Expand All @@ -63,17 +63,17 @@ type pipedApiDeploymentStore interface {
UpdateStageMetadata(ctx context.Context, deploymentID, stageID string, metadata map[string]string) error
}

type pipedApiDeploymentChainStore interface {
type pipedAPIDeploymentChainStore interface {
Add(ctx context.Context, d *model.DeploymentChain) error
Get(ctx context.Context, id string) (*model.DeploymentChain, error)
}

type pipedApiPipedStore interface {
type pipedAPIPipedStore interface {
Get(ctx context.Context, id string) (*model.Piped, error)
UpdateMetadata(ctx context.Context, id, version, config string, pps []*model.Piped_PlatformProvider, repos []*model.ApplicationGitRepository, se *model.Piped_SecretEncryption, startedAt int64) error
}

type pipedApiEventStore interface {
type pipedAPIEventStore interface {
List(ctx context.Context, opts datastore.ListOptions) ([]*model.Event, string, error)
UpdateStatus(ctx context.Context, eventID string, status model.EventStatus, statusDescription string) error
}
Expand All @@ -86,11 +86,11 @@ type commandOutputPutter interface {
type PipedAPI struct {
pipedservice.UnimplementedPipedServiceServer

applicationStore pipedApiApplicationStore
deploymentStore pipedApiDeploymentStore
deploymentChainStore pipedApiDeploymentChainStore
pipedStore pipedApiPipedStore
eventStore pipedApiEventStore
applicationStore pipedAPIApplicationStore
deploymentStore pipedAPIDeploymentStore
deploymentChainStore pipedAPIDeploymentChainStore
pipedStore pipedAPIPipedStore
eventStore pipedAPIEventStore
stageLogStore stagelogstore.Store
applicationLiveStateStore applicationlivestatestore.Store
analysisResultStore analysisresultstore.Store
Expand Down
Loading