Page MenuHomePhabricator

Allow for deploying a content branch
Open, Needs TriagePublic13 Estimated Story Points

Description

Currently, we're relying on automated deployment of the content repository. In the future we want to be able to deploy content branches

This ticket can also serve as a good introduction to Ansible and deployment and should be a pairing ticket.

Acceptance criteria:

  • The automated content deployment deploys all branches, not just test and production. It deploys all non-production branches only to web03
  • When a branch gets merged into test, its folder is removed automatically and replaced with a symlink to the test branch
  • While deploying the Fundraising App, we can specify a branch in fundraising-frontend-content

Implementation details

Changing automated deployment
Currently, the test branch is deployed to /local/sites/test-spenden-2.wikimedia.de/fundraising-frontend-content. Use a new folder, e.g. fundraising-frontend-content-branches in /local/sites/test-spenden-2.wikimedia.de/, to avoid breaking existing deployments.

You need to change the files deployments/content.yml and deployments/content/deploy_targets/test.yml. the deploy_target is the name of the branch passed from drone CI

You also need to adapt the .drone.yaml file in the content repository to run for every branch

We might do the 1st step of T254880: Replace JsonStringReader class with CI validation in fundraising-frontend-content (validating the JSON in CI) while working on the Drone configuration

Changing application deployment

  1. Add a variable to the playbook that contains the content branch (defaults to test or production)
  2. Add a symlink step (only when not deploying to prod) that links the content directory inside the application to the branch in /local/sites/test-spenden-2.wikimedia.de/fundraising-frontend-content-branches/BRANCH_NAME, using the variable.
  3. Change the uat (user-acceptance-testing) configuration to use the relative content directory instead of the absolute path to /local/sites/test-spenden-2.wikimedia.de/fundraising-frontend-content.

Automated cleanup
Add a drone workflow to https://github.com/wmde/fundraising-frontend-content/blob/test/.drone.yml that's triggered by merges. It should get the merged branch name from Drone. That branch name can be used in two steps in the workflow, one for deleting the folder and one for creating the symlink.