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:
- A
gcloudenvironment configured to manage App Lifecycle Manager resources. - 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.
Create a file named
my_flags.jsonwith 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" } } }- Run the
pushcommand specifying your manifest file and the targetedUnitKind.
gcloud beta app-lifecycle-manager flags push \ --file="my_flags.json" \ --unit-kind="UNIT_KIND_NAME"- Run the
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.
Run the
pullcommand specifying your chosen output path.gcloud beta app-lifecycle-manager flags pull \ --output-file="manifest.json" \ --unit-kind="UNIT_KIND_NAME" \ --overwrite-output-fileIf you are using type-safe flag accessors, run the OpenFeature CLI codegen utility against the new
manifest.jsonto update your application's type-safe flag accessors. This ensures the manifests match the keys and types in the management plane.
What's next
- Learn about Complex Targeting with CEL.
- Learn about Multi-Tenant Architecture.