|
| 1 | +# Copyright 2022 Contributors to the Eclipse Foundation |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | +# SPDX-License-Identifier: Apache-2.0 |
| 16 | + |
| 17 | +name: OCaaS Compliance checks |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - main |
| 23 | + pull_request: |
| 24 | + branches: |
| 25 | + - main |
| 26 | + workflow_dispatch: |
| 27 | + |
| 28 | +jobs: |
| 29 | + ocaas-scan: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + if: github.repository_owner == 'SoftwareDefinedVehicle' |
| 32 | + steps: |
| 33 | + - name: setup env variables for OCaaS |
| 34 | + run: | |
| 35 | + echo "VCS_REVISION=${{ github.ref_name }}" >> $GITHUB_ENV |
| 36 | + - name: use different VCS_REVISION for pull requests |
| 37 | + if: github.event_name == 'pull_request' |
| 38 | + run: | |
| 39 | + echo "Workflow triggered by pull request. Scanning source branch only as merge revisions are not supported." |
| 40 | + echo "VCS_REVISION=${{ github.head_ref }}" >> $GITHUB_ENV |
| 41 | + - name: OCaaS Scans |
| 42 | + id: ocaas |
| 43 | + uses: docker://osmipublic.azurecr.io/ocaas-ci:latest |
| 44 | + continue-on-error: true # Built artifacts also should also be uploaded if the scan finds violations. |
| 45 | + with: |
| 46 | + args: auth generate-token run start download |
| 47 | + env: |
| 48 | + OCAAS_USERNAME: ${{ secrets.OCAAS_USERNAME }} |
| 49 | + OCAAS_PASSWORD: ${{ secrets.OCAAS_PASSWORD }} |
| 50 | + PROJECT_NAME: "Project LEDA - sdv-self-update-agent" |
| 51 | + PIPELINE_ID: 377 # Your pipeline ID. Provided by the OSMI team. |
| 52 | + VCS_URL: ${{ github.server_url }}/${{ github.repository }}.git |
| 53 | + # VCS_REVISION: is defined before |
| 54 | + APPLICATION_CATEGORY: "BT11" |
| 55 | + BLOCKING: true |
| 56 | + REPORT_FILES: DISCLOSURE_DOCUMENT_PDF,VULNERABILITY_REPORT_PDF,SCAN_REPORT_WEB_APP_HTML |
| 57 | + OUTPUT_DIR: reports/ |
| 58 | + - name: Upload reports |
| 59 | + id: upload |
| 60 | + uses: actions/upload-artifact@v3 |
| 61 | + with: |
| 62 | + name: reports |
| 63 | + path: reports/ |
| 64 | + - name: Check for violations |
| 65 | + if: steps.ocaas.outcome != 'success' || steps.upload.outcome != 'success' |
| 66 | + run: exit 1 |
| 67 | + |
0 commit comments