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

Pipedv1 using auto rollback config from spec.Planner instead #5052

Merged
merged 3 commits into from
Jul 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (ps *PlannerService) QuickSyncPlan(ctx context.Context, in *platform.QuickS
}

return &platform.QuickSyncPlanResponse{
Stages: buildQuickSyncPipeline(*cfg.Input.AutoRollback, now),
Stages: buildQuickSyncPipeline(*cfg.Planner.AutoRollback, now),
}, nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ type DeploymentPlanner struct {
// Disable auto-detecting to use QUICK_SYNC or PROGRESSIVE_SYNC.
// Always use the speficied pipeline for all deployments.
AlwaysUsePipeline bool `json:"alwaysUsePipeline"`
// Automatically reverts all deployment changes on failure.
// Default is true.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
Comment on lines +67 to +69
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[imo] How about adding the comment to explain this is only for the v1 for now? It's because we avoid using it on the current version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add a deprecated note to the Input.AutoRollback 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ffjlabo Done by ebe5f5f

}

type Trigger struct {
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/application_cloudrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type CloudRunDeploymentInput struct {
ServiceManifestFile string `json:"serviceManifestFile"`
// Automatically reverts to the previous state when the deployment is failed.
// Default is true.
//
// Deprecated: Use Planner.AutoRollback instead.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application_cloudrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func TestCloudRunApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: CloudRunDeploymentInput{
AutoRollback: newBoolPointer(true),
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/application_ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ type ECSDeploymentInput struct {
TargetGroups ECSTargetGroups `json:"targetGroups,omitempty"`
// Automatically reverts all changes from all stages when one of them failed.
// Default is true.
//
// Deprecated: Use Planner.AutoRollback instead.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
// Run standalone task during deployment.
// Default is true.
Expand Down
9 changes: 9 additions & 0 deletions pkg/config/application_ecs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func TestECSApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: ECSDeploymentInput{
ServiceDefinitionFile: "/path/to/servicedef.yaml",
Expand Down Expand Up @@ -95,6 +98,9 @@ func TestECSApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: ECSDeploymentInput{
ServiceDefinitionFile: "/path/to/servicedef.yaml",
Expand Down Expand Up @@ -129,6 +135,9 @@ func TestECSApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: ECSDeploymentInput{
ServiceDefinitionFile: "/path/to/servicedef.yaml",
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/application_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ type KubernetesDeploymentInput struct {

// Automatically reverts all deployment changes on failure.
// Default is true.
//
// Deprecated: Use Planner.AutoRollback instead.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`

// Automatically create a new namespace if it does not exist.
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/application_kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestKubernetesApplicationConfig(t *testing.T) {
Description: "application description first string\napplication description second string\n",
Planner: DeploymentPlanner{
AlwaysUsePipeline: true,
AutoRollback: newBoolPointer(true),
},
Pipeline: &DeploymentPipeline{
Stages: []PipelineStage{
Expand Down Expand Up @@ -133,6 +134,9 @@ func TestKubernetesApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: KubernetesDeploymentInput{
AutoRollback: newBoolPointer(true),
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/application_lambda.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type LambdaDeploymentInput struct {
FunctionManifestFile string `json:"functionManifestFile" default:"function.yaml"`
// Automatically reverts all changes from all stages when one of them failed.
// Default is true.
//
// Deprecated: Use Planner.AutoRollback instead.
AutoRollback *bool `json:"autoRollback,omitempty" default:"true"`
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/config/application_lambda_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: LambdaDeploymentInput{
FunctionManifestFile: "function.yaml",
Expand Down Expand Up @@ -104,6 +107,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: LambdaDeploymentInput{
FunctionManifestFile: "function.yaml",
Expand Down Expand Up @@ -145,6 +151,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: LambdaDeploymentInput{
FunctionManifestFile: "function.yaml",
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/application_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type TerraformDeploymentInput struct {
VarFiles []string `json:"varFiles,omitempty"`
// Automatically reverts all changes from all stages when one of them failed.
// Default is false.
//
// Deprecated: Use Planner.AutoRollback instead.
AutoRollback bool `json:"autoRollback"`
// List of additional flags will be used while executing terraform commands.
CommandFlags TerraformCommandFlags `json:"commandFlags"`
Expand Down
15 changes: 15 additions & 0 deletions pkg/config/application_terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: TerraformDeploymentInput{},
},
Expand Down Expand Up @@ -81,6 +84,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: TerraformDeploymentInput{
Workspace: "dev",
Expand Down Expand Up @@ -111,6 +117,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
Encryption: &SecretEncryption{
EncryptedSecrets: map[string]string{
"serviceAccount": "ENCRYPTED_DATA_GENERATED_FROM_WEB",
Expand Down Expand Up @@ -169,6 +178,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: TerraformDeploymentInput{
Workspace: "dev",
Expand Down Expand Up @@ -221,6 +233,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: TerraformDeploymentInput{
Workspace: "dev",
Expand Down
21 changes: 21 additions & 0 deletions pkg/config/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ func TestGenericTriggerConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: KubernetesDeploymentInput{
AutoRollback: newBoolPointer(true),
Expand Down Expand Up @@ -477,6 +480,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: KubernetesDeploymentInput{
AutoRollback: newBoolPointer(true),
Expand Down Expand Up @@ -506,6 +512,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: KubernetesDeploymentInput{
AutoRollback: newBoolPointer(false),
Expand Down Expand Up @@ -535,6 +544,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: KubernetesDeploymentInput{
AutoRollback: newBoolPointer(true),
Expand Down Expand Up @@ -586,6 +598,9 @@ func TestGenericPostSyncConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
PostSync: &PostSync{
DeploymentChain: &DeploymentChain{
ApplicationMatchers: []ChainApplicationMatcher{
Expand Down Expand Up @@ -655,6 +670,9 @@ func TestGenericAnalysisConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
Pipeline: &DeploymentPipeline{
Stages: []PipelineStage{
{
Expand Down Expand Up @@ -790,6 +808,9 @@ func TestCustomSyncConfig(t *testing.T) {
Disabled: newBoolPointer(true),
},
},
Planner: DeploymentPlanner{
AutoRollback: newBoolPointer(true),
},
},
Input: LambdaDeploymentInput{
FunctionManifestFile: "function.yaml",
Expand Down
Loading