Skip to content

feat: pr watcher for Grove

Keith Grootboom requested to merge keith/pr-watcher into main

Description

Adds PR watching support to Grove for edx-platform forks.

When the command is invoked it will check the provided EDX_PLATFORM_FORKS and GITHUB_USERNAMES for any open or closed pull requests.

  • If the pull request is open
    • Trigger the creation of a new instance if it doesn't exist in the grove-template fork
    • Otherwise trigger the update pipeline
  • If the pull request is closed
    • run the destroy pipeline if it's still running (by checking if the namespace exists).

Some assumptions and notes:

  • Instances names are of the format pr-{pr-number}-{fork-hash} so that operators can watch more than one fork and not have collisions
  • The settings block is unchanged from Ocim's
  • The code in github.py is almost a direct copy of Ocim's.
  • When an instance is created/updated a PR_WATCHER key is added to grove.yml to keep track of what was last deployed.
  • Due to time constraints, only a few integration tests are added.
  • The PR watcher CRON is set to run once per hour. It is not enabled on the test environment.

Testing instructions

Test the create:

I've created a test edx-platform fork https://github.com/keithgg/edx-platform and added keithgg and gabor-boros to the list of allowed users.

Test the update

  • Make a change to your PR and run the curl command again.
  • The update pipeline for your PR will be triggered.

Test the destroy

Checklist

If any of the items below is not applicable, do not remove them, but put a check in it.

  • All providers include the new feature/change
  • All affected providers can provision new clusters
  • Unit tests are added/updated
  • Documentation is added/updated
  • The TOOLS_CONTAINER_IMAGE_VERSION in ci_vars.yml is updated
  • The grove-template repository is updated
Edited by Keith Grootboom

Merge request reports