Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Auto-update of guides_style_18f gem #21

Open
@mbland

Description

After the refactoring I'm about to do to support #20, I'll be able to add the ability to auto-update the guides_style_18f gems, or any arbitrary theme package. Initial thoughts on how I'm thinking it'll come together:

  • New configuration variables:
    • defaultThemeUpdater object with repoName, updateCommand, waitDelay, and maxRetries for the top-level config
      • The delay is necessary because release tags are often pushed before their corresponding packages, but should be something reasonably small, like 10000ms
      • the default command should be bundle update --source guides_style_18f && bundle install in our case
    • optional themeUpdater object for specific builders with repo and updateCommand properties
  • On startup, scan every repo for .18f.pages.yml files and find any theme_repo: and theme_update: properties
    • Skip any repo with an auto_update_theme: false property
  • Create a ThemeUpdater class, which will:
    • take this list and create a mapping from theme repo names to repoName, updateCommand arrays
    • Use GitHub's PubSubHubBub API to subscribe to create events from all theme repos, so new releases can be identified by new tags
    • Update the mapping every time a site is rebuilt, as part of .18f-pages.yml processing
  • When a theme update event comes in, the ThemeUpdater will:
    • wait for waitDelay milliseconds
    • launch the following operations for each repository in parallel, up to maxRetries times each:
      • grab the update lock (already implemented in SiteBuilder using file-locked-operation)
      • run the theme update command; if successful, rebuild the site
        • if unsuccessful, log the error, increment the retry count, wait and try again
      • if the rebuild is successful, do a git add && git commit -m 'Updated theme to <TAG-NAME> && git push
        • if the rebuild isn't successful, log the event and remove the repo from the ThemeUpdater mapping, as this may signal an incompatible update

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions