We have new project, needs to understand the strategy to implement pipeline design for merge requests and merged results and also I see merge train.
In the gitlab documentation, we can use ONLY syntax with merge_request to trigger CI for merge requests to verify compilation, code quality but document says ONLY is identified for depreciation and prefer to use RULES
Please suggest what to use and appreciate if you provide yml file example for the same
Thanks
Hi,
start simple. Did you create your first branch and a merge request already? If so, add a simple CI config to see how this works.
image: centos:7
my_first_job:
script:
- exit 1
You can adjust this then for specific scopes to run. For every push, only on merge requests, tags, etc.
Try them out
Cheers,
Michael
Thank you for the response , could you please provide clarifications specific to merge_request as per the documentation its mentioned we can use below snippet with usage of only syntax but in the latest version of the documentation its mentioned that only syntax is not preferred to use.
Note: The rules
syntax is now the preferred method of setting job policies. only
and except
are candidates for deprecation, and may be removed in the future.
only:
https://docs.gitlab.com/ee/ci/yaml/README.html#onlyexcept-basic
if we need to use rules syntax than only , could you give me some sample script how to run the pipeline for both merge_requests and merged results pipeline
Hi,
I don’t think it is polite to copy paste the exact same answer into two topics. Also, it is out of context of my reply anyways.
Did you follow the steps with the CI configuration up until now, and got the example working? Please share your findings with us. Letting run the CI jobs and limiting their scope comes afterwards.
Regards,
Michael
Thanks , yes I did setup CI pipeline for the new project we have and pipeline able to run java code build, sonarqube scanner, docker image creation and run twistlock successfully
Now I need to restrict the pipeline to trigger branch specific, merge_requests
Apologies for duplicate post , could someone please update on the question posted on merge_requests whether to use rules syntax or only , how to use rules synatx for merge requests.