Reputation: 800
I have two projects on gitlab : a frontend (angular) and a module backend (spring). So I would like to use a pipeline to run tests on the frontend after backend was tested and builded . For example, I'd like run tests and build backend modules when it succeeds I'd like run the frontend tests which call the api back before I deploy it as below :
Frontend pipeline .gitlab-ci.yml : stage back : tests => build the backend then stage front : run the tests on api back => build the frontend
How I can do this, please ?
Upvotes: 2
Views: 2712
Reputation: 5136
You could use Gitlabs Multi-Project Pipelines Feature: https://docs.gitlab.com/ee/ci/multi_project_pipelines.html#multi-project-pipelines
For example you can add a build-backend job to your frontend gitlab-ci.yml. This job starts the pipeline in the Start/backend Repository and waits for it to end (configured with strategy: depend
). In the gitlab-ci.yml of the backend project, you can build and test the backend modules and after this pipeline finishes, the next jobs in the frontend pipeline are executed.
build-backend:
stage: build-backend
trigger:
project: Start/backend
strategy: depend
Upvotes: 3
Reputation: 1668
You can use the GitLab Pipelines API to create a new pipeline in the frontend project.
This means you would have two .gitlab-ci.yml
files -- one in the backend project, and one in the frontend project.
See also: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html (you'll need an access token to auth with the GitLab API. You can so via Oauth2 or by using a personal access token, which you might find easier to start with).
Upvotes: 1