Problem/Motivation

#3265096: Move issues from www.drupal.org to git.drupalcode.org in this namespace to be able to create fork / MR.
* We need to migrate issues from drupal.org to gitlab.
* We will do it in batches, so it should be driven by project_name.
* We might need to undo the changes.
* Redirects should be created from drupal.org issues to the migrated gitlab issues.

Deployment instructions

  • #3292161: Decouple issues from www.drupal.org issues (parent and related)
  • ✅ Remove project issue cockpit block
  • ✅ Merge the code and run drush en drupalorg_gitlab to enable the new module.
  • ✅ Check that features are in "Default" state. We should see in this page "/admin/config/content/formats/1" a filter called "Gitlab/Drupal.org issue to link filter" which should be enabled. The same for "Full HTML" format. If they do not appear then probably the feature "drupalorg_wysiwyg" needs reverting.
  • ✅ Set up D10 queue with rabbit MQ to listen to the forks queue. drush queue:run drupalorg_issue_forks_queue_worker
  • ✅ On GitLab instance, navigate to: /groups/project/-/hooks and set up a webhook to /drupalorg-api/webhook/contribution-activity. The "Secret token" should match the same one as set in /admin/config/development/drupalorg-gitlab, which is actually populated by an env variable named DRUPALORG_WEBHOOK_TOKEN.

Once the above is done and set up, we can start migrating projects.

Opt-in issue: #3409678: Opt-in GitLab issues

Migrate/rollback projects

  • Migrate issues: drush drupalorg_gitlab:migrate-project-issues [MACHINE_NAME or NID] migrate
  • Rollback issues: drush drupalorg_gitlab:migrate-project-issues [MACHINE_NAME or NID] rollback

Re-enable emails after migrating a project

  • drush drupalorg_gitlab:migrate-project-enable-notifications [MACHINE_NAME or NID] (it accepts more than one project, comma separated)

Related issues from other projects, which may or may not be migrated

  • Migrate related issues for a project: drush drupalorg_gitlab:migrate-related-issues [MACHINE_NAME or NID]
  • Migrate related issues for all projects: drush drupalorg_gitlab:migrate-related-issues-all
CommentFileSizeAuthor
#43 Screenshot 2025-09-16 at 13.39.56.png42.81 KBfjgarlin

Issue fork drupalorg-3295357

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fjgarlin created an issue. See original summary.

crasx’s picture

Nice work on this! Quite the lift. Read through the code and it makes sense to me, some thoughts:

  • Do we maybe want to add offset/page_size as cli params? Might make it easier to recover/resume if there is an error.
  • I like how you broke down the labels into individual functions. Makes it clean and easier to manage!
  • Do we want to store the gitlab issue id on the project_issue content type?
fjgarlin’s picture

Thanks so much for the feedback! It's still a WIP, but coming together little by little.

Do we maybe want to add offset/page_size as cli params? Might make it easier to recover/resume if there is an error.

I'll defo focus on error management if things go wrong, so adding extra params is an option, but I'm still not sure how the whole solution will look like. I'll keep this feedback in mind for sure.

Do we want to store the gitlab issue id on the project_issue content type?

We are using the "redirect" table for this. The entry is "node/NID" in the source field (where NID is the issue id), and the new gitlab URL in the redirect field. So we already have the information. Adding more fields might mean adding more syncing, etc. so, if possible, we will leverage the redirect module in this case.

In any case, I'm sure that the code will evolve over the next few days.

fjgarlin’s picture

Status: Active » Needs work

The MR has three files. It’s the info file, a drush file for the commands, and the .module file. We should merge/deploy to the right place and then drush en drupalorg_gitlab to enable it. Feel free to add reviews to it before we take it any further: https://git.drupalcode.org/project/drupalorg/-/merge_requests/105/diffs

In order to test this in our instance, we’d need:

  • Set the versioncontrol_gitlab_url and versioncontrol_gitlab_key values to the copy we want to test in.
  • It should be an admin key in order to impersonate users.
  • Gitlab rate limit should be disabled for the machine running the commands.
  • The project to migrate should already exist in the gitlab instance, otherwise the script won’t run.
  • The users should already exist, otherwise it’ll fallback into the admin user and a warning will be shown.
  • The files attached to issues should already exist in the d.o copy, otherwise these cannot be uploaded to the gitlab instance and a warning will be shown.

I've made 5 drush commands available:

  • drupalorg_gitlab:migrate-project-issues: Migrate/rollback issues for a given project id or machine_name (will do related issues too and create global labels)
  • drupalorg_gitlab:migrate-related-issues: Do related issues for a given project id or machine_name.
  • drupalorg_gitlab:migrate-related-issues-all: Re-do related issues for all migrated projects.
  • drupalorg_gitlab:undo-everything: Destructive operation, used for testing.
  • drupalorg_gitlab:get-migrated-projects: Returns a list of the projects that have been migrated.

For now, all we'd need to do is to call drush drupalorg_gitlab:migrate-project-issues 1234 migrate (where 1234 is the project ID). That will:

  1. Create global labels if they're not already created.
  2. Migrate the issues (with labels, comments, files, etc) from d.o to gitlab instance.
  3. Create redirects from the d.o issues to the new gitlab ones.
  4. Create redirects from the listing page, issue creation, etc of the d.o project to gitlab.
  5. Populate the related issues within gitlab (if possible within gitlab, otherwise updating the description if the project of the related issue is not migrated - once migrated, the description will be updated removing that bit)
  6. We are NOT yet unpublishing the nodes as this would have side effects on other views/blocks and the #1234: "Mark all as read" in forums. formatter, but I’m aware that that is the plan.

The commands can be re-run multiple times in case if fails halfway. It will pick up where it left.
Once multiple project have been migrated, we can cross reference related issues by running drush drupalorg_gitlab:migrate-related-issues-all (we can run it as many times as we want).

fjgarlin’s picture

Demo of the progress made so far: https://drive.google.com/file/d/1kbw0fpEyq6UWXwK2gZY5Ko4NsJ2wfrOM/view?u...

From my own copy of d.org to my own gitlab.com namespace (hence the warnings when trying to impersonate people).

fjgarlin’s picture

fjgarlin’s picture

Status: Needs work » Needs review
fjgarlin’s picture

fjgarlin’s picture

Issue summary: View changes

drumm made their first commit to this issue’s fork.

  • drumm committed f61d62b on 7.x-3.x
    Issue #3295357 by fjgarlin: Remove link to www.drupal.org issues
    
fjgarlin’s picture

The MR has been simplified and rebased with the changes from #3265112: Decouple change records from www.drupal.org issues.

  • drumm committed f61d62bb on reg-prot authored by fjgarlin
    Issue #3295357 by fjgarlin: Remove link to www.drupal.org issues
    
dww’s picture

Coming here from a #gitlab Slack meeting thread about issue IDs. When you run git blame and find a commit, you see things like “Issue #12345: whatever”. It’s going to very seriously harm DX if I have to check both drupal.org/node/12345 and GitLab issue 12345 to figure out which one is actually it.

According to Moshe, GitLab allows us to set the ID when creating new issues programmatically. I strongly believe we should use the d.o issue NID to specify the gitlab issue ID during the migration. Then, after all the issues are in GitLab, we know that we can always go to GitLab/$project/issues/ID and there won’t be any collisions.

fjgarlin’s picture

I investigated the API possibilities and there is a bit of a conflict here.

It is possible to set the IID when creating an issue (https://docs.gitlab.com/ee/api/issues.html#new-issue), however this "requires administrator or project owner rights". This means that we'd need to run the creation as admin, and this creates a new problem with the "author" property, which would be the user who created the issue, which is a property that can NOT be set on edit (https://docs.gitlab.com/ee/api/issues.html#edit-issue). So this creates a new problem as we'd lose the context of who created the issue.

The way the scripts are designed is to create the new issue and then to create all the needed URL redirects. So somebody going to drupal.org/i/12345 for an old issue will be redirected to the new place. These redirects will be migrated to the new D10 site, so I think it's just a matter of agreeing to this convention, which I think it's even easier than git.drupalcode.org/project/PROJECT/issues/IID

dww’s picture

I’m 💯 for the redirects. I was hoping to have both.

That’s really too bad that you lose who created the issues if you set the ids. What an sad limitation of GL. Maybe there’s a work-around?

Apparently I’m having trouble explaining my concern. I believe it’s going to be confusing and annoying to have to both check two places (the d.o redirect and the GL link), and not really know if a given ID refers to one or the other. I guess we’ll have to start checking dates in commits, too, and memorize the date the migration ran live. There won’t be d.o redirects for new issues, so if I see “12345” in a post-GL commit, I can’t use the “easier URLs”, anyway.

fgm’s picture

Or we could change conventions and ask that issues created on GL be called something else than issue, e.g. "ticket". That way any "issue #xx" would be on d.o. and "ticket #yy" would be on GL.

poker10’s picture

Redirects are great, but I personally feel that these are not enough and that without other connection, this will be very fragile. Imagine that we somehow lose one or more redirects (which I think can happen if these will be editable on d.o. as other content redirects), then there will be no way for users to find that particular issue in Gitlab.

I think there are many places where issue IDs are mentioned just as a plain text (like #123456, without square brackets) and for less experienced contributors it could be hard to find the referenced issue.

I am also wondering if keeping the ID would help directly in GitlabUI, because we still need to resolve/convert strings [#XXX] to the new Gitlab issue IDs, so there would have to be a conversion in place in addition to the redirects (if I understand that correctly). In case we keep the IDs the same, wouldn't we match the Gitlab method of referencing and would it be possible to omit the conversion?

So I agree with @dww and prefer to keep IDs, so we can hopefully find some workaround for that issue with authors (as I think that loosing the information about the issue author is a no-go).

dww’s picture

fgm: indeed, I asked/proposed that in the Slack meeting. Sorry I didn’t mention it here. It’s still a bit of cognitive load, but it’s less than checking dates, for sure. But then we have to re-train everyone on commit message conventions…

moshe weitzman’s picture

The redirect controller could forward unknown issue ids to the gitlab url, without any mapping. That way there is one url to check.

poker10’s picture

Looking at the code of the MR here, redirects seems to be created as a standard redirects via a redirect module.

Another point - we also have links comment/XX, which are redirecting to the concrete comment in the issue. Will these redirects being updated to reference the migrated comments?

fjgarlin’s picture

https://www.drupal.org/comment/15302889 redirects to https://www.drupal.org/project/drupalorg/issues/3295357#comment-15302889.
These redirects are something that we will need to decide if we are going to migrate or not. So far, nothing was written for it.

Right now, when migrating comments to notes, we add as part of the description of the new note Migrated from [comment #%s (#%s)](%s) which has the internal comment order and the CID.

dww’s picture

@moshe re:

The redirect controller could forward unknown issue ids to the gitlab url, without any mapping. That way there is one url to check.

All kinds of flaws with that proposal:

  1. That only works if we assume that Drupal Core is the only project for which this matters. The GL URLs need to include a project name. "12345" could be from any project.
  2. If we don't preserve the IDs, "12345" could be both a valid d.o legacy issue ID, and a rolled over new GitLab ID. So d.o/i/12345 will redirect me to the GL issue for that old NID, but I still might end up on some irrelevant issue if I really needed to be at GL/$project/issues/12345 instead. The only ways for me to know are to compare dates, or re-train every Drupal contributor on commit message conventions (which we should do for other reasons, but that's out of scope here 😅).
  3. It sounds like there isn't a redirect controller, just a bunch of redirect content being generated, so there's not (currently) a way to implement your idea, even if it could work.

Meanwhile, @poker10's concerns about the longevity of all that redirect content is a great one. Makes me think that instead of just generating redirects directly, we should have a redirect controller, and a {drupalorg_gitlab_issue_map} table (or whatever) with all the legacy d.o NIDs -> project + GL IID values. Then no one can break the redirects via the UI. And we'll have a canonical remap table to use going forward in case we need it for other things. I can't imagine the cost of having such a table in our DB is too great for all the potential benefits that would come from doing it that way. It'd probably a more efficient DB-storage than storing all the redirects separately, in fact.

If there's no way to work around GL's limitation that we can't programatically set both IID + Author to what we want, how about we create a new field called "Original Author" or something? So the formal Author on migrated GL issues would be the "admin" user, but we can at least know the regular d.o user that created the legacy issue? Going forward, "Original Author" wouldn't be set on new GL issues, or we automatically set it to the "Author", or whatever. Sort of a PITA, but IMHO less painful than having issue IDs colliding.

drumm’s picture

Makes me think that instead of just generating redirects directly, we should have a redirect controller, and a {drupalorg_gitlab_issue_map} table (or whatever) with all the legacy d.o NIDs -> project + GL IID values. Then no one can break the redirects via the UI. And we'll have a canonical remap table to use going forward in case we need it for other things.

In my experience, the risk of a redirect controller breaking in code updates is higher. Unless we get better at test-driven-development for Drupal.org, it will break at some point and go unnoticed. Using the common redirect module ensures we have less code to maintain and upgrade. And I don’t expect people to be editing these redirects in the UI.

dww’s picture

And I don’t expect people to be editing these redirects in the UI.

It's not about what we expect people to do, it's about preventing the possibility of changing these, either by accident or malice. This is about data integrity.

It's like the map tables from Drupal migrations. Even if you don't intend to write any code to consume it, the cost of generating that table as part of this migration is almost nil. The possibility that it will really come in handy exists.

If, 3 years from now, we want to check if all the redirects still exist, the table would let us. If we decide we prefer a custom controller for some reason(s), we could.

fjgarlin’s picture

I have a task in my backlog to adapt the IID of the migrated issue to that of the NID. From what we've read (see links in #16), it is possible, and I will try to achieve it. I just haven't coded it yet.

poker10’s picture

I have mentioned this on Slack, but will post it here too.

Not sure what is the exact status of the MR (I have not reviewed it), but from what I remember, there were some open concerns about keeping the issues IDs, how issue metadata should be migrated (#3254602: Using GitLab labels for issues on Drupal projects), and similar. @fjgarlin when you will have time to work on this again, it will be great to update the current status (what is done, what decisions are needed and what work is needed).

Given that this will be a one-time migration (for each project), without an option to revert (unlike the GitlabCI migration), I think it would be great, if we can see at least one "demo" project migrated first. We will be able to evaluate and test, if everything went correctly, if all references to issues, comments, etc, are kept and working, how the meta info are migrated, etc. Some feedback could be collected this way before the real migrations via opt-in process will start.

Issues are currently the most important part of our collaboration. Each commit references to an issue (ideally), there are multiple references to the issues IDs, etc. We need to be very careful to ensure, that no history / connections will be lost after migration. This is main reason why I think a first example demo project migration would be a good idea.

Thanks!

fjgarlin’s picture

Re IID, there is some code that needs to be tested. I just added it to the MR as a comment for clarity.

We will have an opt-in for projects, and initially, we have mechanisms to revert the migration in case something goes really bad. But yeah, we will need to test with a handful of projects and then test references and a few other things before doing more projects.

Once I come back to work on this, I'll mention it here and we can see what the next steps are.

poker10’s picture

I quickly skimmed the MR and tried to find if we are migrating also issues followers and have not found anything. Is there a plan to keep who is following which issue, so that issue notifications are kept as they were on d.o.?

baluertl’s picture

Title: Migrate drupal.org issues to gitlab issues » Migrate drupal.org issues to GitLab issues
fjgarlin’s picture

Re #30. Correct, nothing is done so far and we'd need to add that functionality to the code in order to keep them.

fjgarlin changed the visibility of the branch 7.x-3.x to hidden.

fjgarlin’s picture

Issue summary: View changes
fjgarlin’s picture

Issue summary: View changes
Related issues: +#3409678: Opt-in GitLab issues

In the last 3 commits to this MR we can see:
- Adding issue subscribers from the existing issue followers in the drupal.org issue
- Setting the IID of the GitLab issue to be the NID of the drupal.org issue

poker10’s picture

What about existing forks/merge requests, which are associated with d.o. issues? Will these be migrated too?

fjgarlin’s picture

Issue summary: View changes

That is a great point. We need to test and check what's going to happen there.

I added it as a blocker, together with another important case that will need to happen as well.

fjgarlin’s picture

Status: Needs review » Needs work
fjgarlin’s picture

fjgarlin’s picture

Issue summary: View changes
fjgarlin’s picture

Issue summary: View changes
fjgarlin’s picture

Re preserving NID so it becomes the IID of the new issue (requested in several comments).

This is possible if the issue is created as admin. However:
- Doing this makes the author of the issue the admin user.
- Impersonating the user when creating the issue makes the author correct, but does NOT preserve IID.

There is no api method to change the author of an issue. It needs to be set correctly on issue creation.

https://docs.gitlab.com/api/issues/#new-issue

iid … The internal ID of the project’s issue (requires administrator or project owner rights).

Author, author_id, author_username... are not valid parameters when creating issues (I even tried and they are ignored).

Edit issue method https://docs.gitlab.com/api/issues/#edit-an-issue does not allow IID nor author param either.

fjgarlin’s picture

StatusFileSize
new42.81 KB

For now, giving priority to keeping IID over issue author, I've added the author information in the description of the migrated issue: https://git.drupalcode.org/project/drupalorg/-/merge_requests/105/diffs?...

It'd show like this:
author

fjgarlin’s picture

Issue summary: View changes

One of the blockers is solved now.

ressa’s picture

Thanks for your huge efforts with the GitLab migration @fjgarlin. Since NID is mentioned here, I just want to share something I observed:

https://www.drupal.org/project/drupalorg/issues/3292161

... maybe this is intentional, or maybe not? I thought I'd let you know.

fjgarlin’s picture

Re redirects, that has been the case for a long time. There are two existing redirects per issue right now.

We are adding this third redirect in the code:

_drupalorg_gitlab_add_redirect('node/' . $record->nid, $issue_gitlab_url);

So, when this is done:
- node/NID will 301 redirect to the gitlab issue
- i/NID will 302 redirect to the d.o issue, which will 301 redirect to the gitlab issue
- project/PROJECTNAME/issues/NID will 301 redirect to the gitlab issue

poker10’s picture

Personally, I agree that keeping old NIDs as GitLab IDs seems more beneficial than keeping authors of issues. Great we can solve it at least this way.

Looking at my earlier comment #22 (and #23) - is there a decision whether we want to keep/migrate also the comments redirects? Seems like there are at least two places in 11.x branch (1, 2), where such a link is used. Not sure how many are used in issues' comments itself (can we check it in the database?).

Also have another question - currently the redirects on i/NID and links on node/NID are universal and are working even without knowledge of the specific project, in which the issue is created. I suppose that if we move an issue to a different GitLab project after the migration, the redirect from node/NID would still work to a correct (new) GitLab project?

And speaking about this (but this question is not related to the migration itself), it seems like that for all new issues created in the GitLab after the migration, we will loose the ability to find such issue just by entering the ID somewhere (without knowledge of the specific project)? Presumably, this is also because issues in GitLab have separate numbering in each project?

Thanks!

fjgarlin’s picture

Yeah, the plan is:
- Keep d.o NID as gitlab issue IID, losing author metadata information (it will be in the description)
- Do not keep/do comment redirects (severe performance implications)
- Post migration, gitlab issues from separate projects could have the same IID.
- If you move an issue, gitlab creates/keeps redirects for that

fjgarlin’s picture

Issue summary: View changes

The other hard blocker is already fixed and in place.

fjgarlin’s picture

Issue summary: View changes

Updated deployment instructions.

fjgarlin’s picture

Issue summary: View changes

Updated deployment instructions.

fjgarlin’s picture

Issue summary: View changes

Added link to contribution records and changed formatting of the top of the issue description with the extra info.

poker10’s picture

Once this is ready, I am curious if we can see a migrated test project somewhere (even in the staging/test env), to help with testing before doing the first production migration of the DA projects? That could probably help identify issues before doing first irreversible production migrations.

And should this issue #3254602: Using GitLab labels for issues on Drupal projects be a blocker too, since we probably need that decided before the first migration? Thanks!

fjgarlin’s picture

We will start with some DA-owned projects first. We are currently testing things in our staging instance.

Re labels, we are not changing anything so far, we are migrating what we have as-is.

fjgarlin’s picture

Labels will be migrated like:

'version::' . $value
'component::' . $value
'priority::' . $value
'category::' . $value
'why::' . $value
'state::' . $value
fjgarlin’s picture

Issue summary: View changes

Webhook has been setup.

drumm’s picture

For labels, we do need to decide whether each label created for migration is project-specific or global (set in the /project & /sandbox groups). While there’s always the ability to change things later, it’s easier to avoid wanting to do bulk updates in GitLab. I’ve updated #3254602: Using GitLab labels for issues on Drupal projects to propose making issue status the only global label, the rest would be project-specific, and I’ve also made some notes on which ones might be scoped labels.

fjgarlin’s picture

Re #57, it'd be really easy to make most of them project-specific, it's just a matter of commenting out a couple of lines, as shown in the MR via a suggestion.

fjgarlin’s picture

All labels are now project specific. Should we need to promote them to group, that's possible:
https://docs.gitlab.com/user/project/labels/#promote-a-project-label-to-...

  • drumm committed 02df5b40 on 7.x-3.x authored by fjgarlin
    [#3295357] feat: Add support for migrating Drupal.org issues to GitLab...
fjgarlin’s picture

Issue summary: View changes

The main MR was merged. Any additional changes will be follow-up MRs, much smaller and easier to review.

fjgarlin’s picture

Status: Needs work » Needs review

@drumm - follow-up MR: https://git.drupalcode.org/project/drupalorg/-/merge_requests/414/diffs

This was the section that was assigning colors to the labels. We were fetching just the first page, and with this MR we will loop through all of them.

  • drumm committed dab21210 on 7.x-3.x authored by fjgarlin
    [#3295357] fix: Fetch all labels, not just first page
    
fjgarlin’s picture

Issue summary: View changes

#3292161: Decouple issues from www.drupal.org issues (parent and related) was merged and deployed now.

Only pending deployment step is to remove the issue cockpit from the project's page.
Then we can start migrating projects from the opt-in issue (+200 projects).

  • drumm committed c41f8513 on 7.x-3.x authored by fjgarlin
    fix: #3295357 Various improvements to GitLab issue migration
    

  • drumm committed 26dd2c07 on 7.x-3.x authored by fjgarlin
    feat: #3295357 Create common labels for all projects
    

  • drumm committed 2ddb4b54 on 7.x-3.x authored by fjgarlin
    fix: #3295357 do not migrate blocked issue followers, fix character...
drumm’s picture

I ran into a couple timeouts. These have been very rare.

Created Gitlab issue #2310049                                                                                                                                                                    [ok]
* ERROR: cURL error 28: Operation timed out after 120138 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)                                             [error]
WD drupalorg_gitlab: * ERROR: cURL error 28: Operation timed out after 120138 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)                        [error]

Created Gitlab issue #2301745                                                                                                                                                                    [ok]

We should log the file & line number, so we can track down what exactly timed out. If possible, the URL path being requested would be good to log too. If convenient, we can log the issue nid too, so we have a good list in logs, without needing to review console output.

120 seconds seems like a good timeout, I don’t think we need to adjust that. Depending on what’s going on, we might look into retries or some other error handling. Ideally this is something that happens in staging only.

drumm’s picture

GitLab’s https://git.drupalcode.org/ghost is the equivalent of Drupal’s assigning content to the anonymous user. It can be impersonated: https://git.code-staging.devdrupal.org/project/drupalorg_crosssite/-/iss...

To test on staging, I manually associated anonymous with it:

INSERT INTO versioncontrol_gitlab_users (gitlab_user_id, picture_timestamp, uid) VALUES (46370,0,0);
UPDATE users SET git_username = 'ghost' WHERE uid = 0;

-- Find some anonymous comments
SELECT c.cid FROM comment c INNER JOIN field_data_field_project fdf_p ON fdf_p.entity_id = c.nid INNER JOIN field_data_field_project_machine_name fdf_pmn ON fdf_pmn.entity_id = fdf_p.field_project_target_id WHERE c.uid = 0 AND fdf_pmn.field_project_machine_name_value = 'drupalorg_crosssite';

I don’t want to do that in production, I’m not sure if there might be side effects. For migration, we can hard-code the ghost username for uid 0.

While we are there, $fallback_to_admin looks like it is no longer used, since we’re ensuring everyone has a GitLab account. That logic can be removed.

drumm’s picture

Comment created date
The migrated comments come in with a current timestamp. I expect that’s something we can’t forge. (If we could forge it by posting as an admin, that trade-off isn’t worth it to me. Knowing who said what is more important.)

Let’s add the comment created time to the header like

Migrated from comment #12 posted 13 July 2012 at 11:10 UTC

Weird comment numbers
https://git.code-staging.devdrupal.org/project/drupalorg_crosssite/-/iss... has some high comments numbers, like “Migrated from comment #14256” which corresponds to “11.0” https://www.drupal.org/project/drupalorg_crosssite/issues/1549374#commen...

These comments were created during the D6 to D7 upgrade where we also added nodechanges and required that every revision have a comment. The comments got a decimal to slot them into the comment thread without changing the surrounding numbers.

nodechanges_get_comment_thread_id() is where this obscure workaround to make these numbers landed.

Note issue summary updates
If we can, let’s add something like this when the issue summary was updated.

> Updated issue summary

While it is impractical to import the full issue summary revision history, adding the context that it was updated will help maintainers make crediting decisions when the commenter didn’t add any context for what they did.

drumm’s picture

#3300073: Update user edit form with identity portal integration has an edge case where the files posted in #3,4,5 aren’t on the node’s list of files for some reason. So we’ll have to call file_load() in this case to get the file details.

Created Gitlab issue #3300073                                                                                                                                                                    [ok]

* Adding 7 followers to the issue.                                                                                                                                                               [ok]
* Created note 646089                                                                                                                                                                            [ok]
Undefined offset: 6666480 drupalorg_gitlab.module:969                                                                                                                                               [notice]
Undefined offset: 6666481 drupalorg_gitlab.module:969                                                                                                                                               [notice]
* Created note 646090                                                                                                                                                                            [ok]
Undefined offset: 6666483 drupalorg_gitlab.module:969                                                                                                                                               [notice]
Undefined offset: 6666484 drupalorg_gitlab.module:969                                                                                                                                               [notice]
* Created note 646091                                                                                                                                                                            [ok]
Undefined offset: 6666519 drupalorg_gitlab.module:969                                                                                                                                               [notice]
Undefined offset: 6666520 drupalorg_gitlab.module:969                                                                                                                                               [notice]

nicxvan’s picture

While it is impractical to import the full issue summary revision history, adding the context that it was updated will help maintainers make crediting decisions when the commenter didn’t add any context for what they did.

That is really unfortunate.

What about moving forward though? Are git lab issue summary diffs available?

fjgarlin’s picture

From slack:

...URLs are not linked in the IS in GitLab.... Example: https://www.drupal.org/node/3559014

Addressed in https://git.drupalcode.org/project/drupalorg/-/merge_requests/428/diffs?...

--

What about moving forward though? Are git lab issue summary diffs available?

Yes, this is a feature available in GitLab issues.

fjgarlin’s picture

Re #72. If there are errors for some issues, we can just re-run the command and it will migrate the remaining ones only.

Commit for more output on debug
(moved stacktrace to watchdog table only as part of this other commit)

--

Created comment date

We were setting it up in code like $note = $issue->addComment($preamble . "\n\n" . $body, date("c", $comment->created));, but yes, that property is an admin-only one per https://docs.gitlab.com/api/notes/#create-new-issue-note.

Commit for this

--

Weird comment numbers

Commit for this

fjgarlin’s picture

Note issue summary updates

Commit for this

All feedback addressed now.

  • drumm committed 039dc7a7 on 7.x-3.x
    fix: #3295357 Issue migration feedback round 3
    
drumm’s picture

Empty comments
https://www.drupal.org/project/drupalorg_crosssite/issues/2981570#commen...
only has the issue summary update, and was short-circuited to not migrate. Let’s insert “Updated issue summary” earlier, so this does get a migrated comment. While these are not really substantive comments, I think we should keep them. At the very least, will save a few people asking about gaps in the comment numbers, and may influence maintainers’ crediting decisions.

Image with absolute URL
https://www.drupal.org/project/drupalorg_crosssite/issues/2981570#commen...
has an image with an absolute URL that gets the domain prefix https://www.staging.devdrupal.orghttps://www…

_drupalorg_gitlab_transform_relative_urls() can have the form element handling removed, there won’t be any working forms migrated.

For detecting absolute URLs, let’s do something like is_null(parse_url($value, PHP_URL_SCHEME)) rather than trying to match http/etc, there might be mailto/ftp/gopher/etc.

If the URL starts with a single /, then we can add the domain prefix as we’re doing now.

Theoretically someone could have posted a directory-relative URL, like href="3548544" but that should be very rare, if it happens at all.

  • drumm committed f524b96e on 7.x-3.x
    fix: #3295357 Wording improvement
    

voleger’s picture

Will comment URL https://www.drupal.org/project/drupalorg_crosssite/issues/1549374#commen... of #11 comment redirect to the appropriate new comment URL https://git.code-staging.devdrupal.org/project/drupalorg_crosssite/-/iss... ?
Maybe it's possible to add markup to the migration message and add an ID attribute to the comment ID (id="comment-8058371" for `#14256` of the Migrated from comment #14256. message)?

fjgarlin’s picture

We are not doing comment redirects. But we are already doing the second part that you mentioned, as a hidden comment. See the code here: https://git.drupalcode.org/project/drupalorg/-/blob/7.x-3.x/drupalorg_gi...

That adds a hidden comment with the original CID and a visible comment with the comment order that we can see.

fjgarlin’s picture

Addressed feedback from #82:
- Empty comments -> commit
- Image with absolute URL -> commit + commit

drumm’s picture

Re ID attributes - trying this out quickly, and looking at the documentation, I don’t see that GitLab markdown allows custom IDs at all https://docs.gitlab.com/user/markdown/#heading-ids-and-links. I believe the fragment is not passed to the server, so we couldn’t do any special redirecting server-side.

drumm’s picture

There have been a couple requests for labels in Slack.

Different colors for components, tags, and versions
I think we’d have to do a static variable in _drupalorg_gitlab_get_labels() to keep track of what we’ve added. Then the API call after Get the project labels and add descriptions and colors. could be replaced with getting the values back out.

Distinguishing “deprecated” components
The available component values are a multi-value text field on the project node. The component of an issue is a text field on that issue. So issues can have components that the project currently does not allow. To preserve the issue data, we do want to keep migrating components as they are on the issue. We could add a (deprecated) suffix to the label to distinguish that the project no longer wanted to use the component.

fjgarlin’s picture

Different colors for components, tags, and versions: commit + commit

Distinguishing “deprecated” components: commit

  • drumm committed 1b1e424a on 7.x-3.x authored by fjgarlin
    fix: #3295357 Improve URI rewriting, comment ordering, and label colors
    

  • drumm committed 12c1c02e on 7.x-3.x authored by fjgarlin
    fix: #3295357 correct label update logic, issue closing permission
    
fjgarlin’s picture

Weird code formatting: https://git.code-staging.devdrupal.org/project/mgv/-/issues/3450202 + https://git.code-staging.devdrupal.org/project/mgv/-/issues/3447272#note...

Quote looking the same as the automated comment so it might be ignored visually: https://git.code-staging.devdrupal.org/project/mgv/-/issues/3447272#note...

Automated messages for open and close issue appear together due to queue delay: https://git.code-staging.devdrupal.org/project/tagify/-/issues/3545332

I will work on this three things next.

fjgarlin’s picture

Automated messages for open and close issue appear together: commit

fjgarlin’s picture

MR https://git.drupalcode.org/project/drupalorg/-/merge_requests/433/diffs
Addresses: Weird code formatting and Quote looking the same as the automated comment

  • drumm committed 27cfc026 on 7.x-3.x authored by fjgarlin
    fix #3295357: Improve code block formatting, italicize automated...

  • drumm committed 0d18994a on 7.x-3.x
    fix: #3295357 Improve project bookkeeping when issues are migrated
    
    -...
drumm’s picture

Issue summary: View changes

I pushed a few changes around tracking each project’s status:

  • Remove access to legacy issue queue configuration fields once a project is migrated
  • Static cache project migration status check, since that will be called multiple times per page load
  • Disable legacy issue queue as migration starts, this hides the issue cockpit block for that project
  • Clear block cache for project page sidebar updates
  • Do not require legacy issue queue to be enabled to show the sidebar link to GitLab issues

Since the migration isn’t quick, we might need to track if a migration is in-flight and show the sidebar link to GitLab issues if it has started. Otherwise, there might not be a link to any issues. We can handle that later, as we’re doing the smaller migrations first.

  • drumm committed d3ce8672 on 7.x-3.x
    fix: #3295357 Do not try making automated comments when the issue queue...

  • drumm committed 25071258 on 7.x-3.x authored by fjgarlin
    fix: #3295357 Improve nodechanges formatting, sort comments
    

  • drumm committed 77676e44 on 7.x-3.x authored by fjgarlin
    fix: #3295357 Do not unpublish issues, migrate automated commit comments
    

fjgarlin’s picture

While testing projects in staging, we had timeouts on some requests that made some issues be only partly migrated. We could retrigger the whole project migration command, and it'll go through those uncompleted issues in most cases, but it didn't cover all cases.

So a new command to migrate individual issues is added in https://git.drupalcode.org/project/drupalorg/-/merge_requests/440, in case we need it. We need to pass the project and the issue nids, like this: drush drupalorg_gitlab:migrate-individual-issue config_notify 3478954,3506647 and it will re-migrate only and only those issues. The project needs to be fully migrated before using this.

  • drumm committed 27bdafa7 on 7.x-3.x authored by fjgarlin
    feat: #3295357 Add drush command to migrate individual issues
    

fjgarlin’s picture

The api-d7 endpoint shouldn't return data if the issue is migrated.
https://git.drupalcode.org/project/drupalorg/-/merge_requests/443/diffs will adapt the format of the returned information to just include the new link.

  • drumm committed 230c242e on 7.x-3.x authored by fjgarlin
    fix: #3295357 change issue RestWS return format if the issue is migrated
    

  • drumm committed f7c40518 on 7.x-3.x
    fix: #3295357 Use redirect module’s API, so DB indexes are used
    

fjgarlin’s picture

Some small additions are ready in MR444.

fjgarlin’s picture

https://git.drupalcode.org/project/drupalorg/-/merge_requests/456/diffs

Adds as first comment the same as the "automated messages" are when we are working on new issues.

  • drumm committed 4324fca4 on 7.x-3.x authored by fjgarlin
    feat: #3295357 Add first automated comment, replacing links in the...

fjgarlin’s picture

After migrating some more projects, it seems that some emails were queued up, and if they were trying to be delivered after the migration, then notifications were sent. We migrated two projects and it only happened in one, and not for all issues.

We've decided to not enable notifications at the end of the automated migration script, and defer that to a separate drush command.

The MR is here: https://git.drupalcode.org/project/drupalorg/-/merge_requests/461/diffs

fjgarlin’s picture

Issue summary: View changes

Updated issue summary with the new command to re-enable emails after the migration.

  • drumm committed 58386c15 on 7.x-3.x authored by fjgarlin
    feat: #3295357 Separate command for enabling notifications
    

  • drumm committed 01b4865a on 7.x-3.x
    feat: #3295357 Update report security vulnerability link for projects...

  • drumm committed 44132bed on 7.x-3.x
    feat: #3295357 Remove “Add to dashboard” link for projects with issues...
fjgarlin’s picture

@jonathan1055 found an issue where migrated issues didn't have labels.

$record = node_load(3562180);
print_r(_drupalorg_gitlab_get_labels($record));

Array
(
    [0] => gitlabCi (deprecated)
    [1] => priority::normal
    [2] => category::task
    [3] => state::closed
    [5] => why::worksAsDesigned
)

does NOT work. it does not add the labels but the issue creation is successful.

$record = node_load(3562180);
print_r(array_values(_drupalorg_gitlab_get_labels($record)));

Array
(
    [0] => gitlabCi (deprecated)
    [1] => priority::normal
    [2] => category::task
    [3] => state::closed
    [4] => why::worksAsDesigned
)

does WORK!

@drumm will be pushing the fix for this later.

jonathan1055’s picture

Thank you for fixing it so quick. For info, here is the slack thread in the new #gitlab-issues-feedback channel

  • drumm committed b9b1dc31 on 7.x-3.x
    fix: #3295357 Issue labels must be consecutive & numerically-indexed
    

  • drumm committed bc1eb4c6 on 7.x-3.x authored by fjgarlin
    fix: #3295357 Check for unpublished issues before migrating