Page MenuHomePhabricator

[GrowthBook Integration] Set GROWTHBOOK_API_KEY environment variable for staging and production
Closed, ResolvedPublic3 Estimated Story Points

Description

Description

The backend of Test Kitchen UI polls the GrowthBook REST API on startup and at a configurable interval to sync experiment configuration. The API requires a Bearer token for authentication. The token is read from the GROWTHBOOK_API_KEY environment variable at startup (see config/configuration.js in prospective MR). If the variable is not set, the application logs an error and the poller will fail to authenticate.

The placeholder <growthbook-api-key> in config.prod.yaml and config.dev.yaml documents where the value is expected. The real key must be injected via the deployment system.

Technical Notes

The API key can be found in the GrowthBook instance under Settings >> API Keys (https://growthbook.wikimedia.org/settings/keys).

Staging and production should probably use different keys depending on which GrowthBook environment they point to.

Acceptance Criteria

  • Make sure that the API key is not bound to a user account
  • The GROWTHBOOK_API_KEY is set as a Kubernetes secret and mounted as an environment variable in the Test Kitchen UI pod for both staging and production
  • The GrowthBook poller successfully authenticates and syncs experiment configuration on startup for both staging and production

Event Timeline

cjming updated the task description. (Show Details)
cjming updated the task description. (Show Details)
cjming renamed this task from [GrowthBook Integration] Set GROWTHBOOK_API_KEY environment variable for staging and production deployments to [GrowthBook Integration] Set GROWTHBOOK_API_KEY environment variable for staging and production.Tue, May 12, 6:32 PM
cjming updated the task description. (Show Details)
KReid-WMF updated the task description. (Show Details)
KReid-WMF set the point value for this task to 3.

Regarding the first AC, and once we have a GrowthBook API Key not bound to a specific user:

The GROWTHBOOK_API_KEY is set as a Kubernetes secret and mounted as an environment variable in the Test Kitchen UI pod for both staging and production

I have found some notes I took while creating the kubernetes chart for the first time for Test Kitchen UI regarding how to provision secrets for a service (T361342: Provision the MPIC secrets in the private puppet repository was the related ticket at that time):

In the case we need new secrets once we have created chart/helmfile or even when the service is already deployed and running, we have to file a ticket at https://phabricator.wikimedia.org/project/board/6524/ asking for what we need. After that we should create a chart change to add them and deploy the service to start using them.

My mistake. The last related patch about the new docker image is not related to this ticket.

Both test-kitchen-next and growthbook now have a GROWHTBOOK_API_KEY environment variable containing an API key for growthbook.

test-kitchen is integrated with growthbook and test-kitchen-next is integrated with growthbook-next.

I think this is done? prod still needs the status filter update but afaict the 400 error has to do with this rather than with the api key

I think this is done? prod still needs the status filter update but afaict the 400 error has to do with this rather than with the api key

Right! The GB API Key has been set already as a env var, so there is nothing else to do here. The purpose of the ticket was setting that config property as an env var. The third AC in the description is pretty unrelated because the tickets related to the code itself are covering that already.

Change #1290916 had a related patch set uploaded (by Santiago Faci; author: Santiago Faci):

[operations/deployment-charts@master] test-kitchen chart: Updated to support growthbook specific configuration

https://gerrit.wikimedia.org/r/1290916

Change #1290916 merged by jenkins-bot:

[operations/deployment-charts@master] test-kitchen chart: Updated to support growthbook specific configuration

https://gerrit.wikimedia.org/r/1290916