Skip to content

Commit

Permalink
Build px4 coverity scan image
Browse files Browse the repository at this point in the history
  • Loading branch information
TimoSairiala committed Jul 31, 2023
1 parent 36286e4 commit 7c88f0c
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/tiiuae-coverity-scan-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: tiiuae-builder-images

on:
# REMOVE BEFORE MERGE:
push:
# Run only manually
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
coverity-scan-image:
name: create coverity scan image
runs-on: ubuntu-latest
steps:
- name: Checkout px4-firmware
uses: actions/checkout@v3
with:
path: px4-firmware
fetch-depth: 0
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/tiiuae/px4-coverity-scan-image
tags: |
type=raw,value=latest
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: take a look
run: ls -al
- name: Build and push coverity scan image
uses: docker/build-push-action@v4
with:
context: .
file: ./px4-firmware/packaging/Dockerfile.coverity
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"COVERITY_DOCKER_REGISTRY_USERNAME=${{ secrets.COVERITY_DOCKER_REGISTRY_USERNAME }}"
"COVERITY_DOCKER_REGISTRY_ACCESS_TOKEN=${{ secrets.COVERITY_DOCKER_REGISTRY_ACCESS_TOKEN }}"
"COVERITY_LICENSE_DAT_B64=${{ secrets.COVERITY_LICENSE_DAT_B64 }}"
"COVERITY_ACCESS_TOKEN_B64=${{ secrets.COVERITY_ACCESS_TOKEN_B64 }}"
26 changes: 26 additions & 0 deletions packaging/Dockerfile.coverity
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM ghcr.io/tiiuae/px4-firmware-builder-base:latest

# coverity docker registry access token to download coverity tool
# for more details refer to confluence page "Coverity docker scan"
# https://ssrc.atlassian.net/wiki/spaces/DRON/pages/705823997/Coverity+docker+scan
ARG COVERITY_DOCKER_REGISTRY_USERNAME
ARG COVERITY_DOCKER_REGISTRY_ACCESS_TOKEN

# coverity license file to run coverity tool
ARG COVERITY_LICENSE_DAT_B64
RUN echo "$COVERITY_LICENSE_DAT_B64" | base64 -d > /license.dat

# access token for our internal server
ARG COVERITY_ACCESS_TOKEN_B64
RUN echo "$COVERITY_ACCESS_TOKEN_B64" | base64 -d > /auth_key.txt
RUN chmod 400 /auth_key.txt

# - download coverity installer package
# - chmod and run the installer
# - remove installation package to reduce image size
RUN curl https://sig-repo.synopsys.com/artifactory/coverity-releases/2023.6.0/cov-analysis-linux64-2023.6.0.sh -o /coverity_install.sh -u ${COVERITY_DOCKER_REGISTRY_USERNAME}:${COVERITY_DOCKER_REGISTRY_ACCESS_TOKEN} \
&& chmod +x /coverity_install.sh \
&& /coverity_install.sh -q --installation.dir=/cov --license.region=6 --license.agreement=agree --license.type.choice=0 --license.cov.path=/license.dat \
&& rm /coverity_install.sh

ENTRYPOINT [ "entrypoint_coverity.sh" ]
10 changes: 10 additions & 0 deletions packaging/coverity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
capture:
build:
build-command: packaging/build_px4fw.sh ssrc_saluki-v2_default

commit:
connect:
auth-key-file: /auth_key.txt
stream: px4-coverity-test
url: https://coverity.ssrc.fi:443/
on-new-cert: trust

0 comments on commit 7c88f0c

Please sign in to comment.