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

Disable onChain trigger by default #2932

Merged
merged 1 commit into from Dec 13, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/app/piped/trigger/determiner.go
Expand Up @@ -77,7 +77,7 @@ func NewOnChainDeterminer() *OnChainDeterminer {
}

func (d *OnChainDeterminer) ShouldTrigger(_ context.Context, _ *model.Application, appCfg *config.GenericApplicationSpec) (bool, error) {
if appCfg.Trigger.OnChain.Disabled {
if *appCfg.Trigger.OnChain.Disabled {
return false, nil
}
return true, nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/application.go
Expand Up @@ -110,8 +110,8 @@ type OnOutOfSync struct {
type OnChain struct {
// Whether to exclude application from triggering target
// when received a new CHAIN_SYNC command.
// Default is false.
Disabled bool `json:"disabled,omitempty"`
// Default is true.
Disabled *bool `json:"disabled,omitempty" default:"true"`
}

func (s *GenericApplicationSpec) Validate() error {
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application_cloudrun_test.go
Expand Up @@ -48,6 +48,9 @@ func TestCloudRunApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: CloudRunDeploymentInput{
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application_ecs_test.go
Expand Up @@ -49,6 +49,9 @@ func TestECSApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: ECSDeploymentInput{
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/application_kubernetes_test.go
Expand Up @@ -90,6 +90,9 @@ func TestKubernetesApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: KubernetesDeploymentInput{
Expand Down
9 changes: 9 additions & 0 deletions pkg/config/application_lambda_test.go
Expand Up @@ -50,6 +50,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: LambdaDeploymentInput{
Expand Down Expand Up @@ -97,6 +100,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: LambdaDeploymentInput{
Expand Down Expand Up @@ -135,6 +141,9 @@ func TestLambdaApplicationConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: LambdaDeploymentInput{
Expand Down
12 changes: 12 additions & 0 deletions pkg/config/application_terraform_test.go
Expand Up @@ -50,6 +50,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: TerraformDeploymentInput{},
Expand All @@ -74,6 +77,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: TerraformDeploymentInput{
Expand Down Expand Up @@ -101,6 +107,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(false),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
Encryption: &SecretEncryption{
EncryptedSecrets: map[string]string{
Expand Down Expand Up @@ -157,6 +166,9 @@ func TestTerraformApplicationtConfig(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: TerraformDeploymentInput{
Expand Down
15 changes: 15 additions & 0 deletions pkg/config/application_test.go
Expand Up @@ -308,6 +308,9 @@ func TestGenericTriggerConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: KubernetesDeploymentInput{
Expand Down Expand Up @@ -350,6 +353,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: KubernetesDeploymentInput{
Expand All @@ -370,6 +376,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(false),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: KubernetesDeploymentInput{
Expand All @@ -390,6 +399,9 @@ func TestTrueByDefaultBoolConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
},
Input: KubernetesDeploymentInput{
Expand Down Expand Up @@ -432,6 +444,9 @@ func TestGenericPostSyncConfiguration(t *testing.T) {
Disabled: newBoolPointer(true),
MinWindow: Duration(5 * time.Minute),
},
OnChain: OnChain{
Disabled: newBoolPointer(true),
},
},
PostSync: &PostSync{
DeploymentChain: &DeploymentChain{
Expand Down