Skip to content

Commit

Permalink
Container Analysis samples [(#2258)](GoogleCloudPlatform/python-docs-…
Browse files Browse the repository at this point in the history
…samples#2258)

added container analysis samples and tests
  • Loading branch information
daniel-sanche committed Jul 9, 2019
0 parents commit 75c825a
Show file tree
Hide file tree
Showing 5 changed files with 728 additions and 0 deletions.
1 change: 1 addition & 0 deletions samples/snippets/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
venv*
54 changes: 54 additions & 0 deletions samples/snippets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<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. **Authenticate with GCP**
- Typically, you should authenticate using a [service account key](https://cloud.google.com/docs/authentication/getting-started)
1. **Clone the repo** and cd into this directory

```
git clone https://github.com/GoogleCloudPlatform/python-docs-samples
cd python-docs-samples
```

1. **Set Environment Variables**

```
export GCLOUD_PROJECT="YOUR_PROJECT_ID"
```

1. **Run Tests**

```
nox -s "py36(sample='./container_registry/container_analysis')"
```

## Contributing changes

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

## Licensing

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

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

0 comments on commit 75c825a

Please sign in to comment.