Hello everyone!
I have 2 repositories on github. The first with my app, the second with tests. My application is deployed in Amazon S3, so after the deployment is completed (successful or not - it doesn’t matter), testing should be automatically launched. Separately, everything is debugged and works as needed.
I tried using CURL, created 2 branches to test how it works, but after the first Job is completed, the second Job does not start. Does anyone know how to implement this?
Thank you in advance for your answers
This is my test config, maybe there are problems with it?
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.4.1
steps:
- checkout
- run: echo "A first hello"
- deploy:
name: run second job
command: |
curl -v -X POST https://circleci.com/api/v1/project/github/myGit/myrepo/tree/myBranch?circle-token=MyTokenCode
Heya @MTimoshchenko! This is something CircleCI natively supports with “workflows”, which we have covered here: https://circleci.com/docs/2.0/workflows-overview/, as well as in the configuration reference documentation here: https://circleci.com/docs/2.0/configuration-reference/#workflows. This should help point you in the right direction, but feel free to ask any other questions you may have 
Hello @gmemstr! Thank you for your answer
I’ve looked through this documentation before, but I’m not sure if this is what I need. I can build a serial/parallel build if all I need is described in a single config.yml. The problem is that the build and deploy config is in one repository, but config.yml for tests is in another repository (+ versioning by branches). Or I don’t understand something.
Now my test config looks like this:
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.4.1
steps:
- checkout
build2: ### This Job is described in another branch and it should not be here
docker:
- image: circleci/ruby:2.4.1
steps:
- checkout
workflows:
version: 2
first-job:
jobs:
- build:
filters:
branches:
only: test-first
second-job:
jobs:
- build2:
filters:
branches:
only: test-second ## If branch is "test-first" - this work like parallel workflows, but I need to use the second branch
I need to remove the “build2” from the config, since it is in a different branch/repository, and initiate the launch of the second configuration for tests after the “build” is complete"
This is my second config file for testing (conditionally), it is in the “test-second” branch:
version: 2
jobs:
build2:
docker:
- image: circleci/ruby:2.4.1
steps:
- checkout
workflows:
version: 2
second-job:
jobs:
- build2:
filters:
branches:
only: test-second
Can I ask why you have a separate repository for your tests?
Hello @fernfernfern, sure. Various teams are directly involved in the application and testing. And none of them should affect the work of the other team
I managed to run the second Job sequentially (from another repository) after the first Job was completed. To do this, I used the API call. Here’s my code:
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.4.1
steps:
- checkout
- run:
name: Waiting for the environment to be created
command: sleep 1m
- run:
name: run second job
command: |
curl -u ${myUserToken}: \
-d build_parameters[CIRCLE_JOB]=build \
https://circleci.com/api/v1.1/project/github/myOrg/myRepo/tree/myBranch
I also want to say Thank you to everyone who took part in the investigation. The information you provide will be used in future work 