Search code examples
pythongitlab-cilocust

How to export locust execution ran in a pipeline to a slack channel?


This is my first question on stack overflow. I'm trying to create a CI pipeline measuring the performance of our environment.

I've managed to create a locust file thats executing a given scenario. And right now I trying to integrate the pipeline with our slack channel. So I could see in an easy way if the scheduled job passed or failed - no need to log in to gitlab.

For regression tests I'm using pytest with pytest-slack plugin and it works fine. Unfortunately for locust I cannot find any available plugin.

The Gitlab - Slack integration is not working in the way I want because it's made for monitoring the pipelines for merges not for scheduled.

Thanks!


Solution

  • Your question is a little hard to answer. Do you want help with Slack integration or with Locust?

    In regards to Locust, you can make it give a non-zero exit code to "fail" the pipeline on certain conditions, and then do whatever you want with that using your pipeline.

    An example (requires locust-plugins) is here: https://github.com/SvenskaSpel/locust-plugins/blob/5a57e10950c25025dc3e04785cb668d368271019/examples/cmd_line_examples.sh#L6