New contribution records system
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3327584. -->
Reported by: [fjgarlin](https://www.drupal.org/user/2495842)
Related to !397 !395 !392 !388 !386 !384 !382 !378 !376 !375 !374 !373 !372 !371 !370 !365 !367 !366 !364 !351 !362 !361 !360 !355 !354 !353 !350 !336 !337 !332 !273 !147
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>As a new system for contribution records is being built (see <a href="https://www.drupal.org/project/infrastructure/issues/3322116">https://www.drupal.org/project/infrastructure/issues/3322116</a>), we will need changes on D7 <a href="http://www.drupal.org">www.drupal.org</a> to adapt and communicate with it.</p>
<p>The following tasks are part of the bigger plan detailed here: <a href="https://docs.google.com/spreadsheets/d/1UVM8Bs6VdoJFo2-DQGjTRo5yeecMWMvpRfgi8yhPQcQ/edit?pli=1#gid=1856250352">https://docs.google.com/spreadsheets/d/1UVM8Bs6VdoJFo2-DQGjTRo5yeecMWMvpRfgi8yhPQcQ/edit?pli=1#gid=1856250352</a></p>
<p>✅ Migrate existing credits to the new system<br>
✅ Provide links on issues to the new system related record<br>
✅ Trigger webhook for comments to update contributors on new system<br>
✅ Trigger webhook for issue status change to update the contribution record status on the new system<br>
✅ Hide any form or reference to the old attribution system (comment form on issues)<br>
✅ Change to user profiles to read from the new system<br>
✅ Changes to organizations to read from the new system<br>
✅ Changes to marketplace to read from the new system<br>
✅ Improve UX to add individual contribution records and bulk credits</p>
<p>I will use this issue/branch to put all the D7 changes that are required.</p>
<h3>Deployment</h3>
<p><strong>✅ First phase: Send data to new.drupal.org:</strong><br>
- MR: <a href="https://git.drupalcode.org/project/drupalorg/-/merge_requests/337">https://git.drupalcode.org/project/drupalorg/-/merge_requests/337</a></p>
<p>- Settings on D7:<br>
-- Set <code>drupalorg_credit_migration_token</code> to the same value as the one set in D10<br>
-- Set <code>contribution_records_base_url</code> to <code>https://new.drupal.org</code><br>
-- Set <code>drupalorg_contribution_record_delay_microseconds</code> if we want to throttle requests to D10<br>
-- Setup queue <code>drupalorg_issue_events</code></p>
<p>- Settings on D10:<br>
-- Allow 'contribution_records' in <code>drupalorg_allowed_content_types</code><br>
-- Allow <code>/contribution-record*</code> paths on Fastly<br>
-- Allow <code>/drupalorg-api/*</code> paths on Fastly (I think this is done)<br>
-- Setup environment variable so this line works: <code>$config['drupalorg.settings']['credit_migration_token'] = getenv('DRUPALORG_CREDIT_MIGRATION_TOKEN');</code><br>
-- Setup queue <code>contribution_records_import_queue_worker</code></p>
<h4>✅ Send and process data from D7 to the new system</h4>
<p>* <strong>[D7 <a href="http://www.drupal.org]">www.drupal.org]</a></strong>: <code>drush drupalorg-contribution-records-sync --raw-import=2</code> (when the queue runs, the record will be queued to be created in the new system, so the D7 push operation will be quick and should not timeout).<br>
* <strong>[D7 <a href="http://www.drupal.org]">www.drupal.org]</a></strong>: <code>drush drupalorg-contribution-records-sync --node-type=sa --raw-import=2</code> - same but for SA.<br>
* <strong>[D7 <a href="http://www.drupal.org]">www.drupal.org]</a></strong>: <code>drush queue-run drupalorg_issue_events</code><br>
* <strong>[D10 new.drupal.org]</strong>: <code>drush queue:run contribution_records_import_queue_worker</code></p>
<h4>✅ Data integrity checks</h4>
<p>Compare the data from the current system and the new system. See <a href="https://git.drupalcode.org/project/contribution_records/-/blob/1.0.x/scripts/check-records.sh?ref_type=heads">data integrity checks</a>.</p>
<h4>✅ Second phase: read credits from the new system</h4>
<p>- Merge MR351 / MR364 / more to come...<br>
- <code>drupalorg_credit_system</code> defaults to <code>legacy</code>, so everything will continue to be the same in D7 once merged.<br>
- Test new system (reading credits):<br>
-- <code>drush vset drupalorg_credit_system "modern"</code><br>
-- <code>drush cc views</code><br>
-- Visit user pages, org pages, owner tools pages, and re-run marketplace calculations</p>
<p>- Revert to old system (D7):<br>
-- <code>drush vset drupalorg_credit_system "legacy"</code><br>
-- <code>drush cc views</code><br>
-- Visit user pages, org pages, owner tools pages, and re-run marketplace calculations</p>
<h4>✅ Last phase: write credits to the new system</h4>
<p>- <strong>D7</strong> Make the new system the canonical source of credit information<br>
-- <code>drupalorg_credit_system</code> needs to be set to "modern"<br>
-- Then <code>drush vset drupalorg_credit_system_data_source "modern"</code> (or "legacy" to revert)<br>
- <strong>D10</strong><br>
-- Enable permission "edit any contribution_record content" for "authenticated users"<br>
-- Remove integrity checks cron job on prod. Add the following to `helm/drupalorg/prod/values.yaml` (watch indentation) in the "helm-deploy-tree" repo.</p>
<pre>migrationJobsStatus:<br> contributionRecords: false</pre><p><strong>Steps:</strong><br>
<strong>BEFORE</strong><br>
- Communicate change and 20-30 min outage.<br>
- Set red banner top message with the information?</p>
<p><strong>DEPLOY</strong><br>
- Merge last D7 changes: <a href="https://git.drupalcode.org/project/drupalorg/-/merge_requests/392/diffs">https://git.drupalcode.org/project/drupalorg/-/merge_requests/392/diffs</a><br>
- Set D7 flag to "modern"<br>
- Run integrity checks one last time<br>
- Merge D10 changes: <a href="https://gitlab.com/drupal-infrastructure/sites/drupalorg/-/merge_requests/180/diffs">https://gitlab.com/drupal-infrastructure/sites/drupalorg/-/merge_requests/180/diffs</a><br>
- <del>Merge helm-deploy-tree MR: <a href="https://gitlab.com/drupal-infrastructure/helm-deploy-tree/-/merge_requests/119/diffs">https://gitlab.com/drupal-infrastructure/helm-deploy-tree/-/merge_requests/119/diffs</a></del></p>
<p><strong>AFTER</strong><br>
- Clean all that work up (that can happen after)<br>
-- D7: Remove uneeded contributors block: <a href="https://git.drupalcode.org/project/drupalorg/-/merge_requests/397/diffs">https://git.drupalcode.org/project/drupalorg/-/merge_requests/397/diffs</a><br>
-- ✅ D10: Remove temp message: <a href="https://git.drupalcode.org/project/contribution_records/-/merge_requests/15">https://git.drupalcode.org/project/contribution_records/-/merge_requests/15</a> + site update.<br>
-- 🚧 D10: Integrity check job in the module: <a href="https://git.drupalcode.org/project/contribution_records/-/merge_requests/16/diffs">https://git.drupalcode.org/project/contribution_records/-/merge_requests/16/diffs</a><br>
-- D7: any code using "drupalorg_credit_system_data_source" if/else</p>
issue