SlideShare a Scribd company logo
1 of 53
Download to read offline
Practical DevOps
Greg Anderson
Automate Your Automation
2
Greg Anderson
Platform + Open Source Engineer
Contributor to several popular OSS Projects:
● Drush
● Robo
● Consolidation Tool
● CGR
greg_1_anderson
Automation
Planning
● Identify something to Automate
● Make it good
● Survey available tools
● Automate!
● Repeat
●
3
What Can Be
Automated?
● Development tasks
● Testing
● Deployment
● Maintenance (updates)
4
Investment and
Benefit
● More reliable and repeatable
● Easier to bring on new people
● Improvements compound
● It becomes possible to do more
5
https://xkcd.com/1205/
Cost of Not
Automating
● Prone to errors and mistake
● Risk of lost knowledge
● Deferred maintenance piles up
● Discouragement
6
Extra Art
7
Tools of the Trade
Service APIs
● Create pull requests
● Post comments
● Configure test credentials
● Web hooks
8
Create Pull
Requests
1. Push branch to GitHub
2. Create the PR
○ Use hub tool
○ Use REST API
●
9
10
Push Branch to GitHub
Pushing to a remote, and authenticated via ssh (e.g. from command line):
$ git push -u origin my-pr-branch
From a script with no remote set, and using an OAuth token:
$ push https://$GITHUB_TOKEN:x-oauth-basic@github.com/repo.git master
Install and Use hub CLI Tool
11
Create a pull request:
$ hub pull-request -m "This is my awesome pull request."
MacOS
brew install hub choco install hub sudo apt-get install git-hub
https://github.com/github/hub
Call GitHub REST API with Guzzle
12
function gitHubAPI($uri, $token, $data = [], $method = 'GET')
{
$url = "https://api.github.com/$uri";
$headers = [
'Content-Type' => 'application/json',
'User-Agent' => 'my-org/my-app',
$headers['Authorization'] = "token " . $token();;
}
$guzzleParams = [ 'headers' => $headers, ];
if (!empty($data)) {
$method = 'POST';
$guzzleParams['json'] = $data;
}
$client = new GuzzleHttpClient();
$res = $client->request($method, $url, $guzzleParams);
$resultData = json_decode($res->getBody(), true);
$httpCode = $res->getStatusCode();
}
Create Pull Request via REST API
13
https://developer.github.com/v3/pulls/#create-a-pull-request
gitHubAPI(
"/repos/$org/$repo/pulls",
$token,
[
"Title" => "Amazing new feature",
"Body" => "Please pull this in!",
"Head" => "$forkedRepo:new-feature",
"Base" => "master"
],
'POST'
);
Post Comments
on Pull Requests
The hub tool does not support
comments*
, but the REST API is
still available.
14
* Help improve hub! https://github.com/github/hub/pull/1465
Are you
sure this
will fly? Make sure the
mock tests are
passing before
the demo.
Has someone
volunteered to
do the cliff
jump demo?
Add a Comment via REST API
15
https://developer.github.com/v3/issues/comments/#create-a-comment
gitHubAPI(
"/repos/$org/$repo/commits/$sha/comments",
$token,
[
"Body" => "Me too",
],
'POST'
);
Configure Test
Credentials
● Circle CI
○ REST API
● Travis CI
○ CLI Tool
○ REST API
16
17
Circle CI REST API
curl
-X POST
--header "Content-Type: application/json"
-d '{"name":"foo", "value":"bar"}'
https://circleci.com/api/v1.1/project/github/$user/$proj/envvar?circle-token=$t
Obtain an OAuth token for circle-token at https://circleci.com/account/api.
Important note: Circle uses github in its API URLs, even though it shortens this
to gh in all of the URLs in its web application.
https://circleci.com/docs/2.0/env-vars/#injecting-environment-variables-with-the-api
Travis CI CLI Tool
18
Set environment variables via env command:
$ travis env set GITHUB_TOKEN $GITHUB_TOKEN
For web API, see https://docs.travis-ci.com/api/#settings:-environment-variables
https://github.com/travis-ci/travis.rb#env
MacOS
brew install travis Use the RubyInstaller sudo apt-get install ruby1.9.1-dev
Spinning Up New
Projects
● Composer create-project
● Post-create project scripts
19
20
Composer create-project
● Copies and renames a repository and orphans / detatches the result.
● Updates from the source may still be pulled by adding a second remote:
○ git remote add upstream git@github.com :parent-org/parent-project.git
○ git pull upstream master
● Usually, parent is treated as a template project, and updates are not pulled.
● Things that will evolve over time are placed in dependencies.
● Dependencies are updated via composer update, as usual.
https://github.com/drupal-composer/rupal-project
Post create-project scripts
21
● Composer will run user-specified scripts after commands (e.g. install, update)
● This is used in drupal-composer/drupal-scaffold to download addition files.
● This allows files that cannot be stored in a dependency to be managed
independently from the template repository.
https://getcomposer.org/doc/articles/scripts.md
Extra Art
22
Testing Practices
Write Testable
Code
● Pass values to functions
● Return values from functions
23
Functional Testing
● Uses a working system to test
● Usually easy to write tests
● Sometimes hard to maintain
(false failures creep in)
● Takes longer to run
24
Mocks
● Replaces an actual system
● Useful for providing values
● Can also collect results
● Sometimes hard to maintain
(false passes can creep in)
● Best to avoid testing
implementation, e.g.
confirming order of API calls
25
Leveraging
Docker
● Circle CI 2.0 or Travis
● Maintain custom images
● Store system scripts in image
● Automatically rebuild your
docker image whenever its
source repository changes.
26
Parallelism in Circle 2.0
27
https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
defaults: &defaults
docker:
- image: quay.io/pantheon-public/build-tools-ci:1.x
working_directory: ~/example_drops_8_composer
environment:
ADMIN_USERNAME: admin
version: 2
jobs:
build:
<<: *defaults
steps:
- checkout
- run:
name: environment
command: /build-tools-ci/scripts/set-environment
Create Custom Docker Image
28
DockerFile URL
# Use an official Python runtime as a parent image
FROM drupaldocker/php:7.1-cli
# Set the working directory to /build-tools-ci
WORKDIR /build-tools-ci
# Copy the current directory into the container at /build-tools-ci
ADD . /build-tools-ci
# Collect the components we need for this image
RUN apt-get update
RUN composer -n global require -n "hirak/prestissimo:^0.3"
RUN mkdir -p /usr/local/share/drush
RUN /usr/bin/env COMPOSER_BIN_DIR=/usr/local/bin composer -n
--working-dir=/usr/local/share/drush require drush/drush "^8"
Automate with Quay and GitHub
29
Generating Tests
using an IDE
30
Example: PHPStorm
31
https://confluence.jetbrains.com/display/PhpStorm/Creating+PHPUnit+Tests+in+PhpStorm
Extra Art
32
Deployment
Automating
Releases
● Travis release steps
● Self Updates
33
Automate setting up releases
34
Use the travis tool to automatically edit .travis.yml to include a release section:
$ travis setup releases --token=$GITHUB_TOKEN
Detected repository as org/my-tool, is this correct? |yes|
Username: greg-1-anderson
Password for greg-1-anderson: *************
Two-factor authentication code for greg-1-anderson:[REDACTED]
File to Upload: my-tool.phar
Deploy only from org/my-tool? |yes|
Encrypt API key? |yes|
If a token is provided, then the credentials prompt will be omitted.
35
Self-Updating Phars
Robo PHP Task
Runner
Robo as a framework: https://robo.li/framework
Instructions on using Robo to create a standalone phar; adds
self:update command automatically.
$commandClasses = [ MyProjectCommandsRoboFile::class ];
$statusCode = RoboRobo::run(
$_SERVER['argv'],
$commandClasses,
'MyAppName',
'0.0.0-alpha0',
$output,
'my-org/my-project'
);
exit($statusCode);
Extra Art
36
Maintenance Tasks
Automating
Composer Update
● Schedule via Travis cron
● Composer Lock Updater
● Auto-merge after tests pass
37
38
Automated Dependency Update Process
Travis
Cron
Composer
Lock Update
GitHub
Pull Request
Travis
Test Run
Merge
Pull Request
Exec hub REST REST
[1] [2]
1. Pull request is only created if there are updates available.
2. Pull request is only merged if the test passes.
39
Set Up Travis CI Cron
Once configured, Travis schedules job to start right away:
40
Add GitHub Token to Travis Settings
From https://github.com/settings/tokens:
Circle CI REST API URL
41
Specify Scopes
Circle CI REST API URL
42
Add GitHub Token to Travis Settings
$ travis env set GITHUB_TOKEN "[PASTE VALUE FROM GITHUB]"
Circle CI REST API URL
43
Prevent Redundant Execution
If doing highest / lowest testing with a matrix configuration entry, define an
environment variable to control which Travis run will do the post-build actions:
matrix:
include:
- php: 7.1
env: dependencies=highest
env: DO_POST_BUILD_ACTIONS=1
- php: 7.0.11
- php: 5.6
- php: 5.5
env: dependencies=lowest
44
Only Update Dependencies in Cron
after_success:
- travis_retry php vendor/bin/coveralls -v
- |
if [ -z "$DO_POST_BUILD_ACTIONS" ] ; then
return
fi
if [ "$TRAVIS_EVENT_TYPE" != "cron" ] ; then
echo "Not a cron job; exiting."
return
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo "No GITHUB_TOKEN defined; exiting."
return
fi
# … execution continues below
45
Install and Run Composer Lock Updater
# … execution continues here from "after_success:" example
export PATH="$HOME/.composer/vendor/bin:$PATH"
composer global require danielbachhuber/composer-lock-updater
mkdir -p $HOME/bin
wget -O $HOME/bin/security-checker.phar [URL]
chmod +x $HOME/bin/security-checker.phar
export PATH="$HOME/bin:$PATH"
wget -O hub.tgz [URL]
tar -zxvf hub.tgz
export PATH=$PATH:$PWD/hub-linux-amd64-2.2.9/bin/
clu
For [URL], see full instructions in: https://github.com/danielbachhuber/composer-lock-updater
46
Maintain Compatibility in composer.lock
The versions of dependencies returned for a given run of composer update
may vary depending on what version of php you are running. For example, a lock
file built with php 7.1 may include dependencies that do not work with php 5.6.
Fix this with a "platform": "php" entry:
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"platform": {
"php": "5.6"
}
},
47
Update Details in Commit Comment
PR is attributed to user who provided GitHub token.
Comment lists dependencies that were updated.
Security report included to bring attention to vulnerabilities.
Commit itself is authored by composer-lock-updateuser.
48
Automatic Merge after Tests Pass
remote=$(git config --get remote.origin.url)
git remote set-url origin "${remote/github.com/$GITHUB_TOKEN:x-oauth-basic@github.com}"
if [ -n "$TRAVIS_COMMIT_RANGE" ] && [ "master" == "$TRAVIS_BRANCH" ]; then
changed_files=$(git diff --name-status "$TRAVIS_COMMIT_RANGE" | tr 't' ' ')
if [[ "$changed_files" == "M composer.lock" ]] ; then
(
echo "Only composer.lock was modified: auto-merging to $TRAVIS_BRANCH in $remote."
git reset "$TRAVIS_BRANCH"
git stash
git checkout "$TRAVIS_BRANCH"
git stash pop
git add composer.lock
git commit -m "Auto-update dependencies."
git push origin "$TRAVIS_BRANCH"
) 2>&1 | sed -e "s/$GITHUB_TOKEN/REDACTED/g"
else
echo "Not auto-merging, because multiple files were changed"
fi
fi
Automate the
automation of your
automation
Run a command to
automatically configure Travis to
automate the updating of your
project’s composer.lock file.
49
50
The ci travis:clu Command
● Install ci.phar.
● Change your working directory to your PHP project.
● Define $GITHUB_TOKEN
● Run ci travis:clu
● Inspect the changes. Push them up to GitHub.
● Turn on cron in the Travis admin interface
● Be amazed.
Extra Art
51
Finished! Not Finished!
JOIN US FOR
CONTRIBUTION SPRINT
Friday, 29 September, 2017
First time
Sprinter Workshop
Mentored
Core Sprint General Sprint
9:00-12:00
Room: Lehar 1 - Lehar 2
9:00-18:00
Room: Stolz 2
9:00-18:00
Room: Mall
#drupalsprints
WHAT DID YOU THINK?
Locate this session at the DrupalCon Vienna website:
http://vienna2017.drupal.org/schedule
Take the survey!
https://www.surveymonkey.com/r/drupalconvienna

More Related Content

What's hot

Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabSoftware Guru
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceBo-Yi Wu
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradleLiviu Tudor
 
Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++Daniele Pallastrelli
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovskyphp-user-group-minsk
 
DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)Francesco Fiore
 
Brief intro to K8s controller and operator
Brief intro to K8s controller and operator Brief intro to K8s controller and operator
Brief intro to K8s controller and operator Shang Xiang Fan
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous IntegrationBo-Yi Wu
 
今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_kToshiaki Maki
 
Introduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷JavaIntroduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷JavaToshiaki Maki
 
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Jorge Morales
 
Virtual CD4PE Workshop
Virtual CD4PE WorkshopVirtual CD4PE Workshop
Virtual CD4PE WorkshopPuppet
 
Test your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementTest your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementBaiju Muthukadan
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRobert Bohne
 
Spring Boot 1.3 News #渋谷Java
Spring Boot 1.3 News #渋谷JavaSpring Boot 1.3 News #渋谷Java
Spring Boot 1.3 News #渋谷JavaToshiaki Maki
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance testBryan Liu
 
Docker 導入:障礙與對策
Docker 導入:障礙與對策Docker 導入:障礙與對策
Docker 導入:障礙與對策William Yeh
 
Automate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOpsAutomate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOpsDaniel Oh
 
Improving code quality with continuous integration (PHPBenelux Conference 2011)
Improving code quality with continuous integration (PHPBenelux Conference 2011)Improving code quality with continuous integration (PHPBenelux Conference 2011)
Improving code quality with continuous integration (PHPBenelux Conference 2011)Martin de Keijzer
 

What's hot (20)

Instrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con GitlabInstrumentación de entrega continua con Gitlab
Instrumentación de entrega continua con Gitlab
 
Introduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript ConferenceIntroduction to Grunt.js on Taiwan JavaScript Conference
Introduction to Grunt.js on Taiwan JavaScript Conference
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++Going native with less coupling: Dependency Injection in C++
Going native with less coupling: Dependency Injection in C++
 
Symfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim RomanovskySymfony Under Control by Maxim Romanovsky
Symfony Under Control by Maxim Romanovsky
 
DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)DevOps of Python applications using OpenShift (Italian version)
DevOps of Python applications using OpenShift (Italian version)
 
Brief intro to K8s controller and operator
Brief intro to K8s controller and operator Brief intro to K8s controller and operator
Brief intro to K8s controller and operator
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous Integration
 
今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k今すぐ始めるCloud Foundry #hackt #hackt_k
今すぐ始めるCloud Foundry #hackt #hackt_k
 
Introduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷JavaIntroduction to Concourse CI #渋谷Java
Introduction to Concourse CI #渋谷Java
 
C++ for the Web
C++ for the WebC++ for the Web
C++ for the Web
 
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
 
Virtual CD4PE Workshop
Virtual CD4PE WorkshopVirtual CD4PE Workshop
Virtual CD4PE Workshop
 
Test your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle ManagementTest your Kubernetes operator with Operator Lifecycle Management
Test your Kubernetes operator with Operator Lifecycle Management
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABC
 
Spring Boot 1.3 News #渋谷Java
Spring Boot 1.3 News #渋谷JavaSpring Boot 1.3 News #渋谷Java
Spring Boot 1.3 News #渋谷Java
 
Automated acceptance test
Automated acceptance testAutomated acceptance test
Automated acceptance test
 
Docker 導入:障礙與對策
Docker 導入:障礙與對策Docker 導入:障礙與對策
Docker 導入:障礙與對策
 
Automate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOpsAutomate App Container Delivery with CI/CD and DevOps
Automate App Container Delivery with CI/CD and DevOps
 
Improving code quality with continuous integration (PHPBenelux Conference 2011)
Improving code quality with continuous integration (PHPBenelux Conference 2011)Improving code quality with continuous integration (PHPBenelux Conference 2011)
Improving code quality with continuous integration (PHPBenelux Conference 2011)
 

Similar to Automate Your Automation | DrupalCon Vienna

Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with DockerNaoki AINOYA
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandTroublemaker Khunpech
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDAleksandr Maklakov
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containersinside-BigData.com
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupScaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupChris Shenton
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Annie Huang
 
Kubernetes best practices
Kubernetes best practicesKubernetes best practices
Kubernetes best practicesBill Liu
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIAndrey Karpov
 
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Evgeny Antyshev
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Microsoft
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017Patrick Chanezon
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Pantheon
 
betterCode Workshop: Effizientes DevOps-Tooling mit Go
betterCode Workshop:  Effizientes DevOps-Tooling mit GobetterCode Workshop:  Effizientes DevOps-Tooling mit Go
betterCode Workshop: Effizientes DevOps-Tooling mit GoQAware GmbH
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceDarnette A
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsAmazon Web Services
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.skJuraj Hantak
 
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMPInria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMPStéphanie Roger
 

Similar to Automate Your Automation | DrupalCon Vienna (20)

Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with Docker
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day ThailandCI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
 
HOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLDHOW TO DRONE.IO IN CI/CD WORLD
HOW TO DRONE.IO IN CI/CD WORLD
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington MeetupScaffolding for Serverless: lightning talk for AWS Arlington Meetup
Scaffolding for Serverless: lightning talk for AWS Arlington Meetup
 
Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD Webinar - Unbox GitLab CI/CD
Webinar - Unbox GitLab CI/CD
 
Kubernetes best practices
Kubernetes best practicesKubernetes best practices
Kubernetes best practices
 
PVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CIPVS-Studio in the Clouds: Travis CI
PVS-Studio in the Clouds: Travis CI
 
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
Openstack Third-Party CI and the review of a few Openstack Infrastructure pro...
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
What's New in Docker - February 2017
What's New in Docker - February 2017What's New in Docker - February 2017
What's New in Docker - February 2017
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
betterCode Workshop: Effizientes DevOps-Tooling mit Go
betterCode Workshop:  Effizientes DevOps-Tooling mit GobetterCode Workshop:  Effizientes DevOps-Tooling mit Go
betterCode Workshop: Effizientes DevOps-Tooling mit Go
 
Development Workflows on AWS
Development Workflows on AWSDevelopment Workflows on AWS
Development Workflows on AWS
 
Openshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhceOpenshift cheat rhce_r3v1 rhce
Openshift cheat rhce_r3v1 rhce
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMPInria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
Inria Tech Talk : Comment améliorer la qualité de vos logiciels avec STAMP
 

More from Pantheon

Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018Pantheon
 
Architecting Million Dollar Projects
Architecting Million Dollar ProjectsArchitecting Million Dollar Projects
Architecting Million Dollar ProjectsPantheon
 
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesStreamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesPantheon
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalPantheon
 
Defense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesDefense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesPantheon
 
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlySub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlyPantheon
 
Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Pantheon
 
Hacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductHacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductPantheon
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Pantheon
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesPantheon
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesPantheon
 
Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Pantheon
 
Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowPantheon
 
Test Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectTest Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectPantheon
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and PantheonPantheon
 
Why Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsWhy Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsPantheon
 
Drupal Performance
Drupal Performance Drupal Performance
Drupal Performance Pantheon
 
WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions Pantheon
 
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformanceLevel Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformancePantheon
 
Migrating NYSenate.gov
Migrating NYSenate.govMigrating NYSenate.gov
Migrating NYSenate.govPantheon
 

More from Pantheon (20)

Drupal Migrations in 2018
Drupal Migrations in 2018Drupal Migrations in 2018
Drupal Migrations in 2018
 
Architecting Million Dollar Projects
Architecting Million Dollar ProjectsArchitecting Million Dollar Projects
Architecting Million Dollar Projects
 
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight DeadlinesStreamlined Drupal 8: Site Building Strategies for Tight Deadlines
Streamlined Drupal 8: Site Building Strategies for Tight Deadlines
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Defense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 SitesDefense in Depth: Lessons Learned Securing 200,000 Sites
Defense in Depth: Lessons Learned Securing 200,000 Sites
 
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & FastlySub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
Sub-Second Pageloads: Beat the Speed of Light with Pantheon & Fastly
 
Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites Building a Network of 195 Drupal 8 Sites
Building a Network of 195 Drupal 8 Sites
 
Hacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A ProductHacking Your Agency Workflow: Treating Your Process Like A Product
Hacking Your Agency Workflow: Treating Your Process Like A Product
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use Cases
 
Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development Continuous Integration Is for Teams: Moving past buzzword driven development
Continuous Integration Is for Teams: Moving past buzzword driven development
 
Testing Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade WorkflowTesting Your Code as Part of an Industrial Grade Workflow
Testing Your Code as Part of an Industrial Grade Workflow
 
Test Coverage for Your WP REST API Project
Test Coverage for Your WP REST API ProjectTest Coverage for Your WP REST API Project
Test Coverage for Your WP REST API Project
 
Drupal 8 and Pantheon
Drupal 8 and PantheonDrupal 8 and Pantheon
Drupal 8 and Pantheon
 
Why Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your ClientsWhy Your Site is Slow: Performance Answers for Your Clients
Why Your Site is Slow: Performance Answers for Your Clients
 
Drupal Performance
Drupal Performance Drupal Performance
Drupal Performance
 
WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions WP or Drupal (or both): A Framework for Client CMS Decisions
WP or Drupal (or both): A Framework for Client CMS Decisions
 
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress PerformanceLevel Up: 5 Expert Tips for Optimizing WordPress Performance
Level Up: 5 Expert Tips for Optimizing WordPress Performance
 
Migrating NYSenate.gov
Migrating NYSenate.govMigrating NYSenate.gov
Migrating NYSenate.gov
 

Recently uploaded

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Automate Your Automation | DrupalCon Vienna

  • 2. 2 Greg Anderson Platform + Open Source Engineer Contributor to several popular OSS Projects: ● Drush ● Robo ● Consolidation Tool ● CGR greg_1_anderson
  • 3. Automation Planning ● Identify something to Automate ● Make it good ● Survey available tools ● Automate! ● Repeat ● 3
  • 4. What Can Be Automated? ● Development tasks ● Testing ● Deployment ● Maintenance (updates) 4
  • 5. Investment and Benefit ● More reliable and repeatable ● Easier to bring on new people ● Improvements compound ● It becomes possible to do more 5 https://xkcd.com/1205/
  • 6. Cost of Not Automating ● Prone to errors and mistake ● Risk of lost knowledge ● Deferred maintenance piles up ● Discouragement 6
  • 8. Service APIs ● Create pull requests ● Post comments ● Configure test credentials ● Web hooks 8
  • 9. Create Pull Requests 1. Push branch to GitHub 2. Create the PR ○ Use hub tool ○ Use REST API ● 9
  • 10. 10 Push Branch to GitHub Pushing to a remote, and authenticated via ssh (e.g. from command line): $ git push -u origin my-pr-branch From a script with no remote set, and using an OAuth token: $ push https://$GITHUB_TOKEN:x-oauth-basic@github.com/repo.git master
  • 11. Install and Use hub CLI Tool 11 Create a pull request: $ hub pull-request -m "This is my awesome pull request." MacOS brew install hub choco install hub sudo apt-get install git-hub https://github.com/github/hub
  • 12. Call GitHub REST API with Guzzle 12 function gitHubAPI($uri, $token, $data = [], $method = 'GET') { $url = "https://api.github.com/$uri"; $headers = [ 'Content-Type' => 'application/json', 'User-Agent' => 'my-org/my-app', $headers['Authorization'] = "token " . $token();; } $guzzleParams = [ 'headers' => $headers, ]; if (!empty($data)) { $method = 'POST'; $guzzleParams['json'] = $data; } $client = new GuzzleHttpClient(); $res = $client->request($method, $url, $guzzleParams); $resultData = json_decode($res->getBody(), true); $httpCode = $res->getStatusCode(); }
  • 13. Create Pull Request via REST API 13 https://developer.github.com/v3/pulls/#create-a-pull-request gitHubAPI( "/repos/$org/$repo/pulls", $token, [ "Title" => "Amazing new feature", "Body" => "Please pull this in!", "Head" => "$forkedRepo:new-feature", "Base" => "master" ], 'POST' );
  • 14. Post Comments on Pull Requests The hub tool does not support comments* , but the REST API is still available. 14 * Help improve hub! https://github.com/github/hub/pull/1465 Are you sure this will fly? Make sure the mock tests are passing before the demo. Has someone volunteered to do the cliff jump demo?
  • 15. Add a Comment via REST API 15 https://developer.github.com/v3/issues/comments/#create-a-comment gitHubAPI( "/repos/$org/$repo/commits/$sha/comments", $token, [ "Body" => "Me too", ], 'POST' );
  • 16. Configure Test Credentials ● Circle CI ○ REST API ● Travis CI ○ CLI Tool ○ REST API 16
  • 17. 17 Circle CI REST API curl -X POST --header "Content-Type: application/json" -d '{"name":"foo", "value":"bar"}' https://circleci.com/api/v1.1/project/github/$user/$proj/envvar?circle-token=$t Obtain an OAuth token for circle-token at https://circleci.com/account/api. Important note: Circle uses github in its API URLs, even though it shortens this to gh in all of the URLs in its web application. https://circleci.com/docs/2.0/env-vars/#injecting-environment-variables-with-the-api
  • 18. Travis CI CLI Tool 18 Set environment variables via env command: $ travis env set GITHUB_TOKEN $GITHUB_TOKEN For web API, see https://docs.travis-ci.com/api/#settings:-environment-variables https://github.com/travis-ci/travis.rb#env MacOS brew install travis Use the RubyInstaller sudo apt-get install ruby1.9.1-dev
  • 19. Spinning Up New Projects ● Composer create-project ● Post-create project scripts 19
  • 20. 20 Composer create-project ● Copies and renames a repository and orphans / detatches the result. ● Updates from the source may still be pulled by adding a second remote: ○ git remote add upstream git@github.com :parent-org/parent-project.git ○ git pull upstream master ● Usually, parent is treated as a template project, and updates are not pulled. ● Things that will evolve over time are placed in dependencies. ● Dependencies are updated via composer update, as usual. https://github.com/drupal-composer/rupal-project
  • 21. Post create-project scripts 21 ● Composer will run user-specified scripts after commands (e.g. install, update) ● This is used in drupal-composer/drupal-scaffold to download addition files. ● This allows files that cannot be stored in a dependency to be managed independently from the template repository. https://getcomposer.org/doc/articles/scripts.md
  • 23. Write Testable Code ● Pass values to functions ● Return values from functions 23
  • 24. Functional Testing ● Uses a working system to test ● Usually easy to write tests ● Sometimes hard to maintain (false failures creep in) ● Takes longer to run 24
  • 25. Mocks ● Replaces an actual system ● Useful for providing values ● Can also collect results ● Sometimes hard to maintain (false passes can creep in) ● Best to avoid testing implementation, e.g. confirming order of API calls 25
  • 26. Leveraging Docker ● Circle CI 2.0 or Travis ● Maintain custom images ● Store system scripts in image ● Automatically rebuild your docker image whenever its source repository changes. 26
  • 27. Parallelism in Circle 2.0 27 https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs defaults: &defaults docker: - image: quay.io/pantheon-public/build-tools-ci:1.x working_directory: ~/example_drops_8_composer environment: ADMIN_USERNAME: admin version: 2 jobs: build: <<: *defaults steps: - checkout - run: name: environment command: /build-tools-ci/scripts/set-environment
  • 28. Create Custom Docker Image 28 DockerFile URL # Use an official Python runtime as a parent image FROM drupaldocker/php:7.1-cli # Set the working directory to /build-tools-ci WORKDIR /build-tools-ci # Copy the current directory into the container at /build-tools-ci ADD . /build-tools-ci # Collect the components we need for this image RUN apt-get update RUN composer -n global require -n "hirak/prestissimo:^0.3" RUN mkdir -p /usr/local/share/drush RUN /usr/bin/env COMPOSER_BIN_DIR=/usr/local/bin composer -n --working-dir=/usr/local/share/drush require drush/drush "^8"
  • 29. Automate with Quay and GitHub 29
  • 33. Automating Releases ● Travis release steps ● Self Updates 33
  • 34. Automate setting up releases 34 Use the travis tool to automatically edit .travis.yml to include a release section: $ travis setup releases --token=$GITHUB_TOKEN Detected repository as org/my-tool, is this correct? |yes| Username: greg-1-anderson Password for greg-1-anderson: ************* Two-factor authentication code for greg-1-anderson:[REDACTED] File to Upload: my-tool.phar Deploy only from org/my-tool? |yes| Encrypt API key? |yes| If a token is provided, then the credentials prompt will be omitted.
  • 35. 35 Self-Updating Phars Robo PHP Task Runner Robo as a framework: https://robo.li/framework Instructions on using Robo to create a standalone phar; adds self:update command automatically. $commandClasses = [ MyProjectCommandsRoboFile::class ]; $statusCode = RoboRobo::run( $_SERVER['argv'], $commandClasses, 'MyAppName', '0.0.0-alpha0', $output, 'my-org/my-project' ); exit($statusCode);
  • 37. Automating Composer Update ● Schedule via Travis cron ● Composer Lock Updater ● Auto-merge after tests pass 37
  • 38. 38 Automated Dependency Update Process Travis Cron Composer Lock Update GitHub Pull Request Travis Test Run Merge Pull Request Exec hub REST REST [1] [2] 1. Pull request is only created if there are updates available. 2. Pull request is only merged if the test passes.
  • 39. 39 Set Up Travis CI Cron Once configured, Travis schedules job to start right away:
  • 40. 40 Add GitHub Token to Travis Settings From https://github.com/settings/tokens: Circle CI REST API URL
  • 42. 42 Add GitHub Token to Travis Settings $ travis env set GITHUB_TOKEN "[PASTE VALUE FROM GITHUB]" Circle CI REST API URL
  • 43. 43 Prevent Redundant Execution If doing highest / lowest testing with a matrix configuration entry, define an environment variable to control which Travis run will do the post-build actions: matrix: include: - php: 7.1 env: dependencies=highest env: DO_POST_BUILD_ACTIONS=1 - php: 7.0.11 - php: 5.6 - php: 5.5 env: dependencies=lowest
  • 44. 44 Only Update Dependencies in Cron after_success: - travis_retry php vendor/bin/coveralls -v - | if [ -z "$DO_POST_BUILD_ACTIONS" ] ; then return fi if [ "$TRAVIS_EVENT_TYPE" != "cron" ] ; then echo "Not a cron job; exiting." return fi if [ -z "$GITHUB_TOKEN" ]; then echo "No GITHUB_TOKEN defined; exiting." return fi # … execution continues below
  • 45. 45 Install and Run Composer Lock Updater # … execution continues here from "after_success:" example export PATH="$HOME/.composer/vendor/bin:$PATH" composer global require danielbachhuber/composer-lock-updater mkdir -p $HOME/bin wget -O $HOME/bin/security-checker.phar [URL] chmod +x $HOME/bin/security-checker.phar export PATH="$HOME/bin:$PATH" wget -O hub.tgz [URL] tar -zxvf hub.tgz export PATH=$PATH:$PWD/hub-linux-amd64-2.2.9/bin/ clu For [URL], see full instructions in: https://github.com/danielbachhuber/composer-lock-updater
  • 46. 46 Maintain Compatibility in composer.lock The versions of dependencies returned for a given run of composer update may vary depending on what version of php you are running. For example, a lock file built with php 7.1 may include dependencies that do not work with php 5.6. Fix this with a "platform": "php" entry: "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "platform": { "php": "5.6" } },
  • 47. 47 Update Details in Commit Comment PR is attributed to user who provided GitHub token. Comment lists dependencies that were updated. Security report included to bring attention to vulnerabilities. Commit itself is authored by composer-lock-updateuser.
  • 48. 48 Automatic Merge after Tests Pass remote=$(git config --get remote.origin.url) git remote set-url origin "${remote/github.com/$GITHUB_TOKEN:x-oauth-basic@github.com}" if [ -n "$TRAVIS_COMMIT_RANGE" ] && [ "master" == "$TRAVIS_BRANCH" ]; then changed_files=$(git diff --name-status "$TRAVIS_COMMIT_RANGE" | tr 't' ' ') if [[ "$changed_files" == "M composer.lock" ]] ; then ( echo "Only composer.lock was modified: auto-merging to $TRAVIS_BRANCH in $remote." git reset "$TRAVIS_BRANCH" git stash git checkout "$TRAVIS_BRANCH" git stash pop git add composer.lock git commit -m "Auto-update dependencies." git push origin "$TRAVIS_BRANCH" ) 2>&1 | sed -e "s/$GITHUB_TOKEN/REDACTED/g" else echo "Not auto-merging, because multiple files were changed" fi fi
  • 49. Automate the automation of your automation Run a command to automatically configure Travis to automate the updating of your project’s composer.lock file. 49
  • 50. 50 The ci travis:clu Command ● Install ci.phar. ● Change your working directory to your PHP project. ● Define $GITHUB_TOKEN ● Run ci travis:clu ● Inspect the changes. Push them up to GitHub. ● Turn on cron in the Travis admin interface ● Be amazed.
  • 52. JOIN US FOR CONTRIBUTION SPRINT Friday, 29 September, 2017 First time Sprinter Workshop Mentored Core Sprint General Sprint 9:00-12:00 Room: Lehar 1 - Lehar 2 9:00-18:00 Room: Stolz 2 9:00-18:00 Room: Mall #drupalsprints
  • 53. WHAT DID YOU THINK? Locate this session at the DrupalCon Vienna website: http://vienna2017.drupal.org/schedule Take the survey! https://www.surveymonkey.com/r/drupalconvienna