Home:ALL Converter>Apply GitLab CI/CD pipeline changes for pipeline run triggered by merge request

Apply GitLab CI/CD pipeline changes for pipeline run triggered by merge request

Ask Time:2021-12-01T07:59:38         Author:Brad Cooley

Json Formatter

I have created a new CD/CD pipeline in GitLab via a .gitlab-ci.yml file in the repo root in a new project with a job structured like so:

...
test:
  stage: test
  script:
    - pip install tox flake8
    - tox -e py36,flake8
  # Run only for merge requests on main branch
  rules:
    - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "main"'
...

GitLab does not trigger the pipeline, saying there is no .gitlab-ci.yml file in the repository. I had assumed that pipeline changes would apply to the merge request run that was triggered. I can understand why this isn't the case for security purposes in a public repository, but I would like to test pipeline changes in the merge request that I created for my self-hosted private GitLab instance.

Is this possible?

Author:Brad Cooley,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/70177576/apply-gitlab-ci-cd-pipeline-changes-for-pipeline-run-triggered-by-merge-request
yy