- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
",t};e.buildCustomizationMenuUi=t;function n(e){let t='
",t}function s(e){let n=e.filter.currentValue||e.filter.defaultValue,t='${e.filter.label}
`,e.filter.options.forEach(s=>{let o=s.id===n;t+=``}),t+="${e.filter.label}
`,t+=`To use Datadog PR Gates, you can define one or more rules on the PR Gate Rules page and integrate them in your CI pipeline with the datadog-ci gate evaluate
command.
PR Gates ensures that only the code that meets your quality standards is deployed, automating your quality assurance processes and enhancing software reliability.
To create a PR Gates rule in Datadog:
Navigate to Software Delivery > PR Gates > PR Gate Rules and click + New Rule.
Select a type of rule: Test
, Static Analysis
, or Software Composition Analysis
.
Set the rule scope, which defines when the rule should be evaluated, by selecting Always evaluate
or Select when to evaluate
. You can add branches or repositories to include or exclude from the rule scope, or add a custom scope.
You can create a rule that is evaluated only on specific repositories and branches. To customize the rule scope, click Select when to evaluate
and specify the branch or repository that should be included or excluded.
To add a custom scope (such as a team name), click + Add Filter and select Custom scope. Enter a tag name without spaces (such as documentation
or team-documentation
) and click Add Custom Scope. Enter values that should be included or excluded.
When adding a custom scope to a rule, custom scopes must be passed to the datadog-ci gate evaluate
command using the --scope
option. For more information, see Understanding Rule Scopes.
Define the rule conditions. The rule condition states in which scenario the rule fails, failing the related pipeline (if the rule is blocking). You can select one of the existing rule conditions for the rule type you have selected. If the rule scope is set to always evaluate
, the rule is evaluated on all repositories and branches.
The following example demonstrates how to create a Static Analysis rule that fails when one or more Static Analysis code quality violations with error
status are contained within a repository.
Select Static Analysis for the rule type and click Always evaluate
for the rule scope.
In the Define rule conditions section, select code quality violations
from the dropdown menu. Then, select the error
status type, select above or equal to
, and enter the value of 1
.
Specify a rule name that describes the rule that you are creating.
Select whether the rule should block the pipeline when it fails. Non-blocking rules are helpful when you roll out a new rule and want to verify its behavior before making it blocking.
Integrate the PR Gate rule into your build configuration by including the datadog-ci gate evaluate
command.
Enable a GitHub status check for your PR Gate rule by setting the appropriate permissions (such as Checks: Write
) in your GitHub apps. To set this check as blocking in your pull requests, you must click the Required checkbox in your GitHub app’s Protected Branches settings.
Click Create Rule.
Invoke the PR Gates evaluation by calling the datadog-ci gate evaluate
command. PR Gates requires datadog-ci
version 2.27.0
or later.
datadog-ci gate evaluate
command executes. Otherwise, the rules may demonstrate incorrect behavior due to the absence of these events.This command:
Environment Variables | Description |
---|---|
DD_API_KEY | Point to your Datadog API key. |
DD_APP_KEY | Point to your Datadog application key. The application key must have the PR Gates Evaluations permission enabled. |
DD_SITE | (Optional) Point to a specific Datadog site (default value is ). Note: DATADOG_SITE is not supported. |
For example:
DD_SITE= DD_API_KEY=API_KEY DD_APP_KEY=APP_KEY datadog-ci gate evaluate
Configure the behavior of the datadog-ci gate evaluate
command using the following flags:
--fail-on-empty
--fail-if-unavailable
--timeout
--no-wait
datadog-ci gate evaluate
command is called several minutes after the related events are sent to Datadog, you can opt to skip this waiting time by specifying the --no-wait
flag. However, if used incorrectly, this flag may result in inaccurate rule evaluations.Add custom scopes to the command by using the --scope
option one or more times:
datadog-ci gate evaluate --scope team:backend --scope team:frontend
Check the command logs to see the overall gate evaluation status and information about the rules that were evaluated.
You can automatically create a GitHub check for each rule evaluated. The check contains additional information about the rule evaluation, such as the failure reason and the matching events in Datadog. When this feature is enabled, the evaluation results appear directly in GitHub.
To enable GitHub Checks:
Checks: Write
access to the GitHub application.After the permission is granted, you can see the checks in GitHub.
Note: Re-running a check does not re-run the corresponding PR Gates rule.
You can edit and delete PR Gates rules by hovering over a rule on the PR Gates Rules page.
Alternatively, click on a rule from the list and click the Edit, Clone, or Delete icons.
Only users with the quality_gate_rules_write
permission can create and edit PR Gate rules. Users with the quality_gate_rules_read
permission can view PR Gate rules.
For more information, see the RBAC Permissions documentation.
추가 유용한 문서, 링크 및 기사: