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).
|
# Secrets required: portainer_webhook_url (Portainer stack webhook URL), discord_webhook_url (Discord incoming webhook).
|
||||||
skip_clone: true
|
skip_clone: true
|
||||||
|
|
||||||
|
# Use /tmp so rootless step containers (e.g. curlimages/curl) can create the workspace.
|
||||||
|
workspace:
|
||||||
|
base: /tmp
|
||||||
|
path: woodpecker
|
||||||
|
|
||||||
when:
|
when:
|
||||||
event: deployment
|
event: deployment
|
||||||
evaluate: 'CI_PIPELINE_DEPLOY_TARGET == "production"'
|
evaluate: 'CI_PIPELINE_DEPLOY_TARGET == "production"'
|
||||||
@@ -16,16 +21,30 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- curl -sS -X POST "$PORTAINER_WEBHOOK_URL"
|
- curl -sS -X POST "$PORTAINER_WEBHOOK_URL"
|
||||||
|
|
||||||
- name: Send Production Deploy Status
|
- name: Send Deploy Status Notification (success)
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
environment:
|
environment:
|
||||||
DISCORD_WEBHOOK_URL:
|
DISCORD_WEBHOOK_URL:
|
||||||
from_secret: discord_webhook_url
|
from_secret: discord_webhook_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
EMOJI="💩"
|
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy success 🎉"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
[ "$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")
|
|
||||||
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" "$DISCORD_WEBHOOK_URL"
|
||||||
|
depends_on:
|
||||||
|
- Deploy to Production
|
||||||
when:
|
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