Programmatically create a container with Drush

Created on 24 April 2023, over 1 year ago
Updated 29 March 2024, 8 months ago

Problem/Motivation

As a devops practitioner needing to provision many Drupal sites, I want to be able to programmatically create a Google Tag Manager container, so that I can scale my operations.

Proposed resolution

Add a drush command that provides a method for creating a Google Tag Manager container with default settings, the label and GTM ID passed as parameters.

✨ Feature request
Status

RTBC

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mark_fullmer
  • Status changed to Needs review over 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7 updated deps
    last update over 1 year ago
    1 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    54 pass
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    Two patches are attached, one for 2.0.x and one for 8.x-1.x.

    The approach here is to provide an MVP, where the drush command simply uses the settings defaults and adds a GTM ID.

    Subsequent work could be done to provide more parameters in the drush command.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    For 2.x at least, all validation is skipped, so this patch should at least ensure the same validation we use in the form applies to the command.

  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    54 pass
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    this patch should at least ensure the same validation we use in the form applies to the command.

    Good call. The attached patch adds validation using the existing pattern from TagContainer::GOOGLE_TAG_MATCH in the Drush command.

  • Status changed to RTBC 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mmarler

    I was able to successfully create containers with drush. Validation checks out as well. Moving to RTBC.

Production build 0.71.5 2024