I’d like to trigger slack notify during (or end of) build. With custom message, set dynamically in build.
Let’s say we are running tests, or counting files in repo, i’d like to notify team like this:
build № started author commit etc etc (working)
drone found 543 files in repo!
71 of 72 tests passed, one ignored!
build success!
How can i achieve this? The only way i see here to add direct curl-ing to commands. But it would be so much more native to let slack/other plugin to inherit some env variable, or similar.
The only way to pass metadata between steps is by disk. You would need to create a plugin (or fork and alter) that reads such variables from disk and uses them at runtime. The current slack plugin is feature-frozen so forking and publishing your own custom remix would be your best option.
EDIT: the slack plugin does support reading the notification template from disk. So you could generate the template prior to the slack notification step.
TNX! I got it working only because of this thread!
For anyone tackling this with drone 1.6.2 & kubernetes runner it did not work with the drone workspace configuration like he did, I did it with the like volumes similar to his first solution:
TNX! I got it working only because of this thread!
For anyone tackling this with drone 1.6.2 & kubernetes runner it did not work with the drone workspace configuration like he did, I did it with the like volumes similar to his first solution:
Just a heads up that the previous example from yellowmegaman would no longer work because the default workspace path changed. Their example would therefore need to be adjusted as follows: