CONTINUES INTEGRATION AND HOW TO WORK WITH BIG TEAMS
About Me
- Jason Acuña
- Common Media
- Comunidad Drupal y Wordpress CR.
- @tatewaky
- f/tatewaky
- https://commonmedia.com/
Glossary
CONTAINERS
HUB CONTAINERS
DEPENDENCIES
WPACKAGIST
How to use it?
- make sure the file composer.json exists on your repo.
- Add your plugins or themes using one of the prefix : wpackagist-plugin o wpackagist-theme for the name of the vendor.
- Packages will be installed on wp-content/plugins/ or wp-content/themes/
Files basic structure
Basic Repository
LOCAL SETUP
Adding Plugins
Only commit composer files
Custom Code
Text
Text
Text
Make sure you added to the .gitignore
Pantheon
- Hosting
- Multi dev.
- Controlled Deployment
- Redis.
- Upstreams.
- Backups.
- Safe money on devops.
Pantheon Multidev
Terminus
- Enviroments control
- Wordpress CLI.
- Backups.
PIPELINES
- Yml file
- Variables.
- Branches.
- Workflow.
PIPELINES KEY
PIPELINES KEY
PIPELINES VARIABLES
PIPELINES CONFIG
image: quay.io/pantheon-public/build-tools-ci:6.x
pipelines:
branches:
'{master,staging,ci-*}':
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install --no-ansi --no-interaction --optimize-autoloader --no-progress
- CI_BRANCH=$BITBUCKET_BRANCH CI_BUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
- source ~/.bashrc && composer -n install
- terminus -n auth:login --machine-token="$TERMINUS_TOKEN"
- source ~/.bashrc &&./.ci/deploy/dev-multidev
BASH FILE
#!/bin/bash
# Authenticate with Terminus
terminus -n auth:login --machine-token="$TERMINUS_TOKEN"
# Prepare for Pantheon
composer run prepare-for-pantheon
if [[ $CI_BRANCH != $DEFAULT_BRANCH ]]
then
# Push to the dev environment
terminus -n build:env:push "$TERMINUS_SITE.dev" --yes
fi
# Run update-db to ensure that the cloned database is updated for the new code.
terminus -n wp $TERMINUS_SITE.$TERMINUS_ENV -- core update-db
# Clear the site environment's cache
terminus -n env:clear-cache "$TERMINUS_SITE.$TERMINUS_ENV"
# Ensure secrets are set
terminus -n secrets:set "$TERMINUS_SITE.$TERMINUS_ENV" token "$GITHUB_TOKEN" --file='github-secrets.json' --clear --skip-if-empty
# Delete old multidev environments associated
# with a PR that has been merged or closed.
terminus -n build:env:delete:ci $TERMINUS_SITE --keep=3 --yes
PIPELINE PROCESS
Steps and parallels
PIPELINE PANTHEON RELEASE
DATA DRIVEN TESTS
- Behat.
- MINK.
- Gherkin.
Requirements
- Add dependencies on composer.
- Make sure you get familiar with gherking
- Set it up locally using lando.
- Create the feature files.
Gherkin Example
Feature: Manage plugins
In order to manage plugins
As an admin
I need to enable and disable plugins
Background:
Given I have a vanilla wordpress installation
| name | email | username | password |
| BDD WordPress | your@email.com | admin | test |
And I am logged in as "admin" with password "test"
Scenario: Enable the dolly plugin
Given there are plugins
| plugin | status |
| hello.php | enabled |
When I go to "/wp-admin/"
Then I should see a "#dolly" element
Scenario: Disable the dolly plugin
Given there are plugins
| plugin | status |
| hello.php | disabled |
When I go to "/wp-admin/"
Then I should not see a "#dolly" element
OTHER ITEMS
WHY?
- Reduce the human error.
- Improve the code control.
- The flow on big teams is a lot better.
- Make Easier to handle unexpected situations.
References
- Repository: https://bitbucket.org/tatewaky/wp-pipeline
THANKS
WordCamp San Antonio TX 2020
By Jason Acuna
WordCamp San Antonio TX 2020
How to work with big teams on a well controlled environment
- 706