mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-26 06:23:37 +00:00
a7f32f5f65
Changes include: - adds version label - adds a minimum pipeline versions supported by the task - adds tags for task - modified description to add a summary This patch moves the telegrammessage files to the task directory and renames the directory - The directory name is changed to match the resource name - Modifies the path for install task command in readme file Issue: #386 Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
44 lines
1.2 KiB
YAML
44 lines
1.2 KiB
YAML
apiVersion: tekton.dev/v1beta1
|
|
kind: Task
|
|
metadata:
|
|
name: send-to-telegram
|
|
labels:
|
|
app.kubernetes.io/version: "0.1"
|
|
annotations:
|
|
tekton.dev/pipelines.minVersion: "0.12.1"
|
|
tekton.dev/tags: messaging
|
|
spec:
|
|
description: >-
|
|
These tasks post a simple message to a telegram chat.
|
|
|
|
This task uses the Bot API of telegram to send a message.
|
|
|
|
params:
|
|
- name: bot-token-secret
|
|
type: string
|
|
description: Token of the bot through
|
|
- name: chat-id
|
|
type: string
|
|
description: ID of the chat to send the message towards
|
|
- name: message
|
|
type: string
|
|
description: The message to notify about
|
|
steps:
|
|
- name: post
|
|
image: curlimages/curl:7.68.0
|
|
script: |
|
|
#!/bin/sh
|
|
MESSAGE=`echo $MESSAGE | sed -e 's/\"/\\\\"/g'`
|
|
JSON="{\"chat_id\": ${CHAT_ID}, \"text\": \"${MESSAGE}\" }"
|
|
curl -X POST -H 'Content-Type: application/json' -d "${JSON}" https://api.telegram.org/bot${BOT_TOKEN}/sendMessage
|
|
env:
|
|
- name: BOT_TOKEN
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: $(params.bot-token-secret)
|
|
key: token
|
|
- name: CHAT_ID
|
|
value: $(params.chat-id)
|
|
- name: MESSAGE
|
|
value: $(params.message)
|