Merge pull request #52 from COPRS/pcuq-ads-esa-clause6 #19
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: PS2 Docker build (releases) | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release/**' | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]" | |
workflow_dispatch: { } | |
env: | |
REGISTRY_USER: ${{ secrets.ARTIFACTORY_USER }} | |
REGISTRY_PWD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
REGISTRY_BASE: artifactory.coprs.esa-copernicus.eu | |
REGISTRY_PROJECT: rs-docker-private | |
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} | |
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
SCAN_SEVERITY: 'CRITICAL,HIGH' | |
SCAN_EXIT_CODE: '0' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # fetch all history so multiple commits can be scanned | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Set up environment | |
run: | | |
# Sonar | |
echo "SONARQUBE_HOST=${{ env.SONARQUBE_HOST }}" >> $GITHUB_ENV | |
echo "SONARQUBE_TOKEN=${{ env.SONARQUBE_TOKEN }}" >> $GITHUB_ENV | |
# Git | |
GIT_BRANCH=${{ github.ref_name }} | |
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV | |
echo Building branch : $GIT_BRANCH | |
# Set version for docker tasks | |
echo "BUILD_VERSION=$(grep "version = " apps/build.gradle | cut -d"'" -f 2)" >> $GITHUB_ENV | |
- name: Log into registry ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PWD }} | |
- name: Build base docker images | |
run: | | |
docker build . -f apps/execution/docker/Dockerfile_s2-ipf-l0u-jdk17 -t s2-ipf-l0u-jdk17 | |
docker build . -f apps/execution/docker/Dockerfile_s2level0-jdk17 -t s2level0-jdk17 | |
docker build . -f apps/execution/docker/Dockerfile_s2level1-jdk17 -t s2level1-jdk17 | |
docker build . -f apps/execution/docker/Dockerfile_s2level2-jdk17 -t s2level2-jdk17 | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean build sonar bootBuildImage docker | |
- name: Remove base docker images | |
run: | | |
docker rmi s2level0-jdk17 s2-ipf-l0u-jdk17 s2level1-jdk17 s2level2-jdk17 --force | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0u:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: pw-l0u_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0u:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0u:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0c:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: pw-l0c_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0c:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l0c:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1s:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: pw-l1s_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1s:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1s:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1c:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: pw-l1c_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1c:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l1c:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l2:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: pw-l2_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l2:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/pw-l2:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0u:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l0u_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0u:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0u:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0c:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l0c_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0c:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l0c:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sa:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l1sa_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sa:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sa:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sb:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l1sb_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sb:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1sb:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1ab:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l1ab_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1ab:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1ab:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1c:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l1c_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1c:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l1c:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-ds:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l2-ds_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-ds:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-ds:${{ env.BUILD_VERSION }} | |
- name: Docker security scan | |
uses: COPRS/reference-system-software@trivy-security-scan-v1 | |
with: | |
IMAGE_REF: ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-tl:${{ env.BUILD_VERSION }} | |
ARTIFACT_NAME: ew-l2-tl_${{ env.BUILD_VERSION }} | |
EXIT_CODE: ${{ env.SCAN_EXIT_CODE }} | |
SEVERITY: ${{ env.SCAN_SEVERITY }} | |
- name: Push and clean docker image | |
run: | | |
docker image push ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-tl:${{ env.BUILD_VERSION }} | |
docker rmi -f ${{ env.REGISTRY_BASE }}/${{ env.REGISTRY_PROJECT }}/ew-l2-tl:${{ env.BUILD_VERSION }} |