Make trivy scan tentative to overcome rate limits #5620
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
# Copyright 2020 JanusGraph Authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: CI Release | |
on: | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/ci-docs.yml' | |
- '.github/ISSUE_TEMPLATE/**' | |
- 'requirements.txt' | |
- 'mkdocs.yml' | |
- 'docs.Dockerfile' | |
- '*.md' | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/ci-docs.yml' | |
- '.github/ISSUE_TEMPLATE/**' | |
- 'requirements.txt' | |
- 'mkdocs.yml' | |
- 'docs.Dockerfile' | |
- '*.md' | |
branches-ignore: | |
- 'dependabot/**' | |
schedule: | |
- cron: '0 0 * * 3' | |
env: | |
ES_JAVA_OPTS: "-Xms256m -Xmx512m" | |
BUILD_MAVEN_OPTS: "-DskipTests=true --batch-mode --also-make" | |
VERIFY_MAVEN_OPTS: "-Pcoverage" | |
jobs: | |
build-all: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: "8.0.382+5" | |
distribution: zulu | |
- run: mvn clean install --projects janusgraph-all -Pjanusgraph-cache -Dmaven.javadoc.skip=true ${{ env.BUILD_MAVEN_OPTS }} | |
- run: mvn verify --projects janusgraph-all -Pjanusgraph-cache ${{ env.VERIFY_MAVEN_OPTS }} | |
dist-tests: | |
runs-on: ubuntu-22.04 | |
needs: build-all | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- args: "" | |
java: 8 | |
tag_suffix: "" | |
- args: "-Pjava-11" | |
java: 11 | |
tag_suffix: "-java-11" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: actions/setup-java@v4 | |
if: "matrix.java == 8" | |
with: | |
java-version: "8.0.382+5" | |
distribution: zulu | |
- uses: actions/setup-java@v4 | |
if: "matrix.java == 11" | |
with: | |
java-version: "11.0.20+1" | |
distribution: zulu | |
- run: sudo apt-get update && sudo apt-get install -y expect | |
- run: mvn clean install -Pjanusgraph-release ${{ env.BUILD_MAVEN_OPTS }} -Dgpg.skip=true ${{ matrix.args }} | |
- run: mvn verify -pl janusgraph-dist -Pjanusgraph-release -Dgpg.skip=true ${{ matrix.args }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: distribution-build-full-java-${{ matrix.java }} | |
path: janusgraph-dist/target/janusgraph-full-*.zip | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: distribution-build-core-java-${{ matrix.java }} | |
path: janusgraph-dist/target/janusgraph-[!full]*.zip | |
- name: Set JanusGraph version environment variable | |
run: | | |
export JG_VER="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)-$(git rev-parse --short HEAD)" | |
echo "JG_VER=${JG_VER}" >> $GITHUB_ENV | |
- name: Run Trivy vulnerability scanner | |
id: trivy_scan_step | |
if: github.repository == 'janusgraph/janusgraph' | |
# TODO: currently this step is tentative because of the rate-limiting issue. | |
# Thus, we add `continue-on-error: true` here, but we should remove it | |
# when either the issue is fixed (see: https://github.com/aquasecurity/trivy-action/issues/389) | |
# or we self-host trivy database. | |
uses: aquasecurity/[email protected] | |
continue-on-error: true | |
with: | |
image-ref: 'ghcr.io/janusgraph/janusgraph:${{ env.JG_VER }}${{ matrix.tag_suffix }}' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Trivy scan results to GitHub Security tab | |
if: github.repository == 'janusgraph/janusgraph' && success() && steps.trivy_scan_step.outcome == 'success' | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: 'trivy-results.sarif' | |
tp-tests: | |
runs-on: ubuntu-22.04 | |
if: "github.event_name == 'push' && contains(github.event.head_commit.message, '[tp-tests]') || github.event_name == 'pull_request' && contains(github.event.pull_request.title, '[tp-tests]') || github.event_name == 'schedule'" | |
needs: build-all | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- module: inmemory | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 8 | |
- module: berkeleyje | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 8 | |
- module: cql | |
args: "-Pcassandra3-byteordered -Dtest.skip.tp=false -DskipTests=true" | |
java: 8 | |
- module: cql | |
args: "-Pcassandra3-murmur -Dtest.skip.tp=false -DskipTests=true" | |
java: 8 | |
- module: hbase | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 8 | |
- module: inmemory | |
install-args: "-Pjava-11" | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: berkeleyje | |
install-args: "-Pjava-11" | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: cql | |
install-args: "-Pjava-11" | |
args: "-Pcassandra3-byteordered -Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: cql | |
install-args: "-Pjava-11" | |
args: "-Pcassandra3-murmur -Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: cql | |
install-args: "-Pjava-11" | |
args: "-Pcassandra4-byteordered -Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: cql | |
install-args: "-Pjava-11" | |
args: "-Pcassandra4-murmur -Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
- module: hbase | |
install-args: "-Pjava-11" | |
args: "-Dtest.skip.tp=false -DskipTests=true" | |
java: 11 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: actions/setup-java@v4 | |
if: "matrix.java == 8" | |
with: | |
java-version: "8.0.382+5" | |
distribution: zulu | |
- uses: actions/setup-java@v4 | |
if: "matrix.java == 11" | |
with: | |
java-version: "11.0.20+1" | |
distribution: zulu | |
- run: mvn clean install --projects janusgraph-${{ matrix.module }} ${{ env.BUILD_MAVEN_OPTS }} ${{ matrix.install-args }} | |
- run: mvn verify --projects janusgraph-${{ matrix.module }} ${{ matrix.install-args }} ${{ matrix.args }} |