A reliable test infrastructure is half the battle to get stable tests into your delivery pipeline. Therefore container technologies like Docker can help to build up an immutable deployment and test infrastructure. If you think one step further, you will soon get to the point where scalability came into your glance. To get this challenge done, something like a container-based CI/CD environment will be needed. Therefore we will take a look at the open-source solution "OpenShift". The container platform combined the Jenkins build pipeline and Kubernetes concepts to a ready-to-use CI/CD solution. The talk will show what of the platform components can be used to build up your self-hosted automated build, test and deployment pipeline. In a live demo session we will build a microservice application, unit test it, deploy it, execute API integration tests and at least run real UI-Tests in dockerized desktop containers.
2. Sebastian ScheeleHeadquarter in
in Hamburg, Germany
Founders
Awarded by
> 25 employees
world wide
Founded in 2016 Julian Hansert
Cloud native
and container
technologies
Software
development
K8s certified
Multi & Hybrid Cloud
Container Engine
3. Testing as a Service
Consulting
Workshops
Infrastruktur
Open Source
Testautomatisierung @ ConSol
Kontakt: nico.zellner@consol.de
4. +
Agenda
• OpenShift CI/CD Pipeline Concept
• Build up some Pipelines!
• Stage I: CI Build of the Artefact
• Stage II: Automated Testing
− Citrus Integration Testing
− Sakuli E2E Testing
• Stage III: Artefact Deployment
• Review
• Alternatives
• Links
6. OpenShift Build Pipelines: Build -> Test -> Run! Folie 6
Prozess Development ► QA Stage
OPS
Code
Build &
Unit-Test
Deploy in Dev
Container
Image
Container
Registry
POD
AUTOMATIC
MANUEL ODER AUTOMATIC
POD
Deploy in QA
► Test
7. OpenShift Build Pipelines: Build -> Test -> Run! Folie 7
Prozess QA ► Production Stage
OPS
Deploy in
Production
►Smoke-Test
Container
Image from QA Stage
MANUEL
16. OpenShift Build Pipelines: Build -> Test -> Run! Folie 16
Transition to OpenShift
Goals:
• Don’t change the Sourcecode of the Apps
• Also don’t change the Testcode
• Fully Automated Pipeline until Production
• All in OpenShift (CI, Build, Test, Deployment)
• Jenkins v1 -> v2
22. OpenShift Build Pipelines: Build -> Test -> Run! Folie 22
Mission ► Integration Tests
System under Test
System
Under Test
Verträge
Stammdaten
Dienstleister
Shipping
JM
S
XM
L
FTP
CSV
Webclient
Kunde
Agent / Techniker
Mobile, PDA
Http
REST
Http
SOAP
23. OpenShift Build Pipelines: Build -> Test -> Run! Folie 23
Mission ► Integration Tests
System
Under Test
Stammdaten
Dienstleister
JM
S
XM
L
FTP
CSV
Kunde
Agent / Techniker Http
REST
Http
SOAP
Automated API Interface Tests
24. OpenShift Build Pipelines: Build -> Test -> Run! Folie 24
Use Case: Testing of Middleware Integration / ESB / API
Citrus Features
• Ready to use components
− Client & Server Implementation
− Application Server Deployments
− Container Images
• Message transports
− Http REST, SOAP, JMS, FTP, TCP/IP, Mail, RMI, SSH, ...
• Data formats
− XML, Json, PlainText, CSV, XSD, WSDL
• Test DSL
− XML & Java
citrusframework/citrus
30. OpenShift Build Pipelines: Build -> Test -> Run! Folie 30
Motivation
• Founded February 2014 Open Source (Apache)
• Goals:
− Combine a web and screen-based testing in ONE tool
− Use test results in CI- and monitoring systems
− Platform independent: (Linux/Windows/MacOS)
• Application tests from a End User Perspective
− Functionality (business critical path)
− Performance (e2e loading time)
31. OpenShift Build Pipelines: Build -> Test -> Run! Folie 31
Component 1: Sahi / Selenium
Web testing tool (sahi.co.in, seleniumhq.org)
method based DOM access:
_assertContainsText ("Logged in as: Sakuli", _div("user_field"));
_click(_span("Loaded Run Tabels"));
_assertExists(_table("cross_table_fixed"));
_assertExists(_cell(“testing allowed", _rightOf(_span("Name")), _under(_cell("Action")));
<table>
<tbody>
<tr>
<td>Alice</td>
<td>Bob</td>
</tr>
</tbody>
</table>
Webserverlocalhost:9999
{js}
38. OpenShift Build Pipelines: Build -> Test -> Run! Folie 38
Review
• Jenkins is not designed for containers or pods
Plugins, Startup, Java Agents, local Files, Development Roadmap
• Migration to Jenkinsfiles
• A bunch of wrapper scripts needed, to be flexible
• Rethink the CI workflow due to distributed approach
• Access to CI runtime data is not so easy any more
Logs, Screenshots, Artifacts
• Broad mix of technologies
• Jenkins slave image is intransparent -> do it yourself!
Base image: github.com/openshift/jenkins/slave-base
• Distributed documentation
OpenShift, Kubernetes, Jenkins, Jenkins-Plugins, Docker, …
39. OpenShift Build Pipelines: Build -> Test -> Run! Folie 39
Review
• Scaling is solved by the Cluster
• "oc CLI client" instead of OpenShift Jenkins Plugin
► Pipeline can be tested/developed step-by-step
► Independent from the plugin release lifecycle
• Parameterized YAML templates for OpenShift
• Infrastructur as Code
• New stages are easy to create
• Deployment will be tested by default
• Secrets are maintainable by cluster admins
• Builds can be controlled by CLI and UI
• Extendable trough Open Source approach
40. OpenShift Build Pipelines: Build -> Test -> Run! Folie 40
Alternative Approaches
hasura/gitkube
⇨ Gitkube
• “git push” based Workflow on remote Git
• Simple: combination of bash scripts
⇨ Skaffold:
• Simple scripted CI/CD Workflow
• 2 Stages: Local & Remote
⇨ JenkinsX
• Predefined workflow for CI/CD in Kubernetes
• NO new Jenkins -> just a Wrapper
• GitHub only (currently)
⇨ DroneCI / KubeCI
• Container first and easy understandable concept
• Local execution
• Layered build concept for Pods (in Development)
GoogleContainerTools/skaffold
kubeciiodrone/drone
jenkins-x/jx