You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run the CLI, we need to have a version of git, Java (e.g., [Amazon Corretto](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc)) and the [AWS Command Line interface](https://aws.amazon.com/cli/) installed. Verify that both application are installed on our machine by running:
19
+
To run the CLI, we need to have a version of git, Java (e.g., [Amazon Corretto](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc))
20
+
and the [AWS Command Line interface](https://aws.amazon.com/cli/) installed.
21
+
Verify that both applications are installed on our machine by running:
10
22
11
23
```
12
24
java -version
@@ -15,8 +27,11 @@ aws --version
15
27
git --version
16
28
```
17
29
18
-
We will also need working credentials on our machine to interact with our AWS account. Learn more about setting up credentials for AWS here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html.
19
-
The credentials must have at least the following permissions:
30
+
We will also need working credentials on our machine to interact with our AWS account.
31
+
Learn more about setting up credentials for AWS here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html.
32
+
33
+
You can always use the CLI with *Admin* credentials but if you want to have a specific role to use the CLI, your
34
+
credentials must have at least the following permissions:
20
35
21
36
```json
22
37
{
@@ -55,17 +70,21 @@ The credentials must have at least the following permissions:
55
70
```
56
71
57
72
58
-
### Download the CLI and scan an Example
73
+
##Using the CLI
59
74
60
75
You can download the [aws-codeguru-cli](https://github.com/aws/aws-codeguru-cli/releases/latest) from the releases section.
61
76
Download the latest version and add it to your `PATH`:
You can use this CLI to run CodeGuru from inside your CI/CD pipeline. See [this action](.github/workflows/self-test-and-release.yml#L30-L41) as an example. First, you need credentials for a role with the permissions mentioned above. If you already scanned
135
-
the repository once with the CLI, the S3 bucket has been created, and the you do not need the `s3:CreateBucket*` permission anymore.
168
+
# We can tell the CLI to exclude all recommendations below a certain severity. This can be useful in CI/CD integration.
169
+
ExcludeBelowSeverity: 'HIGH'
136
170
137
-
Then you can run the CLI in non-interactive mode using the `--no-prompt` option. Further, you can specify a region and
138
-
AWS profile using the `--region` and `--profile` options as needed:
171
+
# We can exclude all recommendations that have a certain tag. Available Tags can be found here:
# Excludes all recommendations in the provided files. Files can be provided as Unix GLOB expressions.
189
+
ExcludeFiles:
190
+
- tst/**
191
+
192
+
```
193
+
194
+
Only the `version` field is mandatory in the `.codeguru-ignore.yml` file. All other entries are optional, and
195
+
the CLI will understand any combination of those entries.
196
+
197
+
An example of such a configuration file can be found [here](https://github.com/aws/aws-codeguru-cli/blob/main/.codeguru-ignore.yml).
198
+
199
+
## Running from CI/CD
200
+
201
+
You can use this CLI to run CodeGuru from inside your CI/CD pipeline.
202
+
See [this action](.github/workflows/cicd-demo.yml) as an example. To use the CLI in CI/CD, you need working credentials.
203
+
You can use this [CDK template](https://github.com/aws-samples/aws-codeguru-reviewer-cicd-cdk-sample) to set up OIDC credentials for Github Actions.
204
+
205
+
Then you can run the CLI in non-interactive mode using the `--no-prompt` option, and use the option
206
+
`--fail-on-recommendations` to return a non-zero exit code if recommendations are reported.
207
+
You can specify a region and AWS profile using the `--region` and `--profile` options as needed:
0 commit comments