mirror of
https://github.com/apache/struts.git
synced 2026-08-06 15:17:00 +00:00
Library updates for cve's, suppression cleanup and not fail github action job SonarCloud if SONARCLOUD_TOKEN not found (summary report instead). (#1667)
* OWASP + Github workflow updates * Library updates * Dependancy suppression cleanup * #1667 PR Review updates, use NIST_NVD_API_KEY when available else use mirror for forks not configured, remove workflow_call for now since we don't on call
This commit is contained in:
@@ -20,8 +20,11 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'develop'
|
||||
- 'release/*'
|
||||
- 'support/*'
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
@@ -31,9 +34,10 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test (JDK ${{ matrix.java }})${{ matrix.profile == '-Pjakartaee11' && ' with Jakarta EE 11' || matrix.profile }}
|
||||
name: Build and Test (JDK ${{ matrix.java }})${{ matrix.profile == '-Pjakartaee11' && ' (Jakarta EE 11 + Spring 7)' || matrix.profile }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- java: '17'
|
||||
@@ -44,6 +48,8 @@ jobs:
|
||||
profile: '-Pjakartaee11'
|
||||
- java: '25'
|
||||
profile: ''
|
||||
- java: '25'
|
||||
profile: '-Pjakartaee11'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
@@ -53,5 +59,16 @@ jobs:
|
||||
distribution: temurin
|
||||
java-version: ${{ matrix.java }}
|
||||
cache: 'maven'
|
||||
- name: Maven Verify on Java ${{ matrix.java }}${{ matrix.profile == '-Pjakartaee11' && ' (Jakarta EE 11)' || matrix.profile }}
|
||||
- name: Maven Verify on Java ${{ matrix.java }}${{ matrix.profile == '-Pjakartaee11' && ' (Jakarta EE 11 + Spring 7)' || matrix.profile }}
|
||||
run: mvn -B -V -DskipAssembly verify ${{ matrix.profile }} --no-transfer-progress
|
||||
|
||||
- name: Test Summary ${{ matrix.java }} ${{ matrix.profile }}
|
||||
uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 #v6.4.2
|
||||
continue-on-error: true
|
||||
if: always()
|
||||
with:
|
||||
annotate_only: true # forked repo cannot write to checks so just do annotations
|
||||
report_paths: |
|
||||
**/surefire-reports/TEST-*.xml
|
||||
**/failsafe-reports/TEST-*.xml
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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: OWASP checkup
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'develop'
|
||||
- 'release/*'
|
||||
- 'support/*'
|
||||
workflow_dispatch: #Allow manual triggers
|
||||
|
||||
permissions: read-all
|
||||
|
||||
env:
|
||||
MAVEN_OPTS: -Xmx2048m -Xms1024m
|
||||
LANG: en_US.utf8
|
||||
|
||||
jobs:
|
||||
|
||||
|
||||
owasp:
|
||||
name: OWASP
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HAVE_NIST_NVD_API_KEY: ${{ secrets.NIST_NVD_API_KEY != '' }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup Java 25
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 25
|
||||
cache: 'maven'
|
||||
|
||||
- name: Cache NVD Database
|
||||
id: cache-nvd
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: ~/.m2/repository/org/owasp/dependency-check-data
|
||||
key: nvd-cache-${{ runner.os }}-owasp-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
nvd-cache-${{ runner.os }}-owasp-
|
||||
nvd-cache-${{ runner.os }}-
|
||||
|
||||
- name: OWASP Dependency check update cache via NIST_NVD_API_KEY
|
||||
if: ${{ env.HAVE_NIST_NVD_API_KEY == 'true' }}
|
||||
run: mvn -N -V -DskipAssembly -Dmaven.test.skip=true -Powasp-nvd-api -Pdependency-update-only --no-transfer-progress
|
||||
env:
|
||||
NIST_NVD_API_KEY: ${{ secrets.NIST_NVD_API_KEY}}
|
||||
|
||||
- name: OWASP Dependency check update cache via Mirror
|
||||
if: ${{ env.HAVE_NIST_NVD_API_KEY == 'false' }}
|
||||
run: mvn -N -V -DskipAssembly -Dmaven.test.skip=true -Powasp-nvd-mirror -Pdependency-update-only --no-transfer-progress
|
||||
|
||||
- name: Cache NVD Database
|
||||
uses: actions/cache/save@v6
|
||||
if: ${{ always() }}
|
||||
with:
|
||||
path: ~/.m2/repository/org/owasp/dependency-check-data
|
||||
key: nvd-cache-${{ runner.os }}-owasp-${{ github.run_id }}
|
||||
|
||||
- name: OWASP check (Without running tests)
|
||||
run: mvn -B org.owasp:dependency-check-maven:aggregate -Pdependency-check -Pjakartaee11 --no-transfer-progress
|
||||
|
||||
- name: Upload Dependency Check reports
|
||||
uses: actions/upload-artifact@v7
|
||||
if: always()
|
||||
with:
|
||||
name: dependency-check
|
||||
path: target/dependency-check*
|
||||
|
||||
- name: Add OWASP summary
|
||||
if: always()
|
||||
run: |
|
||||
{
|
||||
echo "## OWASP Dependency Check"
|
||||
echo ""
|
||||
echo "The HTML report has been uploaded as the **dependency-check** artifact."
|
||||
echo "Download it from the Artifacts section of this workflow run."
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -26,6 +26,7 @@ permissions: read-all
|
||||
env:
|
||||
MAVEN_OPTS: -Xmx2048m -Xms1024m
|
||||
LANG: en_US.utf8
|
||||
HAVE_SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN != '' }}
|
||||
|
||||
jobs:
|
||||
sonarcloud:
|
||||
@@ -41,7 +42,14 @@ jobs:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
cache: 'maven'
|
||||
- env:
|
||||
- name: SonarCloud Scan
|
||||
if: ${{ env.HAVE_SONARCLOUD_TOKEN == 'true' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
|
||||
run: ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -DskipAssembly
|
||||
- name: SonarCloud Scan -- SKIPPED
|
||||
if: ${{ env.HAVE_SONARCLOUD_TOKEN != 'true' }}
|
||||
run: |
|
||||
echo "### SonarCloud not configured" >> $GITHUB_STEP_SUMMARY
|
||||
echo "secrets.SONARCLOUD_TOKEN not existing, cannot push coverage checks" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user