Code references are only available to customers on select plans. To learn more, read about our pricing. To upgrade your plan, contact Sales.
This topic explains how to use the ld-find-code-refs utility with Bitbucket code references to create code references in LaunchDarkly.
You can use the ld-find-code-refs utility with Bitbucket Pipelines to automatically populate code references in LaunchDarkly. To do this, you must create a Pipes configuration using LaunchDarkly’s code reference pipe.
To set up Bitbucket Pipes, you must have the following prerequisite:
code-reference-repository resource, either through a base role, a LaunchDarkly-provided project role, or another role that you have created. To learn more, read API access tokens and Code reference actions.Alternatively, you can give the access token access to a role with the code-reference-repository resource specifier. To learn more, read Roles.
To set up the Bitbucket Pipes configuration:
push using the default configuration. Include the following variables:LD_ACCESS_TOKEN: This secured variable should be your API access token.LD_PROJ_KEY: This should be your LaunchDarkly project key. To learn how to find your project key, read Project keys.Here’s an example of a minimal Pipeline configuration:

You can copy and paste the following code into a blank Pipelines configuration if you have set the LD_PROJ_KEY and LD_ACCESS_TOKEN environment variables as repository variables:
To learn more about repository variables, read Atlassian’s documentation.
You may configure the code reference pipe with additional environment variables to enable more functionality. For additional configuration options, read the ld-find-code-refs-pipe repository.