Skip to content
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2eefd56
added container analysis samples and tests
daniel-sanche Feb 16, 2018
4510418
added v1 libraries
daniel-sanche Jun 11, 2019
210451c
updated region tags
daniel-sanche Jun 11, 2019
121796a
removed doc comments
daniel-sanche Jun 11, 2019
84caf87
removed update samples
daniel-sanche Jun 11, 2019
17269c2
updated parameters to be consistent with other languages
daniel-sanche Jun 11, 2019
f688b38
resolved compiler errors
daniel-sanche Jun 11, 2019
4669433
got client working for development
daniel-sanche Jun 12, 2019
0894f76
added sample note
daniel-sanche Jun 12, 2019
c5cb60a
updated create_occurrence
daniel-sanche Jun 12, 2019
132fc5c
got pubsub working
daniel-sanche Jun 12, 2019
d5498f1
implemented poll_discovery_occurrence
daniel-sanche Jun 13, 2019
2e70dd2
use runtimeerror
daniel-sanche Jun 13, 2019
ca20894
implemented find_vulnerabilities and find_high_severity
daniel-sanche Jun 13, 2019
104c27a
moved imports into functions
daniel-sanche Jun 13, 2019
e2a7d35
replaces " with '
daniel-sanche Jun 13, 2019
37a6247
added comments to samples
daniel-sanche Jun 13, 2019
8144f75
use released libraries
daniel-sanche Jun 20, 2019
0c2e311
updated client creation in samples
daniel-sanche Jun 20, 2019
de15238
fixed broken tests
daniel-sanche Jun 20, 2019
bed1dcb
fixed linter issues
daniel-sanche Jun 20, 2019
95ba536
Merge branch 'master' into container-analysis-ga
daniel-sanche Jun 20, 2019
2940dda
updated topic
daniel-sanche Jul 3, 2019
fdd94cc
added README
daniel-sanche Jul 3, 2019
6c252b3
fixed typo
daniel-sanche Jul 3, 2019
e8f79f8
readme fixes
daniel-sanche Jul 4, 2019
67f2b0f
updated pubsub version
daniel-sanche Jul 4, 2019
601dbb5
reverted pubsub topic
daniel-sanche Jul 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions container_registry/container_analysis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv*
59 changes: 59 additions & 0 deletions container_registry/container_analysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google
Cloud Platform logo" title="Google Cloud Platform" align="right" height="96"
width="96"/>

# Google Cloud Container Analysis Samples


Container Analysis scans container images stored in Container Registry for vulnerabilities.
Continuous automated analysis of containers keep you informed about known vulnerabilities so
that you can review and address issues before deployment.

Additionally, third-party metadata providers can use Container Analysis to store and
retrieve additional metadata for their customers' images, such as packages installed in an image.


## Description

These samples show how to use the [Google Cloud Container Analysis Client Library](https://cloud.google.com/container-registry/docs/reference/libraries).

## Build and Run
1. **Enable APIs** - [Enable the Container Analysis API](https://console.cloud.google.com/flows/enableapi?apiid=containeranalysis.googleapis.com)
and create a new project or select an existing project.
1. **Install and Initialize Cloud SDK**
Follow instructions from the available [quickstarts](https://cloud.google.com/sdk/docs/quickstarts)
1. **Clone the repo** and cd into this directory

```
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples
$ cd python-docs-samples/container-registry/container-analysis
```

1. **Install Dependencies**

```
$ python3 -m venv ./venv
$ source ./venv/bin/activate
$ pip install -r requirements.txt
```

1. **Set Environment Variables**

```
$ export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOOGLE_CLOUD_PROJECT -> GCLOUD_PROJECT

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should users also set their application credentials here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that required? I don't have it set in my terminal and it's working, I assume because I authenticated locally with "gcloud login"

I'm not really sure how much detail is required for set up here, so I copied this readme from a different project

```

1. **Run Tiests**

```
$ python -m pytest ./samples_test.py
```

## Contributing changes

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)

## Licensing

* See [LICENSE](../../LICENSE)

6 changes: 6 additions & 0 deletions container_registry/container_analysis/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
google-cloud-pubsub == 0.30.0
google-cloud-containeranalysis == 0.1.0
grafeas == 0.1.0
pytest
flaky
mock
Loading