1

My requirement is:

  1. Create a feature branch (fA) by cloning a branch (A).
  2. 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).
  3. Raise a merge request to merge fA with A.
  4. 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.
  5. 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. ;_;

0 Answers0