xfiveco / generator-chisel

Chisel is a development framework for creating easy to maintain and fast WordPress websites.
https://www.getchisel.co
MIT License
270 stars 37 forks source link

Add Pantheon integration #208

Open jakub300 opened 7 years ago

jakub300 commented 7 years ago

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:

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

jakub300 commented 7 years ago

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.