Pipeline notification to Mattermost
This commit is contained in:
@@ -22,6 +22,24 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- Install
|
- Install
|
||||||
|
|
||||||
|
- name: Send Prettier Status Notification (failure)
|
||||||
|
image: curlimages/curl
|
||||||
|
environment:
|
||||||
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_tests_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Prettier failure 💩"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
|
depends_on:
|
||||||
|
- Prettier
|
||||||
|
when:
|
||||||
|
- status: [failure]
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
image: node:22-bookworm-slim
|
image: node:22-bookworm-slim
|
||||||
commands:
|
commands:
|
||||||
@@ -38,6 +56,24 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- Lint
|
- Lint
|
||||||
|
|
||||||
|
- name: Send Lint Status Notification (failure)
|
||||||
|
image: curlimages/curl
|
||||||
|
environment:
|
||||||
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_tests_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Lint failure 💩"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
|
depends_on:
|
||||||
|
- Lint
|
||||||
|
when:
|
||||||
|
- status: [failure]
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
image: node:22-bookworm-slim
|
image: node:22-bookworm-slim
|
||||||
commands:
|
commands:
|
||||||
@@ -46,23 +82,41 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- Tests & Coverage
|
- Tests & Coverage
|
||||||
|
|
||||||
# build-full:
|
- name: Send Build Status Notification (failure)
|
||||||
# image: node:22-bookworm-slim
|
image: curlimages/curl
|
||||||
# commands:
|
environment:
|
||||||
# - apt-get update
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
# - apt-get install -y --no-install-recommends ca-certificates libasound2 libatk-bridge2.0-0 libatk1.0-0 libcups2 libdrm2 libgbm1 libgtk-3-0 libnss3 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 libxrandr2
|
from_secret: mattermost_bot_access_token
|
||||||
# - rm -rf /var/lib/apt/lists/*
|
MATTERMOST_CHANNEL_ID:
|
||||||
# - corepack enable && corepack prepare pnpm@latest --activate
|
from_secret: mattermost_tests_channel_id
|
||||||
# - pnpm run critical-css:install
|
MATTERMOST_POST_API_URL:
|
||||||
# - pnpm run build:full
|
from_secret: mattermost_post_api_url
|
||||||
# depends_on:
|
commands:
|
||||||
# - build
|
- |
|
||||||
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Build failure 💩"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
|
depends_on:
|
||||||
|
- Build
|
||||||
|
when:
|
||||||
|
- status: [failure]
|
||||||
|
|
||||||
# e2e:
|
- name: Send CI Pipeline Status Notification (success)
|
||||||
# image: node:22-bookworm-slim
|
image: curlimages/curl
|
||||||
# commands:
|
environment:
|
||||||
# - corepack enable && corepack prepare pnpm@latest --activate
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
# - pnpm exec playwright install chromium --with-deps
|
from_secret: mattermost_bot_access_token
|
||||||
# - pnpm run test:e2e
|
MATTERMOST_CHANNEL_ID:
|
||||||
# depends_on:
|
from_secret: mattermost_tests_channel_id
|
||||||
# - build
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] CI pipeline success 🎉"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$BODY" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
|
depends_on:
|
||||||
|
- Install
|
||||||
|
- Lint
|
||||||
|
- Prettier
|
||||||
|
- Build
|
||||||
|
when:
|
||||||
|
- status: [success]
|
||||||
|
|||||||
@@ -55,12 +55,16 @@ steps:
|
|||||||
- name: Send Build Status Notification (success)
|
- name: Send Build Status Notification (success)
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
environment:
|
environment:
|
||||||
DISCORD_WEBHOOK_URL:
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
from_secret: discord_webhook_url
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_pushes_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Docker images build success 🎉"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Docker images build success 🎉"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
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" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
depends_on:
|
depends_on:
|
||||||
- Docker image build (qr-api + qr-web)
|
- Docker image build (qr-api + qr-web)
|
||||||
when:
|
when:
|
||||||
@@ -69,12 +73,16 @@ steps:
|
|||||||
- name: Send Build Status Notification (failure)
|
- name: Send Build Status Notification (failure)
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
environment:
|
environment:
|
||||||
DISCORD_WEBHOOK_URL:
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
from_secret: discord_webhook_url
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_pushes_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Docker images build failure 💩"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Docker images build failure 💩"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
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" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
depends_on:
|
depends_on:
|
||||||
- Docker image build (qr-api + qr-web)
|
- Docker image build (qr-api + qr-web)
|
||||||
when:
|
when:
|
||||||
@@ -103,12 +111,16 @@ steps:
|
|||||||
- name: Send Deploy Status Notification (success)
|
- name: Send Deploy Status Notification (success)
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
environment:
|
environment:
|
||||||
DISCORD_WEBHOOK_URL:
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
from_secret: discord_webhook_url
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_pushes_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy success 🎉"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Production Deploy success 🎉"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
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" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
depends_on:
|
depends_on:
|
||||||
- Trigger Portainer stack redeploy
|
- Trigger Portainer stack redeploy
|
||||||
when:
|
when:
|
||||||
@@ -117,12 +129,16 @@ steps:
|
|||||||
- name: Send Deploy Status Notification (failure)
|
- name: Send Deploy Status Notification (failure)
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
environment:
|
environment:
|
||||||
DISCORD_WEBHOOK_URL:
|
MATTERMOST_BOT_ACCESS_TOKEN:
|
||||||
from_secret: discord_webhook_url
|
from_secret: mattermost_bot_access_token
|
||||||
|
MATTERMOST_CHANNEL_ID:
|
||||||
|
from_secret: mattermost_pushes_channel_id
|
||||||
|
MATTERMOST_POST_API_URL:
|
||||||
|
from_secret: mattermost_post_api_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
BODY=$(printf '{"username":"WoodpeckerBot","content":"[%s - Build #%s] Production Deploy failure 💩"}' "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
BODY=$(printf '{"channel_id":"%s","message":"[%s - Build #%s] Production Deploy failure 💩"}' "$MATTERMOST_CHANNEL_ID" "$CI_REPO" "$CI_PIPELINE_NUMBER")
|
||||||
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" -H "Authorization: Bearer $MATTERMOST_BOT_ACCESS_TOKEN" $MATTERMOST_POST_API_URL
|
||||||
depends_on:
|
depends_on:
|
||||||
- Trigger Portainer stack redeploy
|
- Trigger Portainer stack redeploy
|
||||||
when:
|
when:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# Portainer stack: registry-based images (no build). Use with CI/CD webhook redeploy.
|
# Portainer stack: registry-based images (no build). Use with CI/CD webhook redeploy.
|
||||||
# Set in Portainer stack env (or .env): REGISTRY, IMAGE_TAG (defaults below).
|
# Set in Portainer stack env (or .env): REGISTRY, IMAGE_TAG (defaults below).
|
||||||
# Images: ${REGISTRY}/mifi-holdings/shorty-qr-api:${IMAGE_TAG}, shorty-qr-web:${IMAGE_TAG}
|
# Images: ${REGISTRY}/mifi-holdings/shorty-qr-api:${IMAGE_TAG}, shorty-qr-web:${IMAGE_TAG}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
kutt_db:
|
kutt_db:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
|
|||||||
Reference in New Issue
Block a user