Apparently the reason for the duplicate pipelines were the settings of the GitHub webhook created by gitlab. It was created automatically when we set up the CI/CD for external repository on GitLab. I changed two things in the settings and since then there are no duplicate builds on GitLab anymore:
- SSL verification was disabled -> enabled it
- The ‘Which events would you like to trigger with this webhook’ setting was set to ‘Let me select individual events’ -> Changed this to ‘Just the push event’
I think before changing it only ‘Pull Requests’ and ‘Pushes’ were enabled. So the question remains why this triggered duplicate pipelines even for commits to master. Also it seems strange that the default webhook settings created by GitLab were such that the pipelines were triggered twice.