Flipt v2 supports Source Control Management (SCM) for Git repositories.

This functionality is only available in Flipt v2 Pro. Learn more about our commercial license or purchase a license.

Prerequisites

  • Flipt v2
  • A Flipt v2 environment configured with Git Sync
  • A Flipt v2 Pro license or trial license

Flipt v2 SCM integration supports most of the major Git providers including GitHub, GitLab, and Gitea.

Configuring SCM Integration

This section will walk you through configuring Flipt v2 to more deeply integrate with your Git provider to enable features like Merge Proposals.

1. Create a Personal Access Token (PAT)

  1. Go to GitHub Settings > Developer settings > Personal access tokens.
  2. Click “Generate new token”
  3. Give your token a name
  4. Select a resource owner (e.g. your organization)
  5. Select the repositories you want to give access to (or Select all). These should be the same repositories that you have configured to sync with Flipt.
  6. Set an expiration date
  7. Select the following repository scopes (required):
    • contents read and write access
    • pull-requests read and write access

  1. Click “Generate token” and copy the token. You will not be able to see it again!

2. Configure GitHub Credentials

Edit your Flipt configuration file to use the GitHub credentials you created in the previous step:

credentials:
  github:
    type: access_token
    access_token: <your-personal-access-token>

3. Configure Flipt Storage with GitHub Remote

Edit your Flipt configuration file to add or update the storage backend that syncs with your GitHub repository:

storage:
  github:
    remote: "https://github.com/<your-username>/<your-repo>.git"
    branch: "main"
    poll_interval: "30s"
    credentials: "github"
    backend:
      type: local
      path: "/path/to/local/clone"

4. Configure an Environment to use GitHub SCM

Edit your Flipt configuration file to add or update the environment that uses the GitHub SCM storage backend and add the scm section:

environments:
  production:
    name: "Production"
    storage: "github"
    default: true
    scm:
      type: github
      credentials: "github"

5. Start Flipt

Start or restart your Flipt server with the updated configuration. Flipt will now:

  • Clone your GitHub repository to the specified local path
  • Periodically sync flag state to and from GitHub
  • Commit and push changes when you update flags via the Flipt API or UI
  • Enable merge proposals in the Flipt UI

6. Troubleshooting

  • Ensure your PAT has the correct permissions.
  • Make sure the local path is writable by the Flipt process.
  • Check Flipt logs for any sync or authentication errors.

Conclusion

This guide showed how to configure Flipt to enable merge proposals in the Flipt UI.

You can now use Flipt to manage your flags and use merge proposals to review and approve changes to your flags.

If you have any questions or feedback, please reach out to the Flipt team on Discord or GitHub Discussions.


References: