1. launchdarkly/ld-find-code-refs@2.13.0

launchdarkly/ld-find-code-refs@2.13.0

Partner
Sections
Job for finding and sending feature flag code references to LaunchDarkly. Code references documentation: https://docs.launchdarkly.com/home/code/circleci
Created: January 16, 2019Version Published: December 18, 2024Releases: 47
Org Usage:
31

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: ld-find-code-refs: launchdarkly/ld-find-code-refs@2.13.0

Use ld-find-code-refs elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

minimal_config

Minimal configuration

1 2 3 4 5 6 7 8 9 10 version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: access_token: ${LD_ACCESS_TOKEN} proj_key: YOUR_LAUNCHDARKLY_PROJECT_KEY debug: true

context_lines

Configuration with context lines provided. Context line documentation: https://docs.launchdarkly.com/home/code/code-references#configuring-context-lines

1 2 3 4 5 6 7 8 9 10 11 version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: debug: true access_token: ${LD_ACCESS_TOKEN} proj_key: YOUR_LAUNCHDARKLY_PROJECT_KEY context_lines: 3

standard_configuration

A configuration with the the `repoType` set to GitHub, and the `repuUrl` set to a GitHub URL. We recommend configuring these parameters so LaunchDarkly is able to generate reference links to your source code

1 2 3 4 5 6 7 8 9 10 11 12 13 version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: debug: true access_token: ${LD_ACCESS_TOKEN} proj_key: YOUR_LAUNCHDARKLY_PROJECT_KEY repo_type: github repo_url: YOUR_REPO_URL context_lines: 3

Jobs

find-code-references

Scans a git repository for code references.

Show job Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
access_token
LaunchDarkly access token (use env var $LD_ACCESS_TOKEN to populate).
No
${LD_ACCESS_TOKEN}
string
proj_key
LaunchDarkly project key. Found under Account Settings -> Projects in the LaunchDarkly dashboard. Cannot be combined with `projects` block in configuration file.
Yes
-
string
base_uri
Set the base URL of the LaunchDarkly server for this configuration. Only necessary if using a private instance of LaunchDarkly.
No
https://app.launchdarkly.com
string
context_lines
The number of context lines above and below a code reference for the job to send to LaunchDarkly. By default, the flag finder will not send any context lines to LaunchDarkly. If < 0, no source code will be sent to LaunchDarkly. If 0, only the lines containing flag references will be sent. If > 0, will send that number of context lines above and below the flag reference. A maximum of 5 context lines may be provided.
No
2
integer
repo_type
The repo service provider. Used to correctly categorize repositories in the LaunchDarkly UI.
No
custom
enum
repo_url
The URL for the repository. If provided and `repoType` is not custom, LaunchDarkly will attempt to automatically generate source code links. Example: `https://github.com/launchdarkly/ld-find-code-refs`
No
''
string
default_branch
The git default branch. The LaunchDarkly UI will default to display code references for this branch.
No
main
string
commit_url_template
If provided, LaunchDarkly will attempt to generate links to your Git service provider per commit. Example: `https://github.com/launchdarkly/ld-find-code-refs/commit/${sha}`. Allowed template variables: `branchName`, `sha`. If `commitUrlTemplate` is not provided, but `repoUrl` is provided and `repoType` is not `custom`, LaunchDarkly will attempt to automatically generate source code links for the given `repoType`.
No
''
string
hunk_url_template
If provided, LaunchDarkly will attempt to generate links to your Git service provider per code reference. Example: `https://github.com/launchdarkly/ld-find-code-refs/blob/${sha}/${filePath}#L${lineNumber}`. Allowed template variables: `sha`, `filePath`, `lineNumber`. If `hunkUrlTemplate` is not provided, but `repoUrl` is provided and `repoType` is not `custom``, LaunchDarkly will attempt to automatically generate source code links for the given `repoType`.
No
''
string
allow_tags
Enables storing references for tags. The tag will be listed as a branch.
No
false
boolean
debug
Enables verbose debug logging.
No
false
boolean
ignore_service_errors
If enabled, the scanner will terminate with exit code 0 when the LaunchDarkly API is unreachable or returns an unexpected response.
No
false
boolean
lookback
Sets the number of git commits to search in history for whether a feature flag was removed from code. May be set to 0 to disable this feature. Setting this option to a high value will increase search time.
No
10
integer

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: "Job for finding and sending feature flag code references to LaunchDarkly. Code references documentation: https://docs.launchdarkly.com/home/code/circleci" display: home_url: https://docs.launchdarkly.com source_url: https://github.com/launchdarkly/ld-find-code-refs/tree/main/build/package/circleci examples: minimal_config: description: Minimal configuration usage: version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: access_token: "${LD_ACCESS_TOKEN}" proj_key: 'YOUR_LAUNCHDARKLY_PROJECT_KEY' debug: true context_lines: description: "Configuration with context lines provided. Context line documentation: https://docs.launchdarkly.com/home/code/code-references#configuring-context-lines" usage: version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: debug: true access_token: "${LD_ACCESS_TOKEN}" proj_key: 'YOUR_LAUNCHDARKLY_PROJECT_KEY' context_lines: 3 standard_configuration: description: "A configuration with the the `repoType` set to GitHub, and the `repuUrl` set to a GitHub URL. We recommend configuring these parameters so LaunchDarkly is able to generate reference links to your source code" usage: version: 2.1 orbs: launchdarkly: launchdarkly/ld-find-code-refs@2.13.0 workflows: main: jobs: - launchdarkly/find-code-references: debug: true access_token: "${LD_ACCESS_TOKEN}" proj_key: 'YOUR_LAUNCHDARKLY_PROJECT_KEY' repo_type: 'github' repo_url: 'YOUR_REPO_URL' context_lines: 3 jobs: find-code-references: description: Scans a git repository for code references. parameters: access_token: description: LaunchDarkly access token (use env var $LD_ACCESS_TOKEN to populate). type: string default: "${LD_ACCESS_TOKEN}" proj_key: description: LaunchDarkly project key. Found under Account Settings -> Projects in the LaunchDarkly dashboard. Cannot be combined with `projects` block in configuration file. type: string base_uri: description: Set the base URL of the LaunchDarkly server for this configuration. Only necessary if using a private instance of LaunchDarkly. type: string default: "https://app.launchdarkly.com" context_lines: description: The number of context lines above and below a code reference for the job to send to LaunchDarkly. By default, the flag finder will not send any context lines to LaunchDarkly. If < 0, no source code will be sent to LaunchDarkly. If 0, only the lines containing flag references will be sent. If > 0, will send that number of context lines above and below the flag reference. A maximum of 5 context lines may be provided. type: integer default: 2 repo_type: description: "The repo service provider. Used to correctly categorize repositories in the LaunchDarkly UI." type: enum default: custom enum: ["bitbucket", "custom", "github", "gitlab"] repo_url: description: "The URL for the repository. If provided and `repoType` is not custom, LaunchDarkly will attempt to automatically generate source code links. Example: `https://github.com/launchdarkly/ld-find-code-refs`" type: string default: "" default_branch: description: "The git default branch. The LaunchDarkly UI will default to display code references for this branch." type: string default: "main" commit_url_template: description: "If provided, LaunchDarkly will attempt to generate links to your Git service provider per commit. Example: `https://github.com/launchdarkly/ld-find-code-refs/commit/${sha}`. Allowed template variables: `branchName`, `sha`. If `commitUrlTemplate` is not provided, but `repoUrl` is provided and `repoType` is not `custom`, LaunchDarkly will attempt to automatically generate source code links for the given `repoType`." type: string default: "" hunk_url_template: description: "If provided, LaunchDarkly will attempt to generate links to your Git service provider per code reference. Example: `https://github.com/launchdarkly/ld-find-code-refs/blob/${sha}/${filePath}#L${lineNumber}`. Allowed template variables: `sha`, `filePath`, `lineNumber`. If `hunkUrlTemplate` is not provided, but `repoUrl` is provided and `repoType` is not `custom``, LaunchDarkly will attempt to automatically generate source code links for the given `repoType`." type: string default: "" allow_tags: description: "Enables storing references for tags. The tag will be listed as a branch." type: boolean default: false debug: description: "Enables verbose debug logging." type: boolean default: false ignore_service_errors: description: "If enabled, the scanner will terminate with exit code 0 when the LaunchDarkly API is unreachable or returns an unexpected response." type: boolean default: false lookback: description: "Sets the number of git commits to search in history for whether a feature flag was removed from code. May be set to 0 to disable this feature. Setting this option to a high value will increase search time." type: integer default: 10 docker: - image: launchdarkly/ld-find-code-refs:2.13.0 entrypoint: sh steps: - checkout: path: /repo - run: name: Find flag references command: | touch $BASH_ENV source $BASH_ENV ld-find-code-refs \ --debug="<< parameters.debug >>" \ --accessToken="<< parameters.access_token >>" \ --projKey="<< parameters.proj_key >>" \ --ignoreServiceErrors="<< parameters.ignore_service_errors >>" \ --lookback="<< parameters.lookback >>" \ --contextLines="<< parameters.context_lines >>" \ --baseUri="<< parameters.base_uri >>" \ --repoType="<< parameters.repo_type >>" \ --repoUrl="<< parameters.repo_url >>" \ --defaultBranch="<< parameters.default_branch >>" \ --allowTags="<< parameters.allow_tags >>" \ --commitUrlTemplate="<< parameters.commit_url_template >>" \ --hunkUrlTemplate="<< parameters.hunk_url_template >>" \ --repoName="${CIRCLE_PROJECT_REPONAME}" \ --updateSequenceId="${CIRCLE_BUILD_NUM}" \ --dir="/repo" \ --userAgent="circle-ci"
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.