 Multibranch tests with Drupal , Jenkins and Docker@omarlopesino | https://bit.ly/2WBAIcR
Multibranch tests with Drupal , Jenkins and Docker@omarlopesino | https://bit.ly/2WBAIcR
		 
					
drupal.org/u/mistermoper
Contributed modules: json_form, slickquiz_field...
In this session we will see:
 
				 
					Source: Branching workflows
 
				 
				 
				 
					 
				Jenkins multibranch testing example
Automated tests for each git repository branch.
 
				Jenkins multibranch testing example
Automated tests for each git repository branch.
 
				Jenkins multibranch testing example
Automated tests for each git repository branch.
 
				Jenkins multibranch testing example
Automated tests for each git repository branch.
 
				Jenkins multibranch testing example
Notification
 
				Jenkins multibranch testing example
Code static analysis
 
				Jenkins multibranch testing example
Test results
 
				How to Jenkins multibranch
Which tools do we need?
 
							 
							How to Jenkins multibranch
 
					How to Jenkins multibranch
Develop a docker infraestructure for drupal
 
						 
						 
					Example: Docker4Drupal
How to Jenkins multibranch
Create Jenkins multibranch pipeline job
 
					
				Talk is cheap. Show me the code
 
				How to Jenkins multibranch
Create Jenkins multibranch pipeline job: Skeleton
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') { ... }
        stage('Static Analysis') { ... }
        stage('Unit tests') { ... }
        stage('Database sync') { ... }
        stage('Functional tests') { ... }
    }
    post { ... }
} 
				How to Jenkins multibranch
Create Jenkins multibranch pipeline job: Docker start
pipeline {
    agent any
    stages {
        stage('Docker start') {
            sh "docker-compose up -d"	
        }
    }
} 
				How to Jenkins multibranch
Create Jenkins multibranch pipeline job: Composer
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') {
            sh "docker-compose exec php -T composer install"
        }
    }
} 
				How to Jenkins multibranch
Creating Jenkinsfile: Static analysis
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') { ... }
        stage('Static Analysis') {
          sh "docker-compose exec php -T 
            ./vendor/bin/phpcs --standard=Drupal,DrupalPractice"
        }
    }
} 
				How to Jenkins multibranch
Creating Jenkinsfile: Unit tests
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') { ... }
        stage('Static Analysis') { ... }
        stage('Unit tests') {
          sh "docker-compose exec php -T 
            ./vendor/bin/phpunit -c phpunit.xml"
        }
    }
} 
				How to Jenkins multibranch
Creating Jenkinsfile: Database sync
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') { ... }
        stage('Static Analysis') { ... }
        stage('Unit tests') { ... }
        stage('Database sync') {
          sh "drush @my-environment sql:sync"
          // sanitize, updb, cim, cr, file sync..
        }
    }
} 
				How to Jenkins multibranch
Creating Jenkinsfile: Functional tests
pipeline {
    agent any
    stages {
        stage('Docker start') { ... }
        stage('Composer') { ... }
        stage('Static Analysis') { ... }
        stage('Unit tests') { ... }
        stage('Database sync') { ... }
        stage('Functional tests') {
          sh "docker-compose exec php -T 
            vendor/bin/behat --config tests/behat/behat.yml"
        }
    }
} 
				How to Jenkins multibranch
Creating Jenkinsfile: Post steps
pipeline {
    agent any
    stages { ... }
    post {
      always {
        sh "docker-compose down"
      }
      success {
        slackSend color: "#00FF00", 
          channel: "#myproject",
          message: "Tests passes, hurray!"
      }
      failure { ... }
      changed { ... }
    }
} 
				How to Jenkins multibranch
Create multibranch pipeline job
 
				 
				Use case
 
				Use case
Use case
 
				What more can we do?
 
					What more can we do?
 
					What more can we do?
Patches applied in our site
