Closed (fixed)
Project:
Drupal.org infrastructure
Component:
GitLab
Priority:
Normal
Category:
Plan
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
17 Feb 2022 at 21:45 UTC
Updated:
7 Mar 2024 at 09:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
MixologicComment #3
MixologicComment #4
MixologicComment #5
MixologicComment #6
MixologicComment #7
MixologicComment #8
MixologicComment #9
MixologicComment #10
irinaz commentedComment #11
irinaz commentedComment #12
gábor hojtsyI am part of the testing phase with upgrade_status. Started today and this CI/CD option showed up, woot:
Pipelines offers me lots of options, but none seem to be a match.
So I went to start with a template, but this is VERY generic template that only lets me know what stages I can use and suggests a simple template where the steps echo things out.
I guess I could take that template just for fun to see how this work (I did not use Gitlab CI/CD before). But I did not find the next step. I was expecting this issue to have SOME initial CI suggestions, but it seems to be a skeleton, so not sure how to actually get started.
@moshe suggested we take a look at https://git.drupalcode.org/project/keycdn/-/blob/8.x-1.x/.gitlab-ci.yml which includes https://gitlab.com/drupalspoons/composer-plugin/-/raw/master/templates/.... but that has lots of drupalspoons specific things which I don't think will/should apply here.
Comment #13
MixologicI think we could clarify this a bit. This issue is to *create* the initial CI suggestion. We dont have it yet, we have to figure out what its supposed to be. So we can start with what drupalspoons did, learn from it , and develop an appropriately generic starting point for everybody.
Comment #14
wim leersI think it'd be great if somebody who knows how this is supposed to work could pair with at least one Drupal contrib module maintainer, so that we can get over hurdles quickly, learn quickly, establish best practices quickly. If we don't do that, adoption is going to suffer.
Pairing with somebody who knows the intricacies and assumptions of the GitLab CI infrastructure is critical if this is to work at all (I'm speaking from experience — albeit with a different CI system than GitLab — pairing was the only way to get unblocked).
That being said … @moshe seems to successfully reuse Drupal Spoons's GitLab CI: https://git.drupalcode.org/project/keycdn/-/blob/8.x-1.x/.gitlab-ci.yml → https://git.drupalcode.org/project/keycdn/-/pipelines/4229/builds works! And that led me to https://gitlab.com/drupalspoons/composer-plugin, which is explicitly saying and that first goal is .
Seems like @moshe has already succeeded here, and we can pretty much blindly follow his lead? 😊 Looks like he already made it super simple! 🤩🥳
Comment #15
gábor hojtsyLet's see. Some of the questions I have:
I think various of these questions hide rabbit holes I can go down for days without doing anything useful.
Comment #16
jurgenhaasI worked with @moshe on the composer plugin linked by @Wim Leers and what that project also wants to achieve is that developers can run the same tests, that we now start to make available for GitLab CI, also in their local environment with the same config. That way we can encourage developers to test before push and offload some of the work from d.o infrastructure.
Having said that, GitLab has added a lot of new functionality to their framework recently, and I'm just about to e.g. try their Code Quality template based on Code Climate. This is nicely documented at https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html
Another template I've started is to periodically build webpack applications for projects if upstream components had available updates.
Both experiments are currently under way in a tiny BPMN.iO project at https://git.drupalcode.org/project/bpmn_io
As I have 4-5 years experience with GitLab CI on our self-hosted GitLab instance, I'm happy to continue helping here to build a solid and configurable pipeline infrastructure for d.o contributors. And yes, continuing that on top of what's already present with DrupalSpoons seems reasonable.
Comment #17
kristen polI'm an alpha tester... WIP notes here:
GitLab CIfor GovCMS (Australian) projects so I am familiar with it but I wanted to explore as if I wasn’t familiar with it. I intentionally didn’t read thegitlabDrupal Slack discussions fully so I could go in mostly unaware of what I should do.Pipelines,Editor,Jobs,Schedules.Pipelinesand see there is aUse templatebutton. Search the page forDrupaland there is no option… I already knew this but just trying to think like a new person would think ;)Use templatebutton and see it has a simple.gitlab-ci.ymlfile I can start with. But I know that I can use examples from other alpha testers based on recent chats so I don’t want to do this.Editorand seeCreate new CI/CD pipelinebutton so I click on that. It takes me to the same thing as theUse templatebutton viaPipelines.Jobsand seeCreate CI/CD configuration filebutton so I click on that and it takes me to theEditorpage. Not the best UX IMO but it’s open source! :)Schedulesand seeNew schedulebutton so I click on that and it has aSchedule a new pipelineform which looks like cron stuff but I don’t know what I should do with this so don’t fill out the form.GitLab CIand get GitLab CI/CD | GitLab. Lots of good stuff here.CI/CDandDevOps. It shows the workflow of the pipeline which is good and goes into thegitlab-ci.yml file. Pet peeve: all 3 of the personas are male.gitlab-ci.ymlfile so search for docs specifically for that and find Keyword reference for the `.gitlab-ci.yml` file | GitLab linked from the main but it’s overwhelming so go to the quick start guide: Get started with GitLab CI/CD | GitLab.gitlab-ci.ymlfile at the root of your repository. This file is where you define your CI/CD jobs.”Settings > CI/CD > Runnersand see thatEnable shared runners for this projectis enabled..gitlab-ci.ymlfile, it has a good section on what this is, with the example code available, and where you can look after you add it: Get started with GitLab CI/CD | GitLab. I recommend this section for anyone who’s never used GitLab CI/CD before..gitlab-ci.ymlfile, I know that there has been discussions in the Drupal Slack channel about the.gitlab-ci.ymlfile so I go back to Slack and find these..gitlab-ci.ymlfile for people to use (this issue!): #3265092: [META] Define a default .gitlab-ci.yml template that projects can inherit.gitlab-ci.ymlfile. Stay tuned :)Comment #18
wim leersI did just blindly copy https://git.drupalcode.org/project/keycdn/-/blob/8.x-1.x/.gitlab-ci.yml to be able to work around DrupalCI not allowing any module to be tested that has a direct or indirect dependency on a composer plugin (see @alexpott's comment at #3334914-10: Testing is broken because simplesamlphp/composer-module-installer contains a Composer plugin which is blocked).
And … it sort of works. It still is installing PHP 7.4 by default, but a simple addition fixes that:
(which I found thanks to https://gitlab.com/drupalspoons/composer-plugin)
but unfortunately it does seem to run
phpcson the entire codebase, including all ofvendor, rather than just the Drupal module being tested: https://git.drupalcode.org/project/cdn/-/jobs/36021. I'm 99% certain this is not happening forkeycdnbut is happening forcdnbecause the latter has adrupal/coreentry in therequiresection.This means adopting GitLab CI will require a significant number of existing projects to change their
composer.json(validation for those files to ensure compatibility with the facade would not be a bad thing IMHO…), or the GitLab CI template that we currently have should introduce additional measures to avoid runningphpcsonvendor. Although we probably need both.Per https://www.drupal.org/docs/creating-custom-modules/add-a-composerjson-f..., it's better to effectively create a partial
composer.jsonand let d.o's composer facade generate adrupal/corerequiement based on the*.info.yml… or I guess alternatively one could useconflict?Although even removing that seems to still run into this problem … 🤔😳 At this point I have to give up and move on to other responsibilities…
But it's definitely looking tentatively promising! See the MR at #3334243: CDN 4.x requires PHP >=8.1 but composer does not respect it due to bug in d.o composer facade.
Comment #19
berdir@Wim: You can either just disable the phpcs check with DCI_SKIP_PHPCS: 1 or you can override and customize that job definition from the template and do whatever else you want there to skip the vendor folder. And see also the comment in my issue.
That said, I'm not quite sure why the drupalspoons composer plugin would bother to run composer install within the module at all or why you would end up with a vendor folder inside the module.
I've been working on getting tests working for redis based on select2 and made some progress (have a working double-matrix for d9/d10 and different redis clients), but currently stuck on the fact that apparently php assertions are disabled on the used docker php image/configuration which is causing some test fails and a bunch of other things, seems like Wim has the same problem in his module too.
Drupal 9 on PHP 8.1 is also causing issues due to guzzle, tried to switch over to drupal/core and update guzzle but didn't really manage that yet properly and feels ugly.
Also, the main issue is that if I want to test the Relay integration which is a non-standard extension, it seems like I would have to build, release and maintain my own Docker image that includes that, or maybe use an image that allows me to add apt repositores and packages, which would slow things down I guess.
Comment #20
berdirThe example for redis is here: #3340972: Set up GitlabCI.
That said, in the current state, without any d.o issue queue integration and no official patterns/templates, this seems to be in a more experimental/early phase than I assumed and you probably don't want to use it unless you really have to, like the redis case with requires extra extensions and services or that composer-plugin problem, which seems fixable with a one-liner in DrupalCI if we just allow any plugins for now.
Comment #21
berdirI figured out a solution for the assertion problem, it's not very pretty though: https://git.drupalcode.org/project/redis/-/commit/83dd8a6b04bbb91eb33439...
I also solved the guzzle problem, with a combined D9 + PHP 7.4 and D10 + PHP 8.1 matrix.
Working with the template does feel quite challenging, it's basically 3 layers of the jobs, a setup script that's external than then again builds on a composer plugin, if any of what those things are doing aren't what you need (see the composer plugin problem above), then your only option is to copy & paste the whole thing. At least for the script. My understanding is that composer plugin was written for manual/local testing first, hence the composer aliases. It should probably be at least only a script.
It's also not quite clear to me how to manage some of the convenience we have right now in setting up multiple jobs, with easy to manage core + php versions + database backend (if I understood correctly, postgresql/sqlite support is kinda there in the script but actually disabled/commented out right now), recurring test and so on. Test Matrixes and jobs depending on specific combinations is a powerful feature but quite hard to understand and set up.
Being able to run tests in similar concurrency as we have now is also going to be critical for larger contrib projects and obviously core.
Comment #22
hestenetThe latest template for GitLab-ci has been created here: drupal.org/project/gitlab_templates
https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/gitlab-ci/template.gitlab-ci.yml
When users in the GitLab WebIDE go to add a CI file it is presented as one of the template options.
Need to update the issue summary with instructions/screenshots
Comment #23
hestenetWe've continued to make a lot of progress on this template in:
https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/gitlab-...
I would say this issue is in 'needs review' status.
Comment #24
hestenetComment #25
fjgarlin commentedI'm going through the children issues here. Most of it can be called done now.
GitLab CI adoption is going well and we have +1700 modules on it already (this number is from last month).
Comment #26
fjgarlin commentedAll children issues are fixed now.
Documentation for contrib is available here: https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr...
I am marking this one as fixed.