Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slack's payload validation not implemented #16

Closed
ryysud opened this issue Nov 30, 2017 · 0 comments · Fixed by #18
Closed

Slack's payload validation not implemented #16

ryysud opened this issue Nov 30, 2017 · 0 comments · Fixed by #18

Comments

@ryysud
Copy link
Contributor

ryysud commented Nov 30, 2017

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

@szyn szyn closed this as completed in #18 Dec 4, 2017
szyn pushed a commit that referenced this issue Dec 4, 2017
* Add validation of template for slack's payload

* Clean templates

* Clean dig files

* Add script for test on circleci

* Remove unused dig file

* Clean validation of template for slack's payload

* Fix config.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant