Digital Team
About UsEdit in Gitbook
  • Welcome
  • Getting started
    • Life on the Digital team
      • Meetings
      • Communication
      • Software engineering working agreement
    • Contributing to Boston.gov
    • Using GitBook
  • Standards & best practices
    • Digital Team Release Notes
    • Working with Partners
    • Accessibility at COB
      • Developers
      • Content Editors
        • How to guide
      • Resources
      • Working with Iterators
    • Analytics and Metrics
    • Code of Conduct
    • General
    • Code reviews
    • Project Management
    • Git / GitHub
      • Contacts at Github
      • Git Command Tips
      • GitHub Service Accounts
    • Code quality
      • Automated tests & static analysis
      • Code comments
      • Style guides
        • Drupal/PHP
          • D8 Dependency Injection (DI)
        • React/TypeScript
    • Technical documentation
    • Hosting and monitoring
    • Deployment
  • Guides
    • Technology stack and technologies used
      • Web applications
    • Drupal - boston.gov
      • Custom Development & Configuration
        • On Demand Instances
          • Acquia Environment setup checklist
        • Continuous Deployment Process
        • Developer Onboarding
          • Step 1: Local Dev Environments
          • Step 2: Version control
          • Step 3: Introduction to Drupal
          • (to be sorted)
            • Development environment
              • PHP CodeSniffer
              • VSCode IDE Setup
              • AWS for Developers
              • Using Windows
            • Installation instructions
              • Typical build output
              • Lando 101
              • Verify Installation
                • Local Patterns installation
              • Windows install
              • PhpStorm settings configurations
          • Step 4: Site Building in Drupal 8
        • Site Development Notes
          • Git Best Practices - Drupal
          • Drupal Cache
          • Drupal Config
          • Custom Modules
            • Custom Themes
              • Front-end Theme (bos_theme)
                • Site Breadcrumbs
              • Back-end Theme (bos_admin)
            • Adding Templates to Custom Modules
            • Custom Content Types
              • D7 -> D8 Conversion
              • Content Editor UX
                • Content Moderation
              • In-page Navigation Menu
            • Custom Paragraphs
              • D7 -> D8 Conversion
            • Custom Taxonomies
            • WebApps
          • Drupal UX-specific
            • Image Styles & UX
            • Example Content Pages
          • PHPStorm IDE
        • CKEditor
      • Drupal Apps/Content Types
        • Budget Website
        • Building Housing
          • BH Drupal Entities
          • BH Map Webpage
          • BH Property Webpage
            • BH Project Timeline
          • BH Salesforce Sync
            • Salesforce Contributed Module
        • Contact Form
        • Election results
        • Google reCAPTCHA
        • My Neighborhood Lookup
        • Metrolist
        • Metrolist (Drupal)
        • Project Tracker
          • Content Types (& Paragraphs)
          • Taxonomies
          • Views
          • Developer Notes
      • Drupal Features & Components
        • Single Sign On (SSO)
          • Drupal SAML Knowledgebase
          • SamlAuth
        • Maps on boston.gov
        • Charts on boston.gov
          • Quick Overview
          • Chart Data
          • Chart Configuration
          • Advanced Concepts and Techniques
          • Charts on boston.gov (legacy)
          • Useful Resources
      • Drupal micro-services (API end-points)
        • Integrating with Boston.gov
        • Assessing Forms Endpoint
        • Bos311 API
        • Cityscore
          • Knowledge Base
        • PDF Manager Module
        • PostMark Email Services
          • Postmark Knowledgebase
        • Upaknee Email List Services
        • Public Notices
        • Site Alerts
          • CodeRed Subscription
      • Drupal - Weekly Maintenance
      • Drupal - Periodic Maintenance
    • Digital Webapps
      • Libraries and Tools
        • Emotion
        • Storybook
        • Rollbar
      • Services
        • AWS-hosted Microservices
          • SQL Proxy API (DBConnector)
            • Developer Notes
          • PDFToolkit API (DB Connector)
            • Developer Notes
      • Webapps - Maintenance
      • Webapps
        • Boston Family Days
        • Property Tax Calculator
        • Access-Boston
          • Updating IAMDIR/Group Management/LDAP certificates
          • Node Server
          • Portal App Tile Configurations
          • Ownership of Concerns
          • Updating SAML Certificates
          • Applications/Services
            • Group Management
            • Confirm ID/ID Verification
            • Preferred Name
        • Sanitation Scheduling
        • Registry-Certs
          • Marriage Intention
      • DevOps
        • New service setup
          • Non-Monorepo Service Setup
        • Service Configuration
          • Editing a project’s configuration using Cyberduck
        • Managing AWS
          • Production Overview
          • AWS Bastion Access
          • Terraform
            • Updating the ECS cluster AMI
          • Restarting an ECS service
          • Encrypting service configuration for S3
          • Mounting AWS SFTP as a Drive (Mac)
        • Webapp Deployment
          • Deploy to AWS 2021
            • Deploy Tool (cob_ecrDeploy)
    • Fleet - Pattern Library
      • Patterns Library Architecture
      • Icon Library Architecture
      • Developers
        • Local Development for Drupal Developers
      • Patterns Library Maintenance
    • Legacy Website - cityofboston.gov
      • Animal Control
        • Dog Licenses
      • No Tow
        • Street Sweeping Reminders
        • Street Occupancy Alerts
        • Towing Alerts
        • Towing Search
        • Subscription Search
        • Proposed Restructure
          • Backend
        • Reillys Notes
      • Workers' Compensation Inquiry Form
      • Streetbook
      • Legacy Website - Maintenance
        • Animal Control Maintenance
        • Assessing Online (AOL) Maintenance
          • Knowledge-base
          • Disclosure Period
          • Annual PDF Initialization
          • Database Tables
        • No-Tow Maintenance
    • AgilePoint
      • AgilePoint: Adding Users
      • Migrating AGP Applications from one platform to another
    • The Hub - hub.boston.gov
      • The Hub - Maintenance
    • Maintenance
      • Updating SSL Certificates
    • Redirects
      • Redirecting from cityofboston.gov
      • URL redirects versus URL aliases - Drupal
      • DNS Redirects
    • Decommissioned Apps or Services
      • Archived Forms Information
      • CodeRed
      • Drupal 7
        • Deployment (2019)
          • Why do we peer-review pull-requests ?
      • Rentsmart
      • SnowStats
      • Ruby
    • Weglot translation
      • What to do in Weglot
      • What to do on the website or page
        • Softr
        • Drupal Powered Pages
        • Custom Pages
  • Projects
    • Project: Patterns Library Cleanup
      • Project: Refactoring Legacy CSS
        • Strategy
        • Regression Testing
        • Maintenance
    • Project: Upaknee
    • Project: Everbridge API + UI
    • Project: 311 CRM Upgrade
      • Project: City Worker Upgrade to City Worker 5
      • Project: Lagan 311 CRM upgrade to 15r4
    • Project: Fleet (Pattern Library Design System)
    • Project: Monorepo Decoupling
    • Inactive projects
      • Project: 311 (Salesforce Upgrade)
      • Project: Access Boston
        • General/Historical Documentation
          • Edit Config and Upload Icons
        • Processes
          • Process: Adding New Icon to Access Boston Website
          • Process: Non-icon Access Boston Feature or Bug Requests
          • Self-Service
      • Project: Alexa Skill
      • Project: Assessing Online
        • 2022 Notes
      • Project: Boards and commissions
      • Project: City Hall Appointment Scheduler
      • Project: CityScore
      • Project: Mobile Apps
      • Project: Permit Finder
      • Project: Public Notice Signage
      • Project: Registry Suite
        • Birth certificates
        • Marriage Certificates
        • Marriage Intention
        • Death Certificates
      • Project: Work With U.S. Digital Response Team
      • Project: TDM Points App
      • Project: Translation on boston.gov
  • External resources
    • Learning resources
    • Reference links
    • Applications and extensions
Powered by GitBook
On this page
  • Boston.gov-d8 Repo Branching
  • Normal Deployment Pipeline
  • On-Demand Pipeline
  • Branch Diagram
  • Useful Links

Was this helpful?

Export as PDF
  1. Guides
  2. Drupal - boston.gov
  3. Custom Development & Configuration
  4. Site Development Notes

Git Best Practices - Drupal

PreviousSite Development NotesNextDrupal Cache

Last updated 3 years ago

Was this helpful?

Boston.gov-d8 Repo Branching

City of Boston use Acquia to host our Drupal website.

Acquia provide a number of different environments for COB to use. One of those environments is production the others are non-production - named: stage, dev, uat, ci & dev2.

Detail on deployment is covered , but in summary we are able to "bind" certain branches of our GitHub repo () to these Acquia environments, and when changes occur in those branches, a deployment is automatically triggered.

Therefore, the way we branch-off, push-to and merge the "bound" branches is important.

Normal Deployment Pipeline

The develop branch is bound to the Acquia dev environment, and the master branch to the stage environment. Changes cannot be made directly onto the masterbranch, and changes should not be made directly onto the developbranch - except when hotfixes are needed.

  • Best Practice is to create a working branch off develop , then check out that working branch locally.

  • Updated code should be committed to the locally checked out copy of the working branch

    • Updating the local working branch will update the local containerized website for testing.

  • Periodically, the local working branch should be pushed to the remote working branch in GitHub.

    • Updating the working branch in GitHub will not trigger any deploys or update any website.

  • To start the deploy to the dev environment, a PR is created in GitHub to merge the working branch in GitHub into the develop branch in GitHub.

    • Merging will trigger a build and the website on the dev environment will be updated.

  • When ready to deploy to the stage environment, a PR is created in GitHub to merge the develop into the master branch in GitHub.

    • Merging will trigger a build and the website on the stage environment will be updated.

  • To deploy to the production environment, use the Acquia Cloud UI - see notes.

On-Demand Pipeline

We can bind a branch to the dev2, ci or uat environments so that we can share proposed or interim website changes with stakeholders or other individuals where a local containerized website is not appropriate. These environments can be considered on-demand, and the way to update them is similar but slightly to the normal deploy piepline, requiring an extra branch.

  • Initially, an environment branch is created from the developbranch.

    • This environment branch is then bound to the desired Acquia environment (dev2, ci or uat).

  • Developers then create a working branch off the environment branch and check out that working branchlocally.

  • Developers commit their work to the local copy of the working branch which can be pushed to the remote working branch in GitHub whenever desired.

    • Updating the local working branch will update the local containerized website for testing.

    • Updating the working branch in GitHub will not trigger any deploys or update any website.

  • When ready to update the website on the bound environment, using a PR, the GitHub copy of the working branch is merged to the environment branch in GitHub.

    • Merging will trigger a deploy to the bound Acquia environment (i.e. dev2, uat or ci) and update the website on that environment.

    • Stakeholders can be directed to the website on the Acquia environment.

  • Once the project or piece of work is complete, a PR to merge the GitHubenvironment branch to the develop branch is created.

    • Merging will trigger a deploy to dev and update the website.

  • To continue to deploy to stage and production environments, follow the notes in Normal Deploy Pipeline above.

Branch Diagram

Sometimes a picture is worth 1,000 words.

In the above diagram,

  • Lines with an arrow indicate a merge to the branch in the direction of the arrow.

  • Lines with a dot connector indicate the creation (or updating) of a branch - and when the line is to a local branch it is a checkout to a local branch.

  • The master branch is the production branch and cannot be pushed/merged to directly.

    • The correct way to update master is to merge the developbranch into the master branch.

  • Green arrows cause a deployment process:

    • Only if the branch being merged into is bound to an Acquia environment, and

    • This is controlled/executed by Travis, taking approx 3 mins (uses 30 Travis credits), and

    • The website hosted on the Acquia Environment is updated during the deploy.

  • Orange arrows cause a build, test and deployment process:

    • Only if the branch being merged into is bound to an Acquia environment, and

    • This is controlled/executed by Travis, taking approx 30 mins (uses 300 Travis credits), and

    • The website hosted on the Acquia Environment is updated during the deploy.

      • Travis is configured so that this is extended process usually only runs when committing to the develop branch - triggering a deploy to the Acquia Dev environment as the first step of the deployment pipeline.

  • Black arrows indicate a simple commit/merge process with no building or deploying:

    • Best practice reuquires that a working branch is not bound to Acquia Environments

    • Merging does not trigger Travis, there is no deploy and 0 Travis credits are used

  • Note: A GitHub environment branch can be bound to one or more Acquia Environments. When this is the case, deploys will occur simultaeously to all bound environments when the GitHub environment branch is updated.

    • Travis always controls deploys, but only one set of credits is used per environment branch merge regardless of how many Acquia environments it is bound to.

Useful Links

Branches attached to environments other than dev, stage and production in Acquia are termed environment branches (see also ).

At all times the master branch should be a copy of the code on the production environment. (see )

On-Demand Instances
Continuous Deployment Process
Git / GitHub
On Demand Instances
elsewhere
CityofBoston/boston.gov-d8
Example Git Branch Usage
continuous deployment
continuous deployment