chore: Upgraded Snake YAML version to 2.0 (#23572)

## Description
Upgrades SnakeYaml dependency version forcefully to 2.0 to overcome
[this
issue](https://github.com/spring-projects/spring-boot/issues/33457), as
advised
[here](https://github.com/spring-projects/spring-boot/issues/34405#issuecomment-1450280581).

This version tag can be reverted when we upgrade to Spring 6.1, which is
when the library
[aims](https://github.com/spring-projects/spring-framework/pull/30048#issuecomment-1555194087)
to upgrade the version themselves.

Fixes https://github.com/appsmithorg/appsmith-ee/issues/1233

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing
This PR will be tested during regression.

---------

Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
This commit is contained in:
Nidhi 2023-06-08 12:48:38 +05:30 committed by GitHub
parent 51aa3b5406
commit 6e7c29355f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 69 additions and 105 deletions

View File

@ -16,7 +16,7 @@
<description>This is the API server for the Appsmith project</description>
<properties>
<ff4j.version>1.9</ff4j.version>
<ff4j.version>2.0.0</ff4j.version>
<org.modelmapper.version>2.4.4</org.modelmapper.version>
<jmh.version>1.35</jmh.version>
</properties>
@ -361,11 +361,6 @@
<artifactId>ff4j-core</artifactId>
<version>${ff4j.version}</version>
</dependency>
<dependency>
<groupId>org.ff4j</groupId>
<artifactId>ff4j-config-yaml</artifactId>
<version>${ff4j.version}</version>
</dependency>
<dependency>
<groupId>com.appsmith</groupId>
<artifactId>reactiveCaching</artifactId>

View File

@ -1,7 +1,7 @@
package com.appsmith.server.configurations;
import org.ff4j.FF4j;
import org.ff4j.parser.yaml.YamlParser;
import org.ff4j.conf.XmlParser;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -10,7 +10,7 @@ public class FeatureFlagConfig {
@Bean
public FF4j ff4j() {
return new FF4j(new YamlParser(), "features/init-flags.yml")
return new FF4j(new XmlParser(), "features/init-flags.xml")
.audit(true)
.autoCreate(true);
}

View File

@ -6,10 +6,10 @@ import org.ff4j.strategy.time.OfficeHourStrategy;
/**
* This enum lists all the feature flags available along with their flipping strategy.
* In order to create a new feature flag, create another enum entry and add the same string to {@link features/init-flags.yml}
* In order to create a new feature flag, create another enum entry and add the same string to {@link features/init-flags.xml}
* <p>
* If you wish to define a custom flipping strategy, define a class that implements {@link FlippingStrategy} and
* ensure that you've mentioned this custom class when defining the feature in {@link features/init-flags.yml}
* ensure that you've mentioned this custom class when defining the feature in {@link features/init-flags.xml}
* <p>
* The feature flag implementation class should extend an existing feature flag implementation like {@link PonderationStrategy},
* {@link OfficeHourStrategy} etc. These default classes provide a lot of basic functionality out of the box.

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ff4j>
<autocreate>false</autocreate>
<audit>false</audit>
<features>
<feature uid="DATASOURCE_ENVIRONMENTS" enable="true"
description="Introducing multiple execution environments for datasources">
<flipstrategy class="com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy">
<param name="emails"
value="me-eng1@appsmith.com,me-eng2@appsmith.com,me-qa1@appsmith.com,me-qa2@appsmith.com,me-demo@appsmith.com"/>
</flipstrategy>
</feature>
<feature uid="MULTIPLE_PANES" enable="true" description="Have multiple panes in the Appsmith IDE">
<flipstrategy class="com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy">
<param name="emails" value="multipanes@appsmith.com,ndx@appsmith.com"/>
</flipstrategy>
</feature>
<feature uid="AUTO_LAYOUT" enable="true" description="Enable auto layout editor for everyone">
<flipstrategy class="org.ff4j.strategy.PonderationStrategy">
<param name="weight" value="1"/>
</flipstrategy>
</feature>
<feature uid="APP_NAVIGATION_LOGO_UPLOAD" enable="true"
description="Logo upload feature for app viewer navigation">
<flipstrategy class="com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy">
<param name="emailDomains" value="appsmith.com,moolya.com"/>
</flipstrategy>
</feature>
<feature uid="ONE_CLICK_BINDING" enable="true"
description="Show property controls to generate queries for table widget with just clicks">
<flipstrategy class="com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy">
<param name="emails" value="balaji@appsmith.com,vamsi@appsmith.com"/>
</flipstrategy>
</feature>
</features>
</ff4j>

View File

@ -1,56 +0,0 @@
# Check sample file at: https://github.com/ff4j/ff4j-samples/blob/master/spring-boot-2x/ff4j-sample-springboot2x/src/main/resources/ff4j-init-dataset.yml
# -----------------------------
# Core FF4J
# -----------------------------
ff4j:
autocreate: false
audit: false
features:
- uid: DATASOURCE_ENVIRONMENTS
enable: true
description: Introducing multiple execution environments for datasources
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emails
value: me-eng1@appsmith.com,me-eng2@appsmith.com,me-qa1@appsmith.com,me-qa2@appsmith.com,me-demo@appsmith.com
- uid: MULTIPLE_PANES
enable: true
description: Have multiple panes in the Appsmith IDE
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emails
value: multipanes@appsmith.com,ndx@appsmith.com
- uid: AUTO_LAYOUT
enable: true
description: Enable auto layout editor for everyone
flipstrategy:
class: org.ff4j.strategy.PonderationStrategy
param:
- name: weight
value: 1
- uid: APP_NAVIGATION_LOGO_UPLOAD
enable: true
description: Logo upload feature for app viewer navigation
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emailDomains
value: appsmith.com,moolya.com
# Put EE flags below this line, to avoid conflicts.
- uid: ONE_CLICK_BINDING
enable: true
description: Show property controls to generate queries for table widget with just clicks
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emails
value: balaji@appsmith.com,vamsi@appsmith.com

View File

@ -3,7 +3,7 @@ package com.appsmith.server.services;
import com.appsmith.server.featureflags.FeatureFlagEnum;
import lombok.extern.slf4j.Slf4j;
import org.ff4j.FF4j;
import org.ff4j.parser.yaml.YamlParser;
import org.ff4j.conf.XmlParser;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -86,7 +86,7 @@ public class FeatureFlagServiceTest {
@Bean
FF4j ff4j() {
FF4j ff4j = new FF4j(new YamlParser(), "features/init-flags-test.yml")
FF4j ff4j = new FF4j(new XmlParser(), "features/init-flags-test.xml")
.audit(true)
.autoCreate(false);
return ff4j;

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ff4j>
<autocreate>false</autocreate>
<audit>false</audit>
<features>
<feature uid="TEST_FEATURE_1" enable="true"
description="The test feature should only be visible to Appsmith users">
<flipstrategy class="com.appsmith.server.featureflags.strategies.AppsmithUserStrategy">
<param name="requiredKey" value="requiredValue"/>
</flipstrategy>
</feature>
<feature uid="TEST_FEATURE_2" enable="true" description="Enable this feature based on weight. It's randomized.">
<flipstrategy class="org.ff4j.strategy.PonderationStrategy">
<param name="weight" value="1"/>
</flipstrategy>
</feature>
<feature uid="TEST_FEATURE_3" enable="true"
description="The test feature should only be visible to certain users">
<flipstrategy class="com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy">
<param name="emailDomains" value="test@example.com"/>
</flipstrategy>
</feature>
</features>
</ff4j>

View File

@ -1,37 +0,0 @@
# Check sample file at: https://github.com/ff4j/ff4j-samples/blob/master/spring-boot-2x/ff4j-sample-springboot2x/src/main/resources/ff4j-init-dataset.yml
# -----------------------------
# Core FF4J configuration for testing. DO NOT USE THIS IN PRODUCTION
# -----------------------------
ff4j:
autocreate: false
audit: false
features:
- uid: TEST_FEATURE_1
enable: true
description: The test feature should only be visible to Appsmith users
flipstrategy:
class: com.appsmith.server.featureflags.strategies.AppsmithUserStrategy
param:
- name: requiredKey
value: requiredValue
- uid: TEST_FEATURE_2
enable: true
description: Enable this feature based on weight. It's randomized.
flipstrategy:
class: org.ff4j.strategy.PonderationStrategy
param:
- name: weight
value: 1
- uid: TEST_FEATURE_3
enable: true
description: The test feature should only be visible to certain users
flipstrategy:
class: com.appsmith.server.featureflags.strategies.EmailBasedRolloutStrategy
param:
- name: emailDomains
value: test@example.com

View File

@ -35,6 +35,8 @@
<reactor-test.version>3.5.1</reactor-test.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<!-- We're forcing this version temporarily to fix CVE-2022-1471-->
<snakeyaml.version>2.0</snakeyaml.version>
</properties>
<build>