Improve slackme

pull/85/head
Kyle Carberry 2 years ago
parent 528923048f
commit 91f9478b0d

@ -0,0 +1,6 @@
<svg width="127" height="127" xmlns="http://www.w3.org/2000/svg">
<path d="M27.2 80c0 7.3-5.9 13.2-13.2 13.2C6.7 93.2.8 87.3.8 80c0-7.3 5.9-13.2 13.2-13.2h13.2V80zm6.6 0c0-7.3 5.9-13.2 13.2-13.2 7.3 0 13.2 5.9 13.2 13.2v33c0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V80z" fill="#E01E5A"/>
<path d="M47 27c-7.3 0-13.2-5.9-13.2-13.2C33.8 6.5 39.7.6 47 .6c7.3 0 13.2 5.9 13.2 13.2V27H47zm0 6.7c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H13.9C6.6 60.1.7 54.2.7 46.9c0-7.3 5.9-13.2 13.2-13.2H47z" fill="#36C5F0"/>
<path d="M99.9 46.9c0-7.3 5.9-13.2 13.2-13.2 7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H99.9V46.9zm-6.6 0c0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V13.8C66.9 6.5 72.8.6 80.1.6c7.3 0 13.2 5.9 13.2 13.2v33.1z" fill="#2EB67D"/>
<path d="M80.1 99.8c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V99.8h13.2zm0-6.6c-7.3 0-13.2-5.9-13.2-13.2 0-7.3 5.9-13.2 13.2-13.2h33.1c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H80.1z" fill="#ECB22E"/>
</svg>

After

Width:  |  Height:  |  Size: 1019 B

@ -0,0 +1,63 @@
---
display_name: Slack Me
description: Send a Slack message when a command finishes inside a workspace!
icon: ../.icons/slack.svg
maintainer_github: coder
verified: true
tags: [helper]
---
# Slack Me
Add the `slackme` command to your workspace that DMs you on Slack when your command finishes running.
```bash
$ slackme npm run long-build
```
## Setup
1. Navigate to [Create a Slack App](https://api.slack.com/apps?new_app=1) and select "From an app manifest". Select a workspace and paste in the following manifest, adjusting the redirect URL to your Coder deployment:
```json
{
"display_information": {
"name": "Command Notify",
"description": "Notify developers when commands finish running inside Coder!",
"background_color": "#1b1b1c"
},
"features": {
"bot_user": {
"display_name": "Command Notify"
}
},
"oauth_config": {
"redirect_urls": [
"https://<your coder deployment>/external-auth/slack/callback"
],
"scopes": {
"bot": ["chat:write"]
}
}
}
```
2. In the "Basic Information" tab on the left after creating your app, scroll down to the "App Credentials" section. Set the following environment variables in your Coder deployment:
```env
CODER_EXTERNAL_AUTH_1_TYPE=slack
CODER_EXTERNAL_AUTH_1_SCOPES="chat:write"
CODER_EXTERNAL_AUTH_1_DISPLAY_NAME="Slack Me"
CODER_EXTERNAL_AUTH_1_CLIENT_ID="<your client id>
CODER_EXTERNAL_AUTH_1_CLIENT_SECRET="<your client secret>"
```
3. Restart your Coder deployment. Any Template can now import the Slack Me module, and `slackme` will be available on the `$PATH`:
```hcl
module "slackme" {
source = "https://registry.coder.com/modules/slackme"
agent_id = coder_agent.example.id
auth_provider_id = "slack"
}
```

@ -14,9 +14,9 @@ variable "agent_id" {
description = "The ID of a Coder agent."
}
variable "external_provider_id" {
variable "auth_provider_id" {
type = string
description = "The ID of an external provider."
description = "The ID of an external auth provider."
}
resource "coder_script" "install_slackme" {
@ -28,7 +28,7 @@ resource "coder_script" "install_slackme" {
CODER_DIR=$(dirname $(which coder))
cat > $CODER_DIR/slackme <<EOF
${templatefile("${path.module}/slackme.sh", {
PROVIDER_ID: var.external_provider_id
PROVIDER_ID: var.auth_provider_id
})}
\EOF
chmod +x $CODER_DIR/slackme

Loading…
Cancel
Save