Skip to content

Commit 75c825a

Browse files
Container Analysis samples [(#2258)](GoogleCloudPlatform/python-docs-samples#2258)
added container analysis samples and tests
0 parents  commit 75c825a

File tree

5 files changed

+728
-0
lines changed

5 files changed

+728
-0
lines changed

samples/snippets/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
venv*

samples/snippets/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google
2+
Cloud Platform logo" title="Google Cloud Platform" align="right" height="96"
3+
width="96"/>
4+
5+
# Google Cloud Container Analysis Samples
6+
7+
8+
Container Analysis scans container images stored in Container Registry for vulnerabilities.
9+
Continuous automated analysis of containers keep you informed about known vulnerabilities so
10+
that you can review and address issues before deployment.
11+
12+
Additionally, third-party metadata providers can use Container Analysis to store and
13+
retrieve additional metadata for their customers' images, such as packages installed in an image.
14+
15+
16+
## Description
17+
18+
These samples show how to use the [Google Cloud Container Analysis Client Library](https://cloud.google.com/container-registry/docs/reference/libraries).
19+
20+
## Build and Run
21+
1. **Enable APIs**
22+
- [Enable the Container Analysis API](https://console.cloud.google.com/flows/enableapi?apiid=containeranalysis.googleapis.com)
23+
and create a new project or select an existing project.
24+
1. **Install and Initialize Cloud SDK**
25+
- Follow instructions from the available [quickstarts](https://cloud.google.com/sdk/docs/quickstarts)
26+
1. **Authenticate with GCP**
27+
- Typically, you should authenticate using a [service account key](https://cloud.google.com/docs/authentication/getting-started)
28+
1. **Clone the repo** and cd into this directory
29+
30+
```
31+
git clone https://github.com/GoogleCloudPlatform/python-docs-samples
32+
cd python-docs-samples
33+
```
34+
35+
1. **Set Environment Variables**
36+
37+
```
38+
export GCLOUD_PROJECT="YOUR_PROJECT_ID"
39+
```
40+
41+
1. **Run Tests**
42+
43+
```
44+
nox -s "py36(sample='./container_registry/container_analysis')"
45+
```
46+
47+
## Contributing changes
48+
49+
* See [CONTRIBUTING.md](../../CONTRIBUTING.md)
50+
51+
## Licensing
52+
53+
* See [LICENSE](../../LICENSE)
54+

samples/snippets/requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
google-cloud-pubsub == 0.42.1
2+
google-cloud-containeranalysis == 0.1.0
3+
grafeas == 0.1.0
4+
pytest
5+
flaky
6+
mock

0 commit comments

Comments
 (0)