Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8df64adaea | |||
| 6b112b97a4 | |||
| aa5f6b016b | |||
| 4aac8c502a | |||
| d449fc3481 |
@@ -1,13 +1,10 @@
|
|||||||
name: build-image
|
name: build-image
|
||||||
run-name: build and push Docker-Image
|
run-name: build and push Docker-Image with tag:${{ github.ref_name }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # Manuelles Auslösen des Workflows
|
push:
|
||||||
inputs:
|
tags:
|
||||||
image_tag:
|
- "*"
|
||||||
description: '2. Tag für das Docker-Image (z.B. 1.0.0)'
|
|
||||||
required: true
|
|
||||||
default: '0.3.0'
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
image_name: doc_rudi
|
image_name: doc_rudi
|
||||||
@@ -42,5 +39,32 @@ jobs:
|
|||||||
--file ./Dockerfile \
|
--file ./Dockerfile \
|
||||||
--platform linux/amd64,linux/386,linux/arm64,linux/arm/v7 \
|
--platform linux/amd64,linux/386,linux/arm64,linux/arm/v7 \
|
||||||
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:latest \
|
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:latest \
|
||||||
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:${{ github.event.inputs.image_tag }} \
|
--tag ${{ env.registry }}/${{ env.user }}/${{ env.image_name }}:${{ github.ref_name }} \
|
||||||
--push ./
|
--push ./
|
||||||
|
telegram-notify:
|
||||||
|
needs: release-image
|
||||||
|
if: always()
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Telegram Alert
|
||||||
|
run: |
|
||||||
|
case "${{ needs.release-image.result }}" in
|
||||||
|
"success") EMOJI="✅"; MSG="OK" ;;
|
||||||
|
"failure") EMOJI="❌"; MSG="WARN!" ;;
|
||||||
|
"cancelled") EMOJI="⏹️"; MSG="Canceled" ;;
|
||||||
|
*) EMOJI="❓"; MSG="Unknown-State: ${{ needs.release-image.result }}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\",
|
||||||
|
\"parse_mode\": \"HTML\",
|
||||||
|
\"text\":
|
||||||
|
\"$EMOJI <b>$MSG - Build ${{ env.image_name }}:${{ github.ref_name }}</b>
|
||||||
|
<i>$(date +"%Y-%m-%d %T")</i>
|
||||||
|
Build of Image: <b><i>${{ env.image_name }}:${{ github.ref_name }}</i></b>
|
||||||
|
${{ gitea.server_url }}/${{ gitea.repository }}
|
||||||
|
\"
|
||||||
|
}"
|
||||||
|
|
||||||
@@ -66,3 +66,30 @@ jobs:
|
|||||||
--ignore-unfixed \
|
--ignore-unfixed \
|
||||||
--platform linux/arm/v7 \
|
--platform linux/arm/v7 \
|
||||||
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ env.image_tag }}
|
${{ env.registry_gitea }}/${{ env.user }}/${{ env.image_name }}:${{ env.image_tag }}
|
||||||
|
|
||||||
|
telegram-notify:
|
||||||
|
needs: trivy_image_scan
|
||||||
|
if: always()
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Telegram Alert
|
||||||
|
run: |
|
||||||
|
case "${{ needs.trivy_image_scan.result }}" in
|
||||||
|
"success") EMOJI="✅"; MSG="OK" ;;
|
||||||
|
"failure") EMOJI="❌"; MSG="WARN!" ;;
|
||||||
|
"cancelled") EMOJI="⏹️"; MSG="Canceled" ;;
|
||||||
|
*) EMOJI="❓"; MSG="Unknown-State: ${{ needs.trivy_image_scan.result }}" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\",
|
||||||
|
\"parse_mode\": \"HTML\",
|
||||||
|
\"text\":
|
||||||
|
\"$EMOJI <b>$MSG - Scan ${{ env.image_name }}:${{ env.image_tag }}</b>
|
||||||
|
<i>$(date +"%Y-%m-%d %T")</i>
|
||||||
|
Trivy-Image-Scan of: <b><i>${{ env.image_name }}:${{ env.image_tag }}</i></b>
|
||||||
|
${{ gitea.server_url }}/${{ gitea.repository }}
|
||||||
|
\"
|
||||||
|
}"
|
||||||
|
|||||||
Reference in New Issue
Block a user