feat(scanner): Write vulnerabilities and enrichments using iterators #38809
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- master | |
- release-* | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
go: | |
strategy: | |
matrix: | |
gotags: [ 'GOTAGS=""', 'GOTAGS=release' ] | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Cache Go dependencies | |
uses: ./.github/actions/cache-go-dependencies | |
- name: Go Unit Tests | |
run: ${{ matrix.gotags }} make go-unit-tests | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: go-unit-tests | |
- name: Generate junit report | |
if: always() | |
run: make generate-junit-reports | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'junit-reports/report.xml' | |
- name: Go Integration Unit Tests | |
run: ${{ matrix.gotags }} make integration-unit-tests | |
- name: Go Operator Integration Tests | |
run: ${{ matrix.gotags }} make -C operator/ test-integration | |
- name: Generate junit report | |
if: always() | |
run: make generate-junit-reports | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'junit-reports/report.xml' | |
- name: Report test failures to Jira | |
if: (!cancelled()) | |
uses: ./.github/actions/junit2jira | |
with: | |
create-jiras: ${{ github.event_name == 'push' }} | |
jira-token: ${{ secrets.JIRA_TOKEN }} | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
directory: 'junit-reports' | |
go-postgres: | |
strategy: | |
matrix: | |
gotags: [ 'GOTAGS=""', 'GOTAGS=release' ] | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Run Postgres | |
run: | | |
su postgres -c 'initdb -D /tmp/data' | |
su postgres -c 'pg_ctl -D /tmp/data start' | |
- name: Cache Go dependencies | |
uses: ./.github/actions/cache-go-dependencies | |
- name: Is Postgres ready | |
run: pg_isready -h 127.0.0.1 | |
- name: Go Unit Tests | |
run: ${{ matrix.gotags }} make go-postgres-unit-tests | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: go-unit-tests | |
- name: Generate junit report | |
if: always() | |
run: make generate-junit-reports | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'junit-reports/report.xml' | |
- name: Report junit failures in jira | |
if: (!cancelled()) | |
uses: ./.github/actions/junit2jira | |
with: | |
create-jiras: ${{ github.event_name == 'push' }} | |
jira-token: ${{ secrets.JIRA_TOKEN }} | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
directory: 'junit-reports' | |
go-bench: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Run Postgres | |
run: | | |
su postgres -c 'initdb -D /tmp/data' | |
su postgres -c 'pg_ctl -D /tmp/data start' | |
- name: Cache Go dependencies | |
uses: ./.github/actions/cache-go-dependencies | |
- name: Is Postgres ready | |
run: pg_isready -h 127.0.0.1 | |
- name: Go Bench Tests | |
run: make go-postgres-bench-tests | |
- name: Generate junit report | |
if: always() | |
run: make generate-junit-reports | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'junit-reports/report.xml' | |
# Do not create junit report for bench tests: | |
# https://github.com/jstemmer/go-junit-report/issues/174 | |
ui: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Create combined mono repo lock file | |
uses: ./.github/actions/create-concatenated-ui-monorepo-lock | |
- name: Cache UI dependencies | |
uses: ./.github/actions/cache-ui-dependencies | |
- name: UI Unit Tests | |
run: make ui-test | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: ui-unit-tests | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'ui/apps/platform/test-results/reports/*.xml' | |
- name: Report junit failures in jira | |
if: (!cancelled()) | |
uses: ./.github/actions/junit2jira | |
with: | |
create-jiras: ${{ github.event_name == 'push' }} | |
jira-token: ${{ secrets.JIRA_TOKEN }} | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
directory: 'ui/apps/platform/test-results/reports' | |
local-roxctl-tests: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Cache Go dependencies | |
uses: ./.github/actions/cache-go-dependencies | |
- uses: ./.github/actions/handle-tagged-build | |
- name: Local roxctl tests | |
run: ./scripts/ci/jobs/local-roxctl-tests.sh | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'roxctl-test-output/*.xml' | |
- name: Report junit failures in jira | |
if: (!cancelled()) | |
uses: ./.github/actions/junit2jira | |
with: | |
create-jiras: ${{ github.event_name == 'push' }} | |
jira-token: ${{ secrets.JIRA_TOKEN }} | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
directory: 'roxctl-test-output' | |
shell-unit-tests: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: Shell Unit Tests | |
run: make shell-unit-tests | |
- name: Publish Test Report | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: 'shell-test-output/*.xml' | |
- name: Report junit failures in jira | |
if: (!cancelled()) | |
uses: ./.github/actions/junit2jira | |
with: | |
create-jiras: ${{ github.event_name == 'push' }} | |
jira-token: ${{ secrets.JIRA_TOKEN }} | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
directory: 'shell-test-output' | |
openshift-ci-unit-tests: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.3.69 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ./.github/actions/job-preamble | |
with: | |
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }} | |
- name: OpenShift CI Wrapper Unit Tests | |
run: make -C .openshift-ci test | |
slack-on-unit-tests-failure: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_CI_INTEGRATION_TESTING_WEBHOOK: ${{ secrets.SLACK_CI_INTEGRATION_TESTING_WEBHOOK }} | |
TEST_FAILURES_NOTIFY_WEBHOOK: ${{ secrets.TEST_FAILURES_NOTIFY_WEBHOOK }} | |
if: | | |
failure() && ( | |
github.event_name == 'push' || | |
contains(github.event.pull_request.labels.*.name, 'ci-test-github-action-slack-messages') | |
) | |
name: Post failure message to Slack | |
runs-on: ubuntu-latest | |
needs: | |
- go | |
- go-bench | |
- go-postgres | |
- local-roxctl-tests | |
- openshift-ci-unit-tests | |
- shell-unit-tests | |
- ui | |
permissions: | |
actions: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Slack message | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: | | |
source scripts/ci/lib.sh | |
slack_workflow_failure |