Website | Documentation | Installation Guide | Twitter
Flagship Code Analyzer is a CLI and a docker image that can analyze your codebase and detect the usage of Flagship flags, in order to synchronize them with your Flag view in the platform.
go build
export FLAGSHIP_CLIENT_ID=FLAGSHIP_MANAGEMENT_API_CLIENT_ID
export FLAGSHIP_CLIENT_SECRET=FLAGSHIP_MANAGEMENT_API_CLIENT_SECRET
export ACCOUNT_ID=FLAGSHIP_ACCOUNT_ID
export ENVIRONMENT_ID=FLAGSHIP_ENVIRONMENT_ID
export REPOSITORY_URL=https://gitlab.com/org/repo
export REPOSITORY_BRANCH=master
export DIRECTORY=./
./codebase-analyzer
docker run -v $(pwd)/your_repo:/your_repo -e FLAGSHIP_CLIENT_ID=FLAGSHIP_MANAGEMENT_API_CLIENT_ID -e FLAGSHIP_CLIENT_SECRET=FLAGSHIP_MANAGEMENT_API_CLIENT_SECRET -e ACCOUNT_ID=FLAGSHIP_ACCOUNT_ID -e ENVIRONMENT_ID=your_env_id -e REPOSITORY_URL=https://gitlab.com/org/repo -e REPOSITORY_BRANCH=master -e DIRECTORY=/your_repo flagshipio/code-analyzer
export FLAGSHIP_CLIENT_ID=FLAGSHIP_MANAGEMENT_API_CLIENT_ID
export FLAGSHIP_CLIENT_SECRET=FLAGSHIP_MANAGEMENT_API_CLIENT_SECRET
export ACCOUNT_ID=FLAGSHIP_ACCOUNT_ID
export ENVIRONMENT_ID=FLAGSHIP_ENVIRONMENT_ID
export REPOSITORY_URL=https://gitlab.com/org/repo
export REPOSITORY_BRANCH=master
export DIRECTORY=./
brew tap flagship-io/flagship
brew install codebase-analyzer
codebase-analyzer
- .cs .fs (SDK V4 supported)
- .dart (SDK V4 supported)
- .go
- .java
- .js .jsx (SDK V4 supported)
- .kt (Android SDK V4 supported)
- .m
- .php (SDK V4 supported)
- .py
- .swift (SDK V4 supported)
- .ts .tsx (SDK V4 supported)
- .vb
This environment variable contains the Flagship client id necessary to authenticate request and send flags infos to the Flagship Platform
- example :
FLAGSHIP_CLIENT_ID=FLAGSHIP_MANAGEMENT_API_CLIENT_ID
This environment variable contains the Flagship client secret necessary to authenticate request and send flags infos to the Flagship Platform
- example :
FLAGSHIP_CLIENT_SECRET=FLAGSHIP_MANAGEMENT_API_CLIENT_SECRET
This environment variable contains the Flagship account ID to synchronize flags usage for the matching environment
- example :
ACCOUNT_ID=your_flagship_env_id
This environment variable contains the Flagship environment ID to synchronize flags usage for the matching environment
- example :
ENVIRONMENT_ID=your_flagship_env_id
This environment variable should be set to the root URL of your repository, and is used to track the links of the files where your flags are used
- example :
REPOSITORY_URL=https://gitlab.com/org/repo
- default value: ""
This environment variable should be set to the branch of the code you want to analyse, and is used to track the links of the files where your flags are used
- example :
REPOSITORY_BRANCH=master
- default value: ""
This environment variable should contain a comma separated list of glob to exclude
- example :
FILES_TO_EXCLUDE=".git/*,go.mod,go.sum,main.go,internal/*,example/*"
- default value: ""
This environment variable should contain the directory you want to analyse
- example :
DIRECTORY="."
- default value: "."
This environment variable should contain the regex for the pattern you want to analyze
- example:
CUSTOM_REGEX_JSON="[{\"file_extension\":\".go?\",\"regexes\":[\"(?:Bool|String|Float64)Variation[(](?:\\\\s*[\\\"\\\\'](.*)[\\\"\\\\']\\\\s*,\\\\s*([\\\"\\\\'].*\\\\s*[^\\\"]*[\\\"\\\\']|[^)]*))\\\\s*[)]\"]}]"
- default value: ""
You can use the code analyzer to push flags references to your Flagship environment when code is pushed to a specific branch or tag
analyze_flag_references:
image: flagshipio/code-analyzer:master
stage: analyze
variables:
REPOSITORY_URL: $CI_PROJECT_URL
REPOSITORY_BRANCH: $CI_COMMIT_BRANCH
FLAGSHIP_CLIENT_ID: FLAGSHIP_MANAGEMENT_API_CLIENT_ID
FLAGSHIP_CLIENT_SECRET: FLAGSHIP_MANAGEMENT_API_CLIENT_SECRET
ACCOUNT_ID: YOUR_ACCOUNT_ID
ENVIRONMENT_ID: YOUR_ENVIRONMENT_ID
script:
- /root/codebase-analyser
only:
- master
This repository needs go v1.13+ to work
go mod download
- Go to the example directory, and copy paste a folder you want to analyse
- Create a .env file to customize your environment variable
- Run
go run *.go
in the example folder to run the code
make test
- Guillaume Jacquart @GuillaumeJacquart
- Kevin Jose @kjose
- Elias Cédric Laouiti @eliaslaouiti
- Chadi Laoulaou @Chadiii
Flagship by AB Tasty is a feature flagging platform for modern engineering and product teams. It eliminates the risks of future releases by separating code deployments from these releases 💡 With Flagship, you have full control over the release process. You can:
- Switch features on or off through remote config.
- Automatically roll-out your features gradually to monitor performance and gather feedback from your most relevant users.
- Roll back any feature should any issues arise while testing in production.
- Segment users by granting access to a feature based on certain user attributes.
- Carry out A/B tests by easily assigning feature variations to groups of users. Flagship also allows you to choose whatever implementation method works for you from our many available SDKs or directly through a REST API. Additionally, our architecture is based on multi-cloud providers that offer high performance and highly-scalable managed services. To learn more:
- Solution overview - A 5mn video demo 🎥
- Documentation - Our dev portal with guides, how tos, API and SDK references
- Sign up for a free trial - Create your free account
- Guide to feature flagging - Everything you need to know about feature flag related use cases
- Blog - Additional resources about release management