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 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
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
}

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

Check warning on line 111 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#L111

Added line #L111 was not covered by tests
}, 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
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
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
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
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
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