.4.0: WIP on feature/opends-0.4.0 #297
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: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: set lower case $REPO_LC name | |
run: | | |
echo "REPO_LC=${REPO,,}" >> ${GITHUB_ENV} | |
env: | |
REPO: '${{ github.event.repository.name }}' | |
- name: Login to Public ECR | |
if: github.event_name != 'pull_request' | |
uses: docker/[email protected] | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Build image | |
run: | | |
docker build -t $REPO_LC data-model/ | |
- name: Trivy - List all vulnerabilities | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: '${{ github.event.repository.name }}' | |
format: 'table' | |
ignore-unfixed: true | |
vuln-type: 'os,library' | |
env: | |
TRIVY_SKIP_DB_UPDATE: true | |
TRIVY_SKIP_JAVA_DB_UPDATE: true | |
- name: Trivy - Stop on Severe Vulnerabilities | |
uses: aquasecurity/trivy-action@master | |
if: github.event_name == 'pull_request' | |
with: | |
image-ref: '${{ github.event.repository.name }}' | |
format: 'table' | |
ignore-unfixed: true | |
trivyignores: .github/workflows/.trivyignore | |
exit-code: '1' | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
env: | |
TRIVY_SKIP_DB_UPDATE: true | |
TRIVY_SKIP_JAVA_DB_UPDATE: true | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: public.ecr.aws/dissco/${{ env.REPO_LC }} | |
tags: | | |
type=sha | |
type=raw,value=latest | |
- name: Build and Push to ECR | |
uses: docker/build-push-action@v3 | |
with: | |
context: "{{defaultContext}}:data-model" | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Set outputs | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Push tag | |
if: github.event_name != 'pull_request' | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CUSTOM_TAG: sha-${{ steps.vars.outputs.sha_short }} |