Skip to content

Instantly share code, notes, and snippets.

@grahamb
Last active January 18, 2016 19:10
Show Gist options
  • Save grahamb/223731299981cb0107dd to your computer and use it in GitHub Desktop.
Save grahamb/223731299981cb0107dd to your computer and use it in GitHub Desktop.
Automate Cutting a Canvas Release

need to know:

  • the SFU release date (for the branch name)
  • the Instructure release (for the head)

process

  • get the pointer to the stable HEAD commit from git/refs/heads/stable (response.object.url)
  • get the commit from above and check the message (contains treesame commit of origin/stable/INSTRUCTURE_RELEASE_DATE)
  • if not, error out; otherwise…
  • create new branches in the SFU repos (SFU_RELEASE_DATE-RANDOM_WORDS): PATCH https://api.github.com/repos/sfu/:repo/git/refs
    • PATCH body:
    {  
      "ref": "refs/heads/2016-02-02-shining-unicorn",
      "sha": "SHA OF WHATEVER WE'RE BRANCHING OFF"
    }
    
  • create pull request in SFU repo to pull in the desired instructure release commit:
POST https://api.github.com/repos/sfu/canvas-lms/pulls
  {  
    "title": "Cut 2016-02-02-shining-unicorn release",
    "body": "Integrate instructure/canvas-lms:2016-01-09 release (da056a) and SFU modifications",
    "head": "instructure:da056acce693de6c0e8bc5feada7a414818ea1ed",
    "base": "refs/heads/2016-02-02-shining-unicorn"
  }
  • if PR creation succeeds, check the mergability by getting the PR (GET https://api.github.com/repos/sfu/canvas-lms/pull/:number) and checking the mergeable property.
    • if null, hasn't been computed yet; try again later
    • if true, :thumbs-up:
    • if false, we likely have a conflict. a person will need to checkout the PR, fix the conflicts, and re-push back up.
  • if the PR is mergable, merge the PR (PUT /repos/:owner/:repo/pulls/:number/merge)
  • if the merge succeded (check the merged property in the response), then kick off a deploy to canvas-edge

https://github.com/pksunkara/octonode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment