@filipa Not sure if I understand problem correctly, but when you disable pipelines in the project settings, you can read this information through project.builds_enabled?.
@grzesiek I need to know if a MR has CI enabled. I need your help :)
Would project.builds_enabled? be enough?
Here is Slack discussion :
filipais this enough to verify if a MR has ci enabled?`@merge_request.has_ci?`kamil @filipa not sure, I would chekc that, but I assume that notfilipa def has_ci? source_project.try(:ci_service) && commits.any? end@filipa you could maybe improve that check :slightly_smiling_face: Check if the `.gitlab-ci.yml` is in the project[6:58] That is a cached property, so should be fastfilipa:grin: I don’t know how to do thatzj Ill checkThe last check, `commits.any?` is because we can have a MR without changes. Just so you knowThis actually is the best we can do :stuck_out_tongue:I wanted to say, the project should check this! But you can have an MR that introduces it. Futhermore, checking if the current MR includes a CI file isn't cached, so slow. So although this is not perfect, it will have to do@filipa ^Only improvement would be to write`source_project&.ci_service && commits.any?`grzegorz @filipa @zj I think that it depends in which context we need this information. CI can be enabled for merge requests via external CI service too. But we also have internal global configuration option for project (`project.builds_enabled?`).filipa basically we request ci_status endpoint in the MR view even when we don’t have CI enabled in the projectwhat would be the best way in this case?zj`target_project.builds_enabled? || target_project&.ci_service` might be good enough? (edited)grzegorz The question is - should you see the external pipeline status even when "Pipelines" feature is disabled for the project? This is probably question to product people /cc @joshuaI mean this is confusing that you can have external CI service + pipelines disabled, and I'm not completely sure that we are consistent about the expected behavior throughout the codebase.
Sorry for the late response, but given the limitations it seems to make sense. Maybe it needs a comment to explain why it was done the way its done and to stress its just a heuristic.
Also, nitpick: In the first statement you expect the source_project not to be nil, the second expression in the || clause you say it might be.
I don't think this is enough, in a repo with no .yml file and without CI this method returns true.
I am going to hand over this one to a backend person first 😓
We need to have a method that verifies if the project has CI enabled
@markpundsack I recall that you commented about this issue in another issue and you felt having pipelines enabled should not be a requirement for using external build status?
Is that really what you said, and if so, can we cross-link these issues, please?
@dblessing I said it "shouldn't" be a requirement, but I can't confirm whether it is currently a requirement. We may have inadvertently changed something when we dropped the Builds tab, or maybe it always required CI/CD to be enabled.