-
Notifications
You must be signed in to change notification settings - Fork 668
Fetch Feature Flag with call to Feature Flag Gateway Api #6398
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
base: main
Are you sure you want to change the base?
Conversation
ee6339b to
0583fce
Compare
980cd8c to
7102dbb
Compare
7102dbb to
08bcc34
Compare
| package featureflaggateway | ||
|
|
||
| // FeatureFlagRequest request body for feature flag request. | ||
| type FeatureFlagRequest struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider moving these classes to the pkg folder in the feature-flag-gateway repo so they can be reused wherever this service is used.
chore:[CSENG-68] correct ffg path in fake server chore:[CSENG-68] update ffg hidden end point chore: [CSENG-68] plug in ffg call chore: [CSENG-68] update package chore: [CSENG-68] correct org chore: code tidy for CSENG-68 chore: update to use makeRequest chore: update tap tests [CSENG-68] chore: remove status check for CSENG-68 chore: implement ffg for otel [CSENG-68] chore: correct go mod [CSENG-68] chore: revert to standard http client lib [CSENG-68] chore: correct ffg unit test [CSENG-68] chore: lint service [CSENG-68] chore: update fake server end point
08bcc34 to
70dbb05
Compare
| package main | ||
|
|
||
| // !!! This import needs to be the first import, please do not change this !!! | ||
| import _ "github.com/snyk/go-application-framework/pkg/networking/fips_enable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Please watch out for this import. It must remain the first import.
| disable_analytics_flag string = "DISABLE_ANALYTICS" | ||
| debug_level_flag string = "log-level" | ||
| integrationNameFlag string = "integration-name" | ||
| showMavenBuildScopeFlag string = "show-maven-build-scope" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: The CLI tries to enforce a separation of concerns between the application and product lines. This means that feature flag like this, which is SCA related should live in the related extension.
| globalLogger.Print("Failed to fetch feature flags", err) | ||
| return constants.SNYK_EXIT_CODE_ERROR | ||
| } | ||
| apiToken := globalConfiguration.GetString(configuration.AUTHENTICATION_TOKEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: This should not be required. Authentication is handled by the network stack.
| cliAnalytics.GetInstrumentation().SetCategory(instrumentation.DetermineCategory(os.Args, globalEngine)) | ||
| cliAnalytics.GetInstrumentation().SetStage(instrumentation.DetermineStage(cliAnalytics.IsCiEnvironment())) | ||
| cliAnalytics.GetInstrumentation().SetStatus(analytics.Success) | ||
| cliAnalytics.GetInstrumentation().AddExtension(showMavenBuildScopeFlag, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous comment, something like this should live in the Extension.
| return exitCode | ||
| } | ||
|
|
||
| func IsFeatureEnabled( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return nil, fmt.Errorf("base URL is nil") | ||
| } | ||
|
|
||
| client := &http.Client{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Please use the GAF network stack it will take care of authentication, user-agent ...
Pull Request Submission Checklist
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
Adds a call to feature flag gateway api to fetch the 'show-maven-build-scope'
Pass this feature flag to the maven plugin -> Plugin call to feature flag gateway from src/lib/snyk-test/index.js and pass flags to src/lib/plugins/get-single-plugin-result.ts where the mvn plugin is invoked with feature flag.
Added Feature Flag Gateway server to cliv2 in order to fetch the feature flag for otel.
Where should the reviewer start?
src/lib/feature-flag-gateway/index.ts
Implement post call to feature flag gateway and added wrapper
Company id is fetched from config (getOrganizationId) and not from options.
src/lib/snyk-test/index.js
Call Feature Flag Gateway and set flag in featureFlags
src/lib/plugins/get-single-plugin-result.ts
Update to pass feature flag to maven plugin
cliv2/cmd/cliv2/main.go
Added call to feature flag gateway service to fetch the 'show-maven-build-scope' flag
cliv2/internal/feature-flag-gateway
Implement service to call the feature flag gateway evaluate api
How should this be manually tested?
Run sbom generation for org with and without the show-maven-build-scope feature flag enabled in flipt.
cli/binary-releases/snyk-macos-arm64 sbom --format cyclonedx1.6+json --debugRun sbom generation for user authenticated with group service account token. Confirm default organization is passed to feature flag call scope is generated as expected.
cli/binary-releases/snyk-macos-arm64 auth <token>Flag enabled - sbom output contains scope
Flag disabled - sbom output does not contain scope
What's the product update that needs to be communicated to CLI users?
Sbom generated output will contain maven scope information for those organizations with the 'show-maven-build-scope' feature flag enabled