mirror of
https://github.com/docker/docs.git
synced 2026-03-29 15:28:51 +07:00
scout: add generic environment integration, cli
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
@@ -38,6 +38,7 @@ To add environments to Docker Scout, you can:
|
||||
Docker Scout supports the following runtime integrations:
|
||||
|
||||
- [Docker Scout GitHub Action](https://github.com/marketplace/actions/docker-scout#record-an-image-deployed-to-a-stream-environment)
|
||||
- [CLI client](./cli.md)
|
||||
|
||||
> **Note**
|
||||
>
|
||||
|
||||
112
content/scout/integrations/environment/cli.md
Normal file
112
content/scout/integrations/environment/cli.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
description: Integrate your runtime environments with Docker Scout using the CLI client
|
||||
keywords: docker scout, integration, image analysis, runtime, workloads, cli, environments
|
||||
title: Generic environment integration with CLI
|
||||
---
|
||||
|
||||
{{< include "scout-early-access.md" >}}
|
||||
|
||||
You can create a generic environment integration by running the Docker Scout
|
||||
CLI client in your CI workflows. The CLI client is available as a binary on
|
||||
GitHub and as a container image on Docker Hub. Use the client to invoke the
|
||||
`docker scout environment` command to assign your images to environments.
|
||||
|
||||
For more information about how to use the `docker scout environment` command,
|
||||
refer to the [CLI reference](../../../engine/reference/commandline/scout_environment.md).
|
||||
|
||||
## Examples
|
||||
|
||||
Before you start, set the following environment variables in your CI system:
|
||||
|
||||
- `DOCKER_SCOUT_HUB_USER`: your Docker Hub username
|
||||
- `DOCKER_SCOUT_HUB_PASSWORD`: your Docker Hub personal access token
|
||||
|
||||
Make sure the variables are accessible to your project.
|
||||
|
||||
{{< tabs >}}
|
||||
{{< tab name="Circle CI" >}}
|
||||
|
||||
```yaml
|
||||
version: 2.1
|
||||
|
||||
jobs:
|
||||
record_environment:
|
||||
machine:
|
||||
image: ubuntu-2204:current
|
||||
image: namespace/repo
|
||||
steps:
|
||||
- run: |
|
||||
if [[ -z "$CIRCLE_TAG" ]]; then
|
||||
tag="$CIRCLE_TAG"
|
||||
echo "Running tag '$CIRCLE_TAG'"
|
||||
else
|
||||
tag="$CIRCLE_BRANCH"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH'"
|
||||
fi
|
||||
echo "tag = $tag"
|
||||
- run: docker run -it \
|
||||
-e DOCKER_SCOUT_HUB_USER=$DOCKER_SCOUT_HUB_USER \
|
||||
-e DOCKER_SCOUT_HUB_PASSWORD=$DOCKER_SCOUT_HUB_PASSWORD \
|
||||
docker/scout-cli:1.0.2 environment \
|
||||
--org "<MY_DOCKER_ORG>" \
|
||||
"<ENVIRONMENT>" ${image}:${tag}
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab name="GitLab" >}}
|
||||
|
||||
The following example uses the [Docker executor](https://docs.gitlab.com/runner/executors/docker.html).
|
||||
|
||||
```yaml
|
||||
variables:
|
||||
image: namespace/repo
|
||||
|
||||
record_environment:
|
||||
image: docker/scout-cli:1.0.2
|
||||
script:
|
||||
- |
|
||||
if [[ -z "$CI_COMMIT_TAG" ]]; then
|
||||
tag="latest"
|
||||
echo "Running tag '$CI_COMMIT_TAG'"
|
||||
else
|
||||
tag="$CI_COMMIT_REF_SLUG"
|
||||
echo "Running on branch '$CI_COMMIT_BRANCH'"
|
||||
fi
|
||||
echo "tag = $tag"
|
||||
- environment --org <MY_DOCKER_ORG> "PRODUCTION" ${image}:${tag}
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< tab name="Azure DevOps" >}}
|
||||
|
||||
```yaml
|
||||
trigger:
|
||||
- main
|
||||
|
||||
resources:
|
||||
- repo: self
|
||||
|
||||
variables:
|
||||
tag: "$(Build.BuildId)"
|
||||
image: "namespace/repo"
|
||||
|
||||
stages:
|
||||
- stage: Docker Scout
|
||||
displayName: Docker Scout environment integration
|
||||
jobs:
|
||||
- job: Record
|
||||
displayName: Record environment
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
- task: Docker@2
|
||||
- script: docker run -it \
|
||||
-e DOCKER_SCOUT_HUB_USER=$DOCKER_SCOUT_HUB_USER \
|
||||
-e DOCKER_SCOUT_HUB_PASSWORD=$DOCKER_SCOUT_HUB_PASSWORD \
|
||||
docker/scout-cli:1.0.2 environment \
|
||||
--org "<MY_DOCKER_ORG>" \
|
||||
"<ENVIRONMENT>" $(image):$(tag)
|
||||
```
|
||||
|
||||
{{< /tab >}}
|
||||
{{< /tabs >}}
|
||||
@@ -1986,6 +1986,8 @@ Manuals:
|
||||
section:
|
||||
- title: Overview
|
||||
path: /scout/integrations/environment/
|
||||
- title: Generic
|
||||
path: /scout/integrations/environment/cli/
|
||||
- sectiontitle: Container registries
|
||||
section:
|
||||
- title: Artifactory
|
||||
|
||||
Reference in New Issue
Block a user