CircleCI Parallelism consolidated notification

Hello There,
We are working on improvising the total test execution time with the help of parallelism feature available in circle ci. We have implemented the parallelism with 3 and we are successfully able to split the test across all the available machines. So far good no issues.

The problem we are facing is on the consolidated build Notification. Before implementing the parallelism, at the end of steps we have a run step to send the build status notification in email and chat.

when running in parallel, we are getting notification for all the three machines which we thought of improvising. Kindly suggest a way to handle this. Below are the job and workflow sample we used

The requirement is, need to send consolidated notification based on all the 3 machine test run results.

Jobs:
Sanity-suite:
docker:
- image: circleci/node:12
working_directory: ~/repo
parallelism: 3
steps:
- cache-repo
- dependency-cache
- create-env-vars:
secret_name: “projectspecific variables”
- run:
name: Run Sanity Tests
command: |
FILEPATH=$(circleci tests glob ‘project_specific_path’ | circleci tests split --split-by=timings)
npm run tests
- notify-google-chat

workflows:
sanity-and-functional:
jobs:
- hold-sanity-suite:
type: approval
- sanity-suite:
context: running the endtoend test here
requires:
- hold-sanity-suite

2 Likes

In the current state, there is not a simple means to only send a single message for parallel jobs.

We have a support article that describes a workaround to send that at the end of the workflow as opposed to at the end of each job. Essentially, you’ll only send on fail in the parallel jobs but then send on success on a follow-up job if there were no failures:

There is also a feature request that is fairly popular that discusses running a job even when the previous job failed:
https://ideas.circleci.com/cloud-feature-requests/p/always-run-a-job-even-when-dependent-jobs-failed

I would strongly encourage you to place a vote for that if you have not already as this would provide for a much cleaner solution.

Hi @mike,

That article is not really helpful at least in our case. We need to run a job (slack notification) about failure or success in the very end of the workflow. Workflow can have different set of jobs depending wether we are in a branch that deploys or in a branch that only runs tests. And it cannot rely on “requires” since we also want to notify about the failure. Slack notifications in a CI SaaS should be elegant, easy and effortless. Not a PITA.

Has anyone tried the workaround? I see my workflow runs the last-job but I don’t see anything in my slack channel.

The issue seems to be specifically when using post-steps

Posting Status
BASH_ENV file: /tmp/.bash_env-64ac3e2d776386455127c631-0-build
Does Not Exist. Skipping file execution
Checking For JQ + CURL
No message template was explicitly chosen. Based on the job status 'pass' the template '$basic_success_1' will be used.
Sanitizing CIRCLE_JOB...
Sanitizing CIRCLE_PROJECT_REPONAME...
Sanitizing CIRCLE_BRANCH...
Sanitizing CIRCLE_SHA1...
Sanitizing CIRCLE_USERNAME...
SLACK_PARAM_MENTIONS is empty or doesn't exist. Skipping it...
Sanitizing CIRCLE_BUILD_URL...
CircleCI received exit code 0Posting Status
BASH_ENV file: /tmp/.bash_env-64ac3e2d776386455127c631-0-build
Does Not Exist. Skipping file execution
Checking For JQ + CURL
No message template was explicitly chosen. Based on the job status 'pass' the template '$basic_success_1' will be used.
Sanitizing CIRCLE_JOB...
Sanitizing CIRCLE_PROJECT_REPONAME...
Sanitizing CIRCLE_BRANCH...
Sanitizing CIRCLE_SHA1...
Sanitizing CIRCLE_USERNAME...
SLACK_PARAM_MENTIONS is empty or doesn't exist. Skipping it...
Sanitizing CIRCLE_BUILD_URL...
CircleCI received exit code 0