1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00
catalog/task/send-to-telegram/0.1/send-to-telegram.yaml
Yulia Gaponenko e96d209bf1 Add platforms annotation to send-to-* tasks
Annotation about linux/amd64, linux/s390x, and linux/ppc64le platforms
is added to the latest versions of the send-to-* tasks.

Curl image used in the tasks is upgraded from 7.68.0 to 7.70.0 to use
multi-arch version.

Signed-off-by: Yulia Gaponenko <yulia.gaponenko1@de.ibm.com>
2021-08-31 07:43:14 +01:00

46 lines
1.4 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/categories: Messaging
tekton.dev/tags: messaging
tekton.dev/platforms: "linux/amd64,linux/s390x,linux/ppc64le"
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: docker.io/curlimages/curl:7.70.0@sha256:031df77a11e5edded840bc761a845eab6e3c2edee22669fb8ad6d59484b6a1c4 #tag: 7.70.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)