-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitlab: duplicate pipelines in gitlab merge requests #3373
Comments
did you check the other issues? there was a PR that fixed this a while back. |
I didn't find anything similar open, but found this PR #2745 |
It is the same behaviour reported here #2743 |
@jukie do you have any ideas? |
@paulozava Please, could you confirm the GitLab version are you using (gitlab.com or self-hosted)? And the |
Sure, we are using GitLab self-hosted at version 15.9.4-ee The image: registry.corp.com/infrastructure/verticals/linters:latest
stages:
- Lint
- Deploy
YAML lint:
stage: Lint
script:
- find . -name "*.yml" -o -name "*.yaml" | xargs -n 1 yamllint -d relaxed --no-warnings
only:
- merge_requests
tags: [k8s-motors]
Kustomize Lint:
stage: Lint
variables:
K8S_INFRASTRUCTURE_FILES_FOLDER: k8s-clusterconfig
script:
- kustomize build $K8S_INFRASTRUCTURE_FILES_FOLDER/staging > /dev/null
- kustomize build $K8S_INFRASTRUCTURE_FILES_FOLDER/production > /dev/null
- kustomize build argocd-apps/production > /dev/null
- kustomize build argocd-apps/staging > /dev/null
only:
- merge_requests
tags: [k8s-motors]
``` |
Hi everyone, Meanwhile I was able to perform some tests and identify why we get duplicate pipelines and I believe the problem may be the way the implementation of #2745 was done. Let me try to explain. If you have a project which contains workflows to create MR pipelines, the MR 2745 works just fine and Atlantis pipeline will appear in the same MR pipeline (as expected) If you enable in gitlab MR options the setting "Enable merged results pipelines" and then push a commit, the MR pipeline will run in a different pipeline than the Atlantis which will now run a branch pipeline. When you revert it, you would expect the normal behavior (both Atlantis and the project pipeline in the same line) but in reality what happens is that the behavior above is still kept (2 separate pipelines) From what I could understand the issue is with this bit of code which gets the head pipeline from the MR
The issue is that the api call above will return the Atlantis pipeline as being the head pipeline and From that moment on, unless you trigger a new pipeline for the project, the last pipeline will always be the one from Atlantis which is identified as I was also able to test that if the function is just
Deliberately not passing I don't have any use-case or example of when an event is anything else than a merge_request_event to test and would be cool if someone could present some examples of the pipelines that originally were being duplicated and that got solved with the MR above. I also noticed that (at least for Gitlab) the supported Webhook events are Thank you in advance for your time and help, and happy to propose an MR with any sort of fix but just want to better understand first the motivation for the code above and how we can make it work for all use-cases 😃 |
We self host 15.11.2-ee and have this same problem. |
Pinging @michelmzs (I should've done it sooner) as you were the author of the initial MR |
Is anyone currently working on this? This has been a pain point for us for a while. I'd be willing to take a shot at implementing a fix if nobody else has work in flight. |
I thought this was fixed already, have you tested 0.26.0?
…On Wed, Oct 18, 2023, 5:37 p.m. WarpRat ***@***.***> wrote:
Is anyone currently working on this? This has been a pain point for us for
a while. I'd be willing to take a shot at implementing a fix if nobody else
has work in flight.
—
Reply to this email directly, view it on GitHub
<#3373 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3ERHYRL7I5DTVSBFHDYTYABY55AVCNFSM6AAAAAAXUP3FNGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRZG4YTAMZRGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yes, we're still seeing this issue on 0.26.0 with merged results pipelines enabled. Based on the description in this comment I'm not sure if it's even possible to have converged merged results pipelines and external status pipelines which would be ideal. However, we still see the behavior described in that comment where even disabling merged results pipelines still results in a merge request pipeline with our jobs and a separate branch pipeline with the Altantis jobs. If we don't use merge request pipelines at all then everything works as expected in the branch pipeline. If we have to stick to branch pipelines only we can do that but it sounds like it would be a minor fix to get things at least working in merge request pipelines again. We're on Gitlab SaaS which is currently 16.5. |
Sorry for the very late response, guys. Removing the refTarget from setCommitStatus will work for Merge Result pipelines, but the behavior described in #2484 will occur again. Without the ref from head_pipeline, when a user checkout from a branch, the CommitStatus will be issued to the HEAD branch. Also, I think that the duplicated pipeline problem not solved by the mentioned PRs is the race condition of GitLab CI Pipeline creation x Atlantis Webhook process, sometimes Atlantis will be faster than GitLab Pipeline creation, so the CommitStatus will be set in a different Pipeline ID. |
@michelmzs thank you very much for helping understand the issue We will do some tests and hopefully we will be able to overcome the issue. We also had the oportunity to update our Atlantis to one of the latest versions and try it out Thanks once again! |
I assume this is related to our issue: #4615 |
Which MR resolved this issue? Last we checked it was still a problem. I cant find any Pull Req. closing it. |
As reported on that MR, the issue still exists? That MR made no change for us, when you enable merged pipelines, it behaves as it did before. |
Community Note
Overview of the Issue
We updated our Atlantis from v0.20.1 to v0.23.5 and since then we detect that the Atlantis steps are running in a different pipeline than the project, so we now have double pipelines.
Reproduction Steps
Logs
Environment details
Atlantis server-side config file:
Repo
atlantis.yaml
file:The text was updated successfully, but these errors were encountered: