on gitlab.com the creation of an issue together with a new branch and a merge request directly triggers CI pipeline start. This is unexpected to me, because the new branch contains not a single change. Why is the pipeline triggered?
Best, Lars
As stated in the GitLab Pipeline documentation, "each commit or push triggers your CI pipeline". Since new git branches are created on a remote repository via push, the pipeline is triggered when a new branch is created.
On first glance, this behavior seems superfluous, but GitLab allows you to run different jobs depending on the current branch of the repository; for example, you could run your "deploy" job only on the master branch. Therefore from GitLab's perspective it makes sense to execute the Pipeline each time a new branch is created.
More information is available here: https://docs.gitlab.com/ce/ci/yaml/README.html#only-and-except-simplified
Introduced with GitLab 11.4, this behaviour is now explained:
If you are pushing a new branch or a new tag to GitLab, the policy always evaluates to true and GitLab will create a job. This feature is not connected with merge requests yet, and because GitLab is creating pipelines before an user can create a merge request we don't know a target branch at this point.
Without a target branch, it is not possible to know what the common ancestor is, thus we always create a job in that case. This feature works best for stable branches like master because in that case GitLab uses the previous commit that is present in a branch to compare against the latest SHA that was pushed.