Build a Feature Flag pipeline
A Feature Flag (FF) pipeline enables you to combine a flag with other actions such as adding Jira issues, creating notifications, adding approvals, etc. You can:
- Use Jira issues to approve or reject a pipeline or stage at any point in its execution
- Create notification rules to send notifications about the events on your FF pipeline
- Schedule pipeline executions using Cron-based Triggers, etc.
This topic explains how to build an FF pipeline. Watch this video for an introduction:
Before you begin
You should be familiar with the Harness' Key Concepts and how to Create Organizations and Projects.
Create a pipeline
This topic assumes you have already set up a project.
To create an FF pipeline:
- In Harness, select Feature Flags, and then select an existing project or create a new one.
- Navigate to Pipelines > Create a Pipeline.
- In Name, enter a name for your pipeline. An ID is generated automatically.
- Enter Description and Tags for your pipeline.
- Click Start.
Now you're ready to add a stage.
Add a stage
An FF pipeline is organized into stages. Each stage contains the logic to perform one major segment of the pipeline process. You must have a minimum of one stage to run the pipeline.
Click Add Stage, and then select one of the available stage types.
Two common options are: Feature Flags and Approval.
An approval stage approves or rejects a pipeline at any point in its execution. Approvals are added between stages to prevent pipeline execution from proceeding without an approval. You can use Harness UI, Jira, Custom Shell Script, or ServiceNow Approval mechanisms. For more information, go to Using manual approval stages.
In About your Stage, in Name, enter a name for your stage. Click Set up Stage.
You can edit the name in the Overview tab of the stage anytime.
Changing the stage name doesn't change the stage identifier (ID). The stage identifier is created when you first name the stage and it cannot be changed. For more information, go to Entity Identifier Reference.
Once you've created a stage, you can see the name and ID in the Overview tab.
You can add multiple stages, and insert new stages between the existing stages. To add another stage to the pipeline, in Pipeline Stages, click + and then follow the same steps.
Add a step
Each stage has a rollout strategy that consists of a series of steps, or tasks, to be carried out in sequence. A stage can have one or many steps. With your rollout strategy, you can deploy multiple managed workloads. When a rollout strategy is applied, it's possible to make changes to only a limited set of users as a risk mitigation strategy. By releasing production changes gradually, error rates or performance degradation can be tracked.
To add a step:
In Harness, select Feature Flags > Pipelines, and then select a pipeline, or create a new one.
Go to your pipeline, select the stage you want to add a step to.
The Rollout Strategy view for this stage appears below the stages.
Select Add Step.
The Step Library panel appears, where you can choose what type of step to add.
Add flag configurations
To add details to a Flag Configuration step:
In your pipeline, select a stage, and then select a Flag Configuration step.
The Step Parameters form appears
Add a Step Name.
In Select Environment and Select Flag, select an environment and a flag.
Choose one of these options:
- Fixed value - A value you enter manually and do not change at runtime.
- Runtime Input - This is a placeholder for values that will be provided when you start a pipeline execution.
In Flag Changes, select an action to take when this flag changes, and then configure the variation to serve based on that action.
Here are the available options:
Flag change actions Configuration Set Flag Switch Select ON and OFF. Default Rules Select the default rule for when the flag is ON and OFF. For example, if the flag is ON, serve the variation True
.Serve Variation to Individual Target Select the target and the flag variation to serve to that target. Serve Variation to Target Group Select the target group and the flag variation to serve to that group. Serve Percentage Rollout Select a target group, and then select a percentage of users in that group to serve a selected variation, and a percentage to serve another variation. For more information, go to Target users with flags. For information on managing variations, go to Change the variations of your flags.
Select Apply Changes, and then select Save.
Run the pipeline
- In the pipeline view, click Run.
- The pipeline runs and a success message is generated.
View the results
Click each stage's steps to see the logs in real-time. Click Console View to see more details.
Pipeline notification strategy
You can create notification rules to send notifications about the events on your FF pipeline that are important to you. You can notify your User Group members using Slack, Microsoft Teams, Email, or PagerDuty as one of the notification channels. Event notifications are set up using Notification Rules.
Slack notification
You can notify your User Group members using Slack as one of the notification channels. You can add your User Group to a Notification Strategy and receive alert info in Slack.
For more information, go to Send Notifications using Slack.
Email notification
For email notifications, simply type in the email addresses that you want to notify.
For more information, go to Email notifications.
PagerDuty notification
For PagerDuty notifications, enter the key for a PagerDuty Account/Service to which Harness can send notifications.
For more information, go to Send Notifications using PagerDuty.
Microsoft Teams notification
Harness notifies your User Groups of events in pipelines and general alerts.
You can integrate your Harness User Group with Microsoft Teams and receive notifications in Teams channels.
For more information, go to Send Notifications using Microsoft Teams.
View a pipeline using YAML
The entire pipeline is available as YAML, also.
- In Feature Flag, in Pipelines, click YAML.
- You can see the entire pipeline as YAML. You can edit anything in the pipeline and run it again.
Schedule pipelines using triggers
You can trigger an FF pipeline on a time schedule. You can select how often to execute the trigger by minute, hour, days, etc.
All the cron jobs are executed in Universal Time Coordinated (UTC). Cron triggers allow you to create pipelines that start on a specific time schedule.
For more information, go to Schedule pipeline using triggers.
Add chaos experiments to your FF pipeline
You can use Harness Chaos Engineering (CE) to run chaos experiments, which are intentionally designed to disrupt systems to test their resilience and vulnerability to faults. Adding chaos steps that run CE experiments as part of your FF pipeline is a useful way to test the resilience of new software behind a feature flag before releasing that software to users.
For more information, go to Use CE with Feature Flags.
More information
For more information on Harness pipelines, go to Pipelines.