Skip to content

Commit

Permalink
SC-15838: Scheduled job for image vulnerabilities detection
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderM91 committed Oct 12, 2023
1 parent 3e4a94f commit ce85084
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Vulnerability detection

on:
schedule:
- cron: '0 9 * * *'
push:
branches-ignore:
- master
Expand Down Expand Up @@ -74,6 +76,45 @@ jobs:
- run: |
echo "${{ steps.docker-scan.outputs.total }} total vulnerabilities."
- name: Set Date and Time
id: set-date
run: echo "::set-output name=current_datetime::$(date +'%Y-%m-%d %H:%M:%S')"

- name: Set Color
id: set-color
run: |
if [[ "${{ true }}" ]]; then
COLOR="#008000"
else
COLOR="#ff0000"
fi
echo "::set-output name=color::$COLOR"
- name: Send GitHub Action trigger data to Slack workflow
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Scanned image tag *${{ matrix.tags }}*.",
"attachments": [
{
"pretext": "Vulnerability scan outputs for ${{ steps.set-date.outputs.current_datetime }}",
"color": "${{ steps.set-color.outputs.color }}",
"fields": [
{
"title": "Status",
"short": true,
"value": "*${{ steps.docker-scan.outputs.total }}* total vulnerabilities"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: Fail the execution
if: ${{ steps.docker-scan.outputs.total > 0 }}
run: exit 1

0 comments on commit ce85084

Please sign in to comment.