ReleaseEngineering/How To/Update RelengAPI: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Shipping It: new tag scheme since we're not overlapping packages and repos now)
(Update to describe alembic)
Line 6: Line 6:


Will your change
Will your change
;require a DB change:If so, you probably want to make that change beforehand, especially if it's as simple as `relengapi createdb`.  If the change is incompatible, you'll probably need a change window.
;require a DB change:If so, consider carefully whether the DB change or the code change need to be landed first.
;make an incompatible API change:If so, you should endeavor to make it non-incompatible, and otherwise announce the change to any users beforehand.
;make an incompatible API change:If so, you should endeavor to make it non-incompatible, and otherwise announce the change to any users beforehand.


= Shipping It =
= Shipping It =
In whatever distribution you're working on, bump the version number (in `setup.py`), git tag it with the version, e.g., `2.3.4`, and push.
Figure out the next version number based on semantic versioning.  Run `misc/release.sh x.y.z`.  This will open an editor to edit the release notes.  Have a look at the merges included and summarize them.  Try to include context ("retry database operations" doesn't say *which* database operations are retried) and pull request numbers.  See [https://api.pub.build.mozilla.org/docs/relnotes/2.1.0/ the 2.1.0 notes] for a good example.


Build an sdist tarball:
After tagging and pushing, upload the resulting tarball (in `dist/`) to relengapi:
 
python setup.py sdist
 
Upload the resulting tarball (in `dist/`) to relengapi:


  scp dist/relengapi-mapper-2.3.4.tar.gz <your user>@relengwebadm.private.scl3.mozilla.com:/tmp
  scp dist/relengapi-mapper-2.3.4.tar.gz <your user>@relengwebadm.private.scl3.mozilla.com:/tmp
Line 33: Line 29:
  cd /data/releng/src/relengapi
  cd /data/releng/src/relengapi


and edit requirements.txt to specify the new version.  Then
and edit requirements.txt to specify the new version.
 
Now, if you're ready to ship the change live with no DB updates or settings changes:
 
./update
 
This will upgrade the packages, build the docs, and deploy to the webheads.
 
If you need to do some DB migrations or the like first:
 
./update -n
 
which will skip the deployment step.  Then update the DB schema (assuming the schema upgrade won't break the currently-deployed code from the previous release):
 
./relengapi.sh alembic relengapi upgrade
 
(or whatever changes you need to make before deploying the code).  Finally, deploy the new code with


  ./update
  ./update


will upgrade the packages, build the docs, and deploy to the webheads.
In some cases, you'll want to deploy the new code *before* the schema upgrade, in which case, just reverse those steps.


{{Release Engineering How To|Update RelengAPI}}
{{Release Engineering How To|Update RelengAPI}}

Revision as of 13:34, 7 August 2015

RelengAPI is composed of a bunch of different Python distributions. You can see the current versions at https://api.pub.build.mozilla.org/versions.

So, how do you update one of those?

Cautions

Will your change

require a DB change
If so, consider carefully whether the DB change or the code change need to be landed first.
make an incompatible API change
If so, you should endeavor to make it non-incompatible, and otherwise announce the change to any users beforehand.

Shipping It

Figure out the next version number based on semantic versioning. Run `misc/release.sh x.y.z`. This will open an editor to edit the release notes. Have a look at the merges included and summarize them. Try to include context ("retry database operations" doesn't say *which* database operations are retried) and pull request numbers. See the 2.1.0 notes for a good example.

After tagging and pushing, upload the resulting tarball (in `dist/`) to relengapi:

scp dist/relengapi-mapper-2.3.4.tar.gz <your user>@relengwebadm.private.scl3.mozilla.com:/tmp

and put it in place on relengwebadm as root

mv /tmp/relengapi-mapper-2.3.4.tar.gz /mnt/netapp/relengweb/pypi/pub

Please note the files will still be owned by your user, so you should make it universally readable:

chmod a+r /mnt/netapp/relengweb/pypi/pub/relengapi-mapper-2.3.4.tar.gz

Also on relengwebadm, cd to the source directory for staging or production

cd /data/releng-stage/src/relengapi
cd /data/releng/src/relengapi

and edit requirements.txt to specify the new version.

Now, if you're ready to ship the change live with no DB updates or settings changes:

./update

This will upgrade the packages, build the docs, and deploy to the webheads.

If you need to do some DB migrations or the like first:

./update -n

which will skip the deployment step. Then update the DB schema (assuming the schema upgrade won't break the currently-deployed code from the previous release):

./relengapi.sh alembic relengapi upgrade

(or whatever changes you need to make before deploying the code). Finally, deploy the new code with

./update

In some cases, you'll want to deploy the new code *before* the schema upgrade, in which case, just reverse those steps.