GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - stackrox/scanner

BranchesTags
Open more actions menu

Latest commit

 

History

2,766 Commits
2,766 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.konflux
.konflux
 
 
.openshift-ci
.openshift-ci
 
 
.tekton
.tekton
 
 
api
api
 
 
benchmarks
benchmarks
 
 
bin
bin
 
 
chart
chart
 
 
cmd
cmd
 
 
cpe
cpe
 
 
database
database
 
 
e2etests
e2etests
 
 
ext
ext
 
 
generated
generated
 
 
image
image
 
 
img
img
 
 
istio/cache
istio/cache
 
 
k8s/cache
k8s/cache
 
 
localdev
localdev
 
 
make
make
 
 
pkg
pkg
 
 
proto/scanner/api/v1
proto/scanner/api/v1
 
 
rendered-chart
rendered-chart
 
 
scale
scale
 
 
scripts
scripts
 
 
singletons
singletons
 
 
testdata
testdata
 
 
testimages/package-removal
testimages/package-removal
 
 
third_party/googleapis/google/api
third_party/googleapis/google/api
 
 
tools
tools
 
 
.containerignore
.containerignore
 
 
.dockerignore
.dockerignore
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
.ossls.yml
.ossls.yml
 
 
.syft.yaml
.syft.yaml
 
 
BUILD_IMAGE_VERSION
BUILD_IMAGE_VERSION
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
rpms.in.yaml
rpms.in.yaml
 
 
rpms.lock.yaml
rpms.lock.yaml
 
 
rpms.rhel.repo
rpms.rhel.repo
 
 
status.sh
status.sh
 
 
worker.go
worker.go
 
 
worker_test.go
worker_test.go
 
 

Repository files navigation

Scanner

Red Hat Certified Image Scanner

Release Process

Scanner's release process does not have the same formalities as the rox repo at this time. However, we continually work to improve it.

Every release for rox comes with a new Scanner release.

Scanner releases follow semantic versioning, and each new Scanner release updates the minor version (ie 2.x.0). Only major, breaking changes will merit a bump to the major version, but this is unlikely to be the case in a normal release process.

Creating a new Minor Release

  1. Create a genesis dump.
  2. Create a new branch release/2.<new version>.x based on the latest master once the genesis dump is updated
  3. Create a new tag/release based on the new branch
  4. Add release notes based on the changes between the previous release and this one
  5. Once the latest image is built in CI, update the SCANNER_VERSION file in the rox repo

Creating Genesis Dump

The purpose of the gensis dump is to embed the new release of Scanner with the most up-to-date vulnerability data, and reduce its startup time since only diffs will be fetched from the network, rather than the whole vulnerability content.

To run this:

  • You have permissions to the related gcloud buckets,
  • You have gsutils working locally.

Steps:

  1. Look into the most recently completed run of the update-dumps-hourly workflow, and pick its ID.
  2. Run make genesis-dump WORKFLOW=<workflow-id>. This will download the latest vulnerability data from the build, generate all the artifacts and diffs.
  3. Run make genesis-dump-commit WORKFLOW=<workflow-id>. This will upload the artifacts to gcloud and add a new entry to image/scanner/dump/genesis-manifests.json in a branch called genesis-dump/YEAR-MONTH-DAY.

You can also run make genesis-dump-all WORKFLOW=<workflow-id> to run the last two steps at once.

Finally:

  • Review the changes in genesis-dump/YEAR-MONTH-DAY.
  • Push genesis-dump/YEAR-MONTH-DAY to origin and create a PR (example).
  • Add the generate-dumps-on-pr label to the PR.

Then, the CircleCI jobs on the PR should generate a diff.zip inside a definitions.stackrox.io bucket named with the UUID used in the entry appended to genesis-manifest.json file. Scanners will use it for updates once the PR is merged.

Full details at Red Hat's engineering wiki.

Creating a new Patch Release

  1. Merge any updates into the master branch
  2. Once merged, git cherry-pick the commit(s) into the relevant release branch(es)

Note: There is no genesis-dump update for patch releases (unless the patch, itself, requires it)

Building

Prerequisites

  • Make
  • Go
    • Get the version specified in go.mod
  • Various tools that can be installed with make reinstall-dev-tools.
    • Running the reinstall is especially important to do if you tend to switch between this and rox.

Steps

If this is your first time, run the following:

$ make build-updater
$ ./bin/updater generate-dump --out-file image/scanner/dump/dump.zip
$ unzip image/scanner/dump/dump.zip -d image/scanner/dump
$ gsutil cp gs://stackrox-scanner-ci-vuln-dump/pg-definitions.sql.gz image/db/dump/definitions.sql.gz
$ make image

For any other time, just run make image.

Updating CI base image

The Scanner repository relies on the images built in https://github.com/stackrox/rox-ci-image for CI. Sometimes, it is necessary to update the image used (for example, to build Scanner with an updated Go version).

To do this, only the following is necessary:

  • Update BUILD_IMAGE_VERSION
  • Update .openshift-ci/Dockerfile.build_root

There are other references to apollo-ci images within .openshift-ci/build. It is not necessary to update those for CI, as OpenShift CI will NOT use the FROM inside the respective Dockerfile.

Testing

There are various unit tests and bench tests scattered around the codebase.

On top of that, there are E2E tests defined in the e2etests/ directory, and there are some DB integration tests defined in database/psql.

Unit Tests

To run these, simply run make unit-tests

Bench Tests

There are several ways to run benchmarks. For the best results, run these tests via the command line, as you will have more control over the settings.

To run go benchmarks, run the following:

// Run all benchmarks
$ go test -run=^$ -bench=. ./...

// Only run a specific benchmark for 2 minutes
$ go test -run=^$ -bench=^BenchmarkSpecific$ -benchtime=2m ./<PATH_TO_DIRECTORY_WITH_TEST>

// Gather profiles for specific benchmark
$ go test -run=^$ -bench=^BenchmarkSpecific$ -benchmem -memprofile memprofile.out -cpuprofile cpuprofile.out ./<PATH_TO_DIRECTORY_WITH_TEST>

E2E Tests

E2E tests run in CI upon every commit. Sometimes, changes are made which affect the genesis dumps. To test these, simple add the generate-dumps-on-pr label to your PR.

DB Integration Tests

DB integration tests also run in CI upon every commit. However, to test these locally, be sure to install PostgreSQL 12 and run it prior to running the tests.

Updating the StackRox feed

Currently, the StackRox GCS bucket contains vulnerabilities for old Debian releases. To add to this:

  • Find the latest genesis dump which contains vulnerabilities for the Debian version in question.
    • For example: https://github.com/stackrox/scanner/actions/runs/9730826138
  • Download the genesis-dump
  • Unzip it then run the following (change the version, as needed):
    • cat os_vulns.json | jq '[ .[] | select(.Namespace != null) | select(.Namespace.Name == "debian:10") ]' > debian10.json
  • Sanity check the number of vulns via (change the version, as needed):
    • cat debian10.json | jq length
    • This should be a single, large number (tens of thousands)
  • Upload to the stackrox-scanner-feed bucket

About

No description, website, or topics provided.

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct
Activity
Custom properties

Stars

44 stars

Watchers

4 watching

Forks

18 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.