Prerequisites
- An OpenShift cluster accessible or a local cluster using Minishift or oc cluster up
- Docker CLI installed
- Create an account on quay.io
- Create a fork of https://github.com/cricci82/hello-world-instrumented
Create a private repository
- Git clone the hello-world-instrumented git repository
- Log into quay.io with docker cli
$ docker login quay.io
- Build the hello-world-instrumented container and push to your quay.io repository
$ docker build -t quay.io/<org_name>/hello-world-instrumented:v1 .
$ docker push quay.io/<org_name>/hello-world-instrumented:v1
- From quay.io navigate to the newly created hello-world-instrumented repository. Notice it is Private by default
Configure Build Trigger
- Navigate to Build section of the repository and Create Build Trigger
- Select your GitHub organization and hello-world-instrumented repository
- Choose the strategy for triggering builds. Optionally, filter on a specific branch or tag
- Optionally, if the base image in the Dockerfile is private you must specify a robot account that has access to pull this image.
- Commit a code change and verify that a build is triggered
Configure Pull Secret for OpenShift
- Navigate to the settings for the hello-world-instrumented repository in Quay.io and create a robot account with read permissions.
- Click on the newly created robot account. Select Kubernetes Secret and download the yaml file
- From the CLI, create the secret from the yaml file and link to the default service account in the OpenShift Project
$ oc new-project hello-world-instrumented
$ oc create -f path/to/downloaded/secret.yaml
$ oc secrets link default <name of secret> --for=pull
- Deploy the container and verify it successfully pulls
$ oc new-app quay.io/<org_name>/hello-world-instrumented:v1
Explore the vulnerability scan results
- From the Tags section of the repository, click on the security scan results
- Back on the repository settings, create a notification for when vulnerabilities are discovered
- Select Medium vulnerability and choose email as the notification method. Verify the selected email address if required.
- Change the base image in the Dockerfile to
python:3.7-rc
and commit the change to trigger a new build. - The new build should contain several high vulnerabilities. Verify that the email is triggered once the scan completes
Explore Time Machine
- Navigate to the Tags section of the repository
- Select one of the tags and delete it
- Navigate to Tag History to view the changes to image tags
- On the delete event, click on the link to restore the tag
- Navigate back to the Tags section and observe that the tag has been restored