Jump to content

Fundraising/tech/crm/Upgrade CiviCRM

From Wikitech
< Fundraising‎ | tech‎ | crm

Creating a CiviCRM upgrade patch

This process is for tracking upstream security patches.

This first step should be done in your development clone of wikimedia/fundraising/crm.

    # Prepare the Civi codebase by checking out our current upstream tracking head.
    git submodule update -i
    cd civicrm
    git fetch --all
    git checkout origin/contrib
    # Get and unpack the new release
    VERS=4.2.17 # for example
    wget http://downloads.sourceforge.net/project/civicrm/civicrm-stable/$VERS/civicrm-$VERS-drupal.tar.gz
    tar xzf civicrm-$VERS-drupal.tar.gz
    mv civicrm civicrm-$VERS
    # It's best to wipe out any deprecated files, as we do here,
    # but you can omit the delete/exclude stanzas if you'd like.
    # NOTE that you will lose any uncommitted development files as well.
    rsync -av \
        --delete --exclude '.git*' --exclude "civicrm-$VERS*" \
        civicrm-$VERS/ ./
    # Get your working stuff out of here
    mv civicrm-$VERS* ..

    # Toss pinch of salt and add everything you find.
    git add -A
    git commit -m "Upgrade to CiviCRM $VERS upstream"
    # Locally review the crazy
    git log -p -1 -w
  • Push the drupal contrib commit for review. DO NOT SELF-MERGE, even if it seems like an emergency.
    git push gerrit HEAD:refs/for/contrib
  • Merge to trunk
    git checkout origin/master
    git merge -m "Merge contrib" contrib
    # ...or you can explicitly give the treeish of your local contrib commit.
    # Do stupid thing to run commit hook and satisfy git-review
    git commit --amend
  • Push the commit for review.
  • In the top-level crm directory, update the submodule pointer.
    cd ..
    git checkout -t origin/master
    git add civicrm
    git commit -m "Update civicrm submodule to $VERS"
  • Push the submodule bump for review.
  • Prepare a merge to deployment and submit for review. The four review steps can be prepared in parallel, fwiw.
  • If you have any doubts about code integrity, deploy to the staging box and test. It's important that WMF's custom patches still work, and determining this can be very tricky. TODO: unit tests for all Civi-core customizations.

Deploying a CiviCRM upgrade

Please note that your particular upgrade may require additional precautions or other action, see the CiviCRM release notes for details.

  • Shut down all jenkins jobs which depend on the CRM. Just turn 'em all off if you're feeling lazy.
  • Kill the lights:
    # Make the site inaccessible
    drush vset site_offline 1; drush vset maintenance_mode 1
    # Clear caches
    drush cc all
    # Update module schemas
    drush updatedb
    # Update CiviCRM schema
    drush civicrm-upgrade-db
    # Make site accessible
    drush vset site_offline 0; drush vset maintenance_mode 0
  • Turn jobs on again, slowly and carefully.

See also