Perhaps...
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
# Secrets required: portainer_webhook_url (Portainer stack webhook URL), discord_webhook_url (Discord incoming webhook).
|
||||
skip_clone: true
|
||||
|
||||
# Use /tmp so rootless step containers (e.g. curlimages/curl) can create the workspace.
|
||||
workspace:
|
||||
base: /tmp
|
||||
path: woodpecker
|
||||
|
||||
when:
|
||||
event: deployment
|
||||
evaluate: 'CI_PIPELINE_DEPLOY_TARGET == "production"'
|
||||
@@ -16,16 +21,30 @@ steps:
|
||||
commands:
|
||||
- curl -sS -X POST "$PORTAINER_WEBHOOK_URL"
|
||||
|
||||
- name: Send Production Deploy Status
|
||||
- name: Send Deploy Status Notification (success)
|
||||
image: curlimages/curl
|
||||
environment:
|
||||
DISCORD_WEBHOOK_URL:
|
||||
from_secret: discord_webhook_url
|
||||
commands:
|
||||
- |
|
||||
EMOJI="💩"
|
||||
[ "$CI_PIPELINE_STATUS" = "success" ] && EMOJI="🎉"
|
||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy %s %s"}' "$CI_REPO" "$CI_PIPELINE_NUMBER" "$CI_PIPELINE_STATUS" "$EMOJI")
|
||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy success 🎉"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
||||
depends_on:
|
||||
- Deploy to Production
|
||||
when:
|
||||
- status: [ success, failure ]
|
||||
- status: [ success ]
|
||||
|
||||
- name: Send Deploy Status Notification (failure)
|
||||
image: curlimages/curl
|
||||
environment:
|
||||
DISCORD_WEBHOOK_URL:
|
||||
from_secret: discord_webhook_url
|
||||
commands:
|
||||
- |
|
||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy failure 💩"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
||||
depends_on:
|
||||
- Deploy to Production
|
||||
when:
|
||||
- status: [ failure ]
|
||||
|
||||
Reference in New Issue
Block a user