generator-chisel icon indicating copy to clipboard operation
generator-chisel copied to clipboard

Add Pantheon integration

Open jakub300 opened this issue 8 years ago • 1 comments

Hey, I'd like to document proposed integration with Pantheon

Specification

Custom Upstream

Pantheon's WordPress upstream is not compatible with with Nested Docroot (Pantheon's feature allowing serving files from subdirectory). To offer ability to update WP via Pantheon Dashboard we need to create Custom Upstream that contains WP in subdirectory. We could also add Quicksilver hook for triggering CI pushback builds (see CI Magic) in our upstream.

Project generation

During Project generation Chisel should ask if project is expected to be hosted on Pantheon. If so it should verify if build is run in the repository that is clone of our Custom Upstream. During generation process Chisel should be aware that directory with WP is called web, not wp. Chisel should also add basic CI configuration (.gitlab-ci.yml).

CI Magic

Here are things CI should do:

  • Standard - runs after every commit to the base repository (in our case GitLab), builds project and pushes it to Pantheon.
  • Pushback - when Client changes code on Pantheon side (for example Plugin install, Wordpress update) and commits it via Pantheon Dashboard CI run is triggered by Quicksliver hook when code is pushed to Pantheon (sync_code) (TODO: should be only when code is committed via Dashboard, not when pushed from CI). This script should ensure that repositories are consistent.

Implemented flow:

  1. Find commit where base branch and Pantheon joins
  2. Verify that all commits on Pantheon on top of that commit are builds (realistically there should be always one build commit on top of "join" commit)
    • It they are: reset Pantheon to base repository (the same as removing commit with build and then fast forward merge)
    • If they are not:
      1. Replay commits from Pantheon repository in our repository
        • ignores build commit(s)
        • single commits should be cherry picked
        • merge commits (Wordpress updates) should be created as on Pantheon
      2. Reset Pantheon to our updated code
      3. Push to our repository
  3. Run build
  4. Commit dist inside theme
  5. Push to Pantheon

Multidev

TBD

Implementation

Links

chisel-pantheon-magic - node app that does the magic in CI. chisel-pantheon-docker - docker image that contains chisel-pantheon-magic installed. (Magic requires nodegit that must be compiled and it takes about 10 minutes so I decided to create custom docker image). Job #21500546 - 🍾 First successful automated push from GitLab CI to Pantheon 🍾 .

Status

  • Custom Upstream - not started
  • Project generation (Chisel integration) - not started
  • CI Magic: Standard - repository, commit shuffling implemented, doesn't do actual builds with Chisel.
  • CI Magic: Pushback - partially implemented, no triggering configuration or scripts implemented.

jakub300 avatar Jul 07 '17 13:07 jakub300

Hey, after @arturkot comment on slack I looked more into it and was able to merge both tasks and automatically detect when pushback is necessary.

jakub300 avatar Jul 17 '17 13:07 jakub300