mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-26 06:23:37 +00:00
This patch splits send-to-channel-slack task from the slackmessage directroy
Changes include: - moves send-to-channel-slack task to the task directory - copies and modifies readme from slackmessage to send-to-channel-slack - copies owners file from slackmessage Issue: #386 Signed-off-by: Puneet Punamiya <ppunamiy@redhat.com>
This commit is contained in:
parent
51e52b8ae0
commit
9c8214f888
7
task/send-to-channel-slack/0.1/OWNERS
Normal file
7
task/send-to-channel-slack/0.1/OWNERS
Normal file
@ -0,0 +1,7 @@
|
||||
approvers:
|
||||
- akihikokuroda
|
||||
- ncskier
|
||||
reviewers:
|
||||
- akihikokuroda
|
||||
- ncskier
|
||||
|
65
task/send-to-channel-slack/0.1/README.md
Normal file
65
task/send-to-channel-slack/0.1/README.md
Normal file
@ -0,0 +1,65 @@
|
||||
# Post a message to slack
|
||||
|
||||
These tasks post a simple message to a slack channel. There are multiple ways to send
|
||||
a message to slack. Each task here uses different method.
|
||||
|
||||
|
||||
# send-to-channel-slack
|
||||
|
||||
This task uses chat.postMessage slack REST api to send the message.
|
||||
Follow instructions [here](https://api.slack.com/messaging/sending) to obtain the OAuth access token for the bot app with `chat:write` scope.
|
||||
The app must join the channel before the message posted by this task run. (invite the app in the channel)
|
||||
|
||||
## Install the Task and create a secret
|
||||
|
||||
```
|
||||
kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/task/send-to-channel-slack/0.1/send-to-channel-slack.yaml
|
||||
```
|
||||
|
||||
Create a secret that has the OAuth token of the bot app.
|
||||
|
||||
Example token-secret.yaml
|
||||
```
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: token-secret
|
||||
stringData:
|
||||
token: {OAuth token for the bot app}
|
||||
```
|
||||
|
||||
Example kubectl command
|
||||
```
|
||||
kubectl apply -f token-secret.yaml
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
### Parameters
|
||||
|
||||
* **token-secret**: The name of the secret that has the OAuth token. The key for the OAuth-token is token
|
||||
|
||||
* **channel**: [channel id](https://api.slack.com/messaging/retrieving#finding_conversation) or channel name where the message is posted
|
||||
|
||||
* **message**: Plain text message to be posted in the slack channel
|
||||
|
||||
## Usage
|
||||
|
||||
This TaskRun runs the Task to post a message to the channel.
|
||||
|
||||
```
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: run-send-to-channel-slack
|
||||
spec:
|
||||
params:
|
||||
- name: token-secret
|
||||
value: token-secret
|
||||
- name: channel
|
||||
value: {CHANNEL ID}
|
||||
- name: message
|
||||
value: "Hello from Tekton!"
|
||||
taskRef:
|
||||
name: send-to-channel-slack
|
||||
```
|
Loading…
Reference in New Issue
Block a user