szyn / digdag-slack Goto Github PK
View Code? Open in Web Editor NEWdigdag-slack is a plugin sending messages to slack :tada: https://www.digdag.io/
License: Apache License 2.0
digdag-slack is a plugin sending messages to slack :tada: https://www.digdag.io/
License: Apache License 2.0
I am getting the following error when i tried to run through dig dag UI. The same project i tried to execute locally it seems to be working fine.
2020-04-03 03:45:12.150 +0000 [INFO] (0686@[0:main]+main+step1-2) io.digdag.core.agent.OperatorManager: slack>: include/good-template.yml
2020-04-03 03:45:12.181 +0000 [ERROR] (0686@[0:main]+main+step1-2) io.digdag.core.agent.OperatorManager: Task failed with unexpected error: org.eclipse.aether.resolution.DependencyResolutionException: Failed to read artifact descriptor for com.github.szyn:digdag-slack:jar:0.1.4
I use digdag behind a http proxy at server mode runtime.
env http_proxy=http://<proxy url>:<proxy port>
In such case(even if not server mode), this plugin doesn't work because of not supporting http proxy.
In this implementation, I don't know why the request to hook.slack.com failed.
So please output a message according to Response's http status code.
https://github.com/szyn/digdag-slack/blob/master/src/main/java/io/digdag/plugin/slack/SlackOperatorFactory.java#L88-L90
The template for slack's payload was wrong and failed to execute workflow as follows.
$ cat sample.dig
_export:
plugin:
repositories:
- https://jitpack.io
dependencies:
- com.github.szyn:digdag-slack:0.1.4
webhook_url: https://hooks.slack.com/services/xxx
workflow_name: slack
ENV: develop
+first_task:
echo>: "run first task!"
_check:
slack>: templates/success.yml
+second_task:
echo>: "run other tasks!"
$ cat templates/success.yml
---
username: Digdag
icon_emoji: ':blush:'
channel: '#digdag-slack-test'
typo_attachments: <----------------------------------- typo :(
- fallback: '[SUCCESS] ${workflow_name} workflow'
color: "good"
text: '*[SUCCESS]* `${workflow_name}` Workflow'
mrkdwn_in:
- text
- pretext
- fields
fields:
- title: Task Name
value: "${task_name}"
short: false
- title: Session Date
value: "${session_date}"
short: true
- title: Environment
value: "${ENV}"
short: true
$ digdag run -a sample.dig
2017-11-30 05:47:58 +0000: Digdag v0.9.21
2017-11-30 05:48:01 +0000 [WARN] (main): Reusing the last session time 2017-11-30T00:00:00+00:00.
2017-11-30 05:48:01 +0000 [INFO] (main): Using session /root/digdag-slack/.circleci/.digdag/status/20171130T000000+0000.
2017-11-30 05:48:01 +0000 [INFO] (main): Starting a new session project id=1 workflow name=sample session_time=2017-11-30T00:00:00+00:00
2017-11-30 05:48:04 +0000 [INFO] (0016@[0:default]+sample+first_task): echo>: run first task!
run first task!
2017-11-30 05:48:06 +0000 [INFO] (0016@[0:default]+sample+first_task^check): slack>: templates/success.yml
java.io.IOException: posting to slack failed
at io.digdag.plugin.slack.SlackOperatorFactory$SlackOperator.postToSlack(SlackOperatorFactory.java:89)
at io.digdag.plugin.slack.SlackOperatorFactory$SlackOperator.runTask(SlackOperatorFactory.java:69)
at io.digdag.util.BaseOperator.run(BaseOperator.java:35)
at io.digdag.core.agent.OperatorManager.callExecutor(OperatorManager.java:312)
at io.digdag.cli.Run$OperatorManagerWithSkip.callExecutor(Run.java:694)
at io.digdag.core.agent.OperatorManager.runWithWorkspace(OperatorManager.java:254)
at io.digdag.core.agent.OperatorManager.lambda$runWithHeartbeat$2(OperatorManager.java:137)
at io.digdag.core.agent.LocalWorkspaceManager.withExtractedArchive(LocalWorkspaceManager.java:25)
at io.digdag.core.agent.OperatorManager.runWithHeartbeat(OperatorManager.java:135)
at io.digdag.core.agent.OperatorManager.run(OperatorManager.java:119)
at io.digdag.cli.Run$OperatorManagerWithSkip.run(Run.java:676)
at io.digdag.core.agent.MultiThreadAgent.lambda$null$0(MultiThreadAgent.java:127)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2017-11-30 05:48:10 +0000 [INFO] (0016@[0:default]+sample+second_task): echo>: run other tasks!
run other tasks!
Success. Task state is saved at /root/digdag-slack/.circleci/.digdag/status/20171130T000000+0000 directory.
* Use --session <daily | hourly | "yyyy-MM-dd[ HH:mm:ss]"> to not reuse the last session time.
* Use --rerun, --start +NAME, or --goal +NAME argument to rerun skipped tasks.
I tried to find typo, but it was difficult to notice typo.
Do you have any plans to implement slack's payload validation according to slack's official format?
https://api.slack.com/docs/messages/builder
To OkHttp ?
Because Unirest cause issues.
If the task of digdag-slack fails, subsequent tasks are not executed as follows.
$ cat sample.dig
_export:
plugin:
repositories:
- https://jitpack.io
dependencies:
- com.github.szyn:digdag-slack:0.1.4
webhook_url: mistake_url
workflow_name: slack
ENV: develop
+first_task:
echo>: "run first task!"
_check:
slack>: templates/success.yml
+second_task:
echo>: "run other tasks!"
$ digdag run -a sample.dig
2017-11-30 05:39:29 +0000: Digdag v0.9.21
2017-11-30 05:39:32 +0000 [WARN] (main): Reusing the last session time 2017-11-30T00:00:00+00:00.
2017-11-30 05:39:32 +0000 [INFO] (main): Using session /root/digdag-slack/.circleci/.digdag/status/20171130T000000+0000.
2017-11-30 05:39:32 +0000 [INFO] (main): Starting a new session project id=1 workflow name=sample session_time=2017-11-30T00:00:00+00:00
2017-11-30 05:39:34 +0000 [INFO] (0016@[0:default]+sample+first_task): echo>: run first task!
run first task!
2017-11-30 05:39:36 +0000 [INFO] (0016@[0:default]+sample+first_task^check): slack>: templates/success.yml
2017-11-30 05:39:37 +0000 [ERROR] (0016@[0:default]+sample+first_task^check): Task failed with unexpected error: unexpected url: mistake_url
java.lang.IllegalArgumentException: unexpected url: mistake_url
at okhttp3.Request$Builder.url(Request.java:143)
at io.digdag.plugin.slack.SlackOperatorFactory$SlackOperator.postToSlack(SlackOperatorFactory.java:81)
at io.digdag.plugin.slack.SlackOperatorFactory$SlackOperator.runTask(SlackOperatorFactory.java:69)
at io.digdag.util.BaseOperator.run(BaseOperator.java:35)
at io.digdag.core.agent.OperatorManager.callExecutor(OperatorManager.java:312)
at io.digdag.cli.Run$OperatorManagerWithSkip.callExecutor(Run.java:694)
at io.digdag.core.agent.OperatorManager.runWithWorkspace(OperatorManager.java:254)
at io.digdag.core.agent.OperatorManager.lambda$runWithHeartbeat$2(OperatorManager.java:137)
at io.digdag.core.agent.LocalWorkspaceManager.withExtractedArchive(LocalWorkspaceManager.java:25)
at io.digdag.core.agent.OperatorManager.runWithHeartbeat(OperatorManager.java:135)
at io.digdag.core.agent.OperatorManager.run(OperatorManager.java:119)
at io.digdag.cli.Run$OperatorManagerWithSkip.run(Run.java:676)
at io.digdag.core.agent.MultiThreadAgent.lambda$null$0(MultiThreadAgent.java:127)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2017-11-30 05:39:39 +0000 [INFO] (0016@[0:default]+sample^failure-alert): type: notify
error:
* +sample+first_task^check:
unexpected url: mistake_url (illegal argument)
Task state is saved at /root/digdag-slack/.circleci/.digdag/status/20171130T000000+0000 directory.
* Use --session <daily | hourly | "yyyy-MM-dd[ HH:mm:ss]"> to not reuse the last session time.
* Use --rerun, --start +NAME, or --goal +NAME argument to rerun skipped tasks.
I would like to allow subsequent tasks to be executed even If the task of digdag-slack fails.
Do you have any plans to support parameter like ignore_failure
?
slack.dig
_export:
plugin:
repositories:
- https://jitpack.io
dependencies:
- com.github.szyn:digdag-slack:0.1.2
webhook_url: https://hooks.slack.com/services/X/X/X
ENV: develop
template.yml
---
username: digdag
channel: "XXX"
icon_url: https://XXX
attachments:
- fallback: '[FAILED] ${env_name} ${task_name}'
color: "danger"
text: '*[FAILED]* ${env_name} `${task_name}`'
mrkdwn_in:
- text
- pretext
- fields
fields:
- title: Error Message
value: "`${error.message}`"
short: false
- title: Error Stacktrace
value: "```${error.stacktrace}```"
short: false
- title: Session Local Time
value: "${session_local_time}"
short: true
- title: Env
value: "${env_name}"
short: true
execute.yml
timezone: Asia/Tokyo
!include : 'slack.dig'
# schedule:
# cron>: 0 */2 * * *
_export:
target: XXX
+create-job:
sh>: "curl -s ${target} | run -"
+check-job:
sh>: "./check-job.sh - ${target}"
_error:
sh>: "curl -s ${target} | drop -"
+delete-job:
sh>: "curl -s ${target} | drop -"
_error:
slack>: template.yml
But was,,,
2018-05-20 10:30:02.292 +0000 [INFO] (416979@[0:]+execute^error) io.digdag.core.agent.OperatorManager: slack>: template.yml
2018-05-20 10:30:02.292 +0000 [ERROR] (416979@[0:]+execute^error) io.digdag.core.agent.OperatorManager: Configuration error at task +execute^error: Unknown task type: slack (config)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.