My requirement is:
- Create a feature branch (fA) by cloning a branch (A).
- Change contents of some static files (JSON data) in fA and commit them (Let's say the files are fa1.json, fa2.json, fa3.json).
- Raise a merge request to merge fA with A.
- Run a python script on these changed files (python script -- script.py) -- Using CI/CD pipeline that runs on merge requests, using merge pipeline when succeeds.
- script.py validates these JSONs (custom logic), if any of the files is invalid, it shouldn't be merged with A. (if fa1.json is invalid, only fa2.json & fa3.json should be merged)
So My CI/CD file -
services:
- docker:dind
job:
image: python
script:
- files=$(git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA)
- python3 pipeline/pipeline.py $CI_MERGE_REQUEST_TARGET_BRANCH_NAME $files
only:
- merge_request
Please help. ;_;