Hi,
Is there a way to pass the status of a job to another job? What i need is I have job1 which run tests in parallel. If it fails it sends reports to slack from each container. So we are getting multiple notification for single test run. As a workaround what i tried is i created a job2 which checks the status of the workflow if it is ‘failing’ or ‘running’ through API and job2 sends one single slack notification if tests are failed. As per the docs, if one of the job in a workflow fails it should return the status ‘failing’ but it is not happening, even though job1 fails and while job2 is running the status of the workflow is always ‘running’. Now my options are
Store the status of job1 in a variable and pass it to job2. Not sure if it is possible!!
Or, find the status of job1 from job2 through any API calls. is it possible?
Are there any other simple solution to resolve my issue?
I thank in advance for your help
You can retrieve the details of a job leverageing the job endpoint. The API call would be: https://circleci.com/api/v2/project/{project-slug}/job/{job-number}
Which will return the job status among other details:
You also might be interested in making use of storing build artifacts. Artifacts persist data even after a job is completed, enabling future reference.
How do i get the job-number ???
Job1 would be running the tests in parallel containers. I need job2 to monitor the status of job1. How do i retrieve the status of job1 from job2 without knowing the job-number for job2?
I know this is confusing but i managed to explain as much as possible.
Let me know if you need more precision