Use feature flag manifests

This guide shows you how to create or export flags from an App Lifecycle Manager feature flag manifest.

App Lifecycle Manager feature flags let you control the availability and behavior of features within your applications without requiring new code deployments or infrastructure changes. Feature flag manifests let you create flags in groups, so you don't have to create and synchronize flags across your management plane and local development environment manually. Manifests provide a bulk management utility that lets you manage your flags using JSON files that conform to the open-source OpenFeature flag manifest schema.

Prerequisites

Before you begin, ensure you have:

  1. A gcloud environment configured to manage App Lifecycle Manager resources.
  2. Completed the Deploy feature flags quickstart.

Create flags from a manifest

The push command lets you create multiple flags at once by providing a local JSON manifest file.

  1. Create a file named my_flags.json with your flag definitions. This file serves as the local source of truth for your manifest.

    Example my_flags.json:

    {
      "flags": {
        "my-flag": {
          "defaultValue": "foo-bar",
          "description": "A description of the flag.",
          "flagType": "string"
        }
      }
    }
    
    1. Run the push command specifying your manifest file and the targeted UnitKind.
    gcloud beta app-lifecycle-manager flags push \
        --file="my_flags.json" \
        --unit-kind="UNIT_KIND_NAME"
    

Create a manifest from existing flag configurations

The pull command fetches existing flag configurations from the App Lifecycle Manager API and generates a local JSON manifest file. This lets you maintain a local record of your flags or prepare them for use with OpenFeature codegen tools.

  1. Run the pull command specifying your chosen output path.

     gcloud beta app-lifecycle-manager flags pull \
         --output-file="manifest.json" \
         --unit-kind="UNIT_KIND_NAME" \
         --overwrite-output-file
    
  2. If you are using type-safe flag accessors, run the OpenFeature CLI codegen utility against the new manifest.json to update your application's type-safe flag accessors. This ensures the manifests match the keys and types in the management plane.

What's next