Validation and deployment of pull requests - codalab/codabench GitHub Wiki

Validation and deployment of pull requests

The main steps are:

  1. Local testing and validation of the changes
  2. Update the test server
  3. Merge develop into master
  4. Update the production server

1. Local testing and validation of the changes

Setup

Required:

  • "Maintain" role on the repository
  • A working local installation

Pull the changes, checkout the branch you are testing and deploy your local instance:

cd codabench
git pull
git checkout branch
docker compose up -d

If necessary, migrate and collect static files (see https://github.com/codalab/codabench/wiki/Codabench-Installation).

💡 Remark: if the branch with the changes is from an external repository, you can create a branch in Codabench's repository and make a first merging into this new branch. Then, you'll be able to merge the new branch into master. This way, the automatic tests will be triggered. EDIT: It may be possible to trigger the tests even if the branch is external. To be confirmed.

Testing

Here is the usual checklist in order to validate the pull request:

The contributor may have provided guidelines for testing that you should follow. In addition to this:

  • Testing must be thorough, really trying to break the new changes. Try as many use cases as possible. Do not trust the contributor.
  • In addition to the checklist of the PR, you can follow this checklist to check that the basic functionalities of the platform are still working: manual validation

Merging

Once everything is validated, merge the pull request. If there are many minor commits, use "squash and merge" to merge them into one.

You can then safely click on Delete branch. It is a good practice to keep the project clean.

2. Update the test server

Here are the necessary steps to update the Codabench server to reflect the last changes. We prodive here general guidelines that work for both the test server and the production server.

Log into the server

ssh codabench-server
cd /home/codalab/codabench

Replace codabench-server by your own SSH host setting, or the IP address of the server.

Optional: use codalab user account

sudo su codalab

Pull the last change

On the test server always stay on develop branch. On the production server, always stay on master branch.

docker compose down
git status
git pull
docker compose up -d

Restart Django

docker compose stop django
docker compose rm django
docker compose create django
docker compose start django

If docker compose does not exist, use docker-compose.

Database migration

docker compose exec django ./manage.py migrate

Do not use makemigrations. Remark: we need to solve the migration files configuration. In the meantime, makemigrations --merge may be needed.

Collect static files

docker compose exec django ./manage.py collectstatic --noinput

Final testing

  • Access the platform from your browser
  • You may need a hard refresh (Maj + R) so the changes take effect.
  • Check that everything is working fine, the new changes, and the basic functionalities of the platform

3. Merge develop into master

Once some pull requests (~3 - 10) were merged into develop, we can prepare a merge into master. Simply create a new pull request from Github interface, selecting master as the base branch:

In the text of the PR, link all relevant PR made to develop, and indicate the URL of the test server. Example: https://github.com/codalab/codabench/pull/1166

4. Update the production server

Same procedure as 2. Update the test server, but on the production server.

Do not forget to access the platform and perform a final round of live testing after the deployment.