Skip to content
Latchkey

How to Use OpenFeature in a CI Pipeline

OpenFeature gives one evaluation API; you register a provider (LaunchDarkly, Flagsmith, Unleash) once and swap it without touching flag call sites.

OpenFeature is a standard interface with pluggable providers. Register the provider at startup, then use getBooleanValue everywhere, so CI and app code stay decoupled from any single vendor.

Steps

  • Install the OpenFeature SDK plus a provider package.
  • Call setProviderAndWait once at startup.
  • Evaluate with getBooleanValue (or typed variants) at each call site.

Register a provider

Terminal
import { OpenFeature } from '@openfeature/server-sdk';
import { FlagdProvider } from '@openfeature/flagd-provider';
await OpenFeature.setProviderAndWait(new FlagdProvider());
const client = OpenFeature.getClient();
const on = await client.getBooleanValue('new-checkout', false);

Evaluate in a CI test

.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci && npm test   # tests import the shared OpenFeature client

Gotchas

  • Use setProviderAndWait (not setProvider) so the first evaluation is not a default.
  • Provider-specific config (keys, URLs) still lives in the provider constructor.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →