Overview
This QuickStart shows how you might use Rollout.io to provide feature flags to your application.
Use Case
The use case we cover here is as follows: The application is deployed using Jenkins X, we have Staging and Production environments. We want to target the Staging Environment Users and display a button, only for Staging environment. The concept covers targeting a Group in Rollout, and also showing features in a given Jenkins X environment.
Gettting Started
To get started, you will need to do the following:
- Sign up for a rollout.io account.
- Ensure you have to Rollout Environments (Production, Staging)
Modify the Server.js
// the parameter for setup, is the ID of the Staging Environment in the Rollout Dashboard.
// you can use other environment IDs but those must be defined in the Rollout Dashboard.
var _result = await Rox.setup('<ENTER_ENVIRONMENT_ID>', {
});
- Create a Custom Property, call it
JenkinsX Environment
of typestring
by going to left navigation App Settings > Custom Properties, click Add New Custom Property - Create a Flag within the Rollout
Staging
environment, by clicking on the left nav under Staging > Experiements, then click New Experiement and selectCreate Flag1
Confusing right, but that should work.
Call the flag jenkinsx environment
, this will map to an internal name of ski-rollout.jenkinsx_environment
which we create via code.
- Create a Target Group and configure it as shown below
We are creating a Target Group that is targeting the Staging Environment in Jenkins X.
NOTE: Enter the values as strings (multiple), ensure that you add the exact name of your environment namespace
, which you can obtain by executing jx get env
and view the NAMESPACE column.
- Create an Experiment and configure it to target the group you created in the previous step. It should be configured as follows:
Ensure, that the dropdown, is set to true
.