Upgrade to Pro — share decks privately, control downloads, hide ads and more …

2020 - Mastering hordes of CI jobs using Jenkins plugins

2020 - Mastering hordes of CI jobs using Jenkins plugins

Jenkins plugins provide ability to automate CI test automation jobs creation (using Pipeline plugin and Job plugin) and this allows to effectively create and maintain lots of test automation configurations

Presentation for Test Automation Days conference

Vjacheslav Lukashevich

October 22, 2020
Tweet

More Decks by Vjacheslav Lukashevich

Other Decks in Programming

Transcript

  1. ABOUT ME • I am a Tester • Studied Test

    Automation extensively • Worked on the number of great projects with Test Automation • Last couple of years did a deep dive into CI/CD topic 2
  2. For 11 consecutive years, Evolution Gaming has been crowned “Live

    Casino Supplier of the Year” at the EGR B2B Awards 4
  3. 5 34 new games (2017 – 2020) 300+ top tier

    operators Thousands of users 24/7/365 operations Lowest latency video in industry Hardware & equipment Cameras, microphones In-house developed 7000+ EVOlutioners 14 countries
  4. Evolution Gaming Engineering Hubs Riga ! 2006 Amsterdam " Minsk

    # 2019 290+ Evolutioneers 100+ Evolutioneers 14+ Evolutioneers Tallinn $ 2016 25+ Evolutioneers
  5. 7 Tech Stack • Functional Scala • Low latency event

    sourcing platform (kafka, Cassandra, akka) • TypeScript, React (with hooks), BabylonJS • Infrastructure as Code based oт Kubernetes • Hadoop 3.x + Hive & Spark • C++ for video recognition solutions • Python + OpenCV for automated UI testing using image recognition.
  6. Motivation for This Speech 9 QA engineers usually focus on

    the tests part Knowledge of CI allows to automate much more things!
  7. Agenda 11 1) Automating Jenkins • Configuration • Pipelines •

    Libraries • Jobs 2) Moving to CI/CD • Jenkins + GitLab
  8. ~300 Test Jobs For bi-weekly Release process 13 E2E regression

    packs • Java, TestNG • All teams, all products, integrations with clients • ~10-40 minutes each job Executed • Nightly • After deployments
  9. Manual Configuration is Cumbersome 14 • Bunch of input fields

    to enter • Copy-paste • Multiple jobs management • Migrate to new Java version..
  10. “AS A CODE” - Power of Programming Language - Source

    Control Management - Code Reviews Jenkins automation 16
  11. Build 19 Payments smoke tests on UAT Job/Project Build Execution

    on 17.01.2018 Result of Job execution https://jenkins.io/doc/book/glossary
  12. Pipeline-Stage-Step 20 https://jenkins.io/doc/book/glossary Payments smoke tests on UAT Job/Project Build

    Pipeline Stage Step Execution on 17.01.2018 Smoke test pipeline • Prepare environment • Run tests • Report • Generate report • Run Maven build • Create directory to store results • Execute shell command
  13. Agent 21 https://jenkins.io/doc/book/glossary Payments smoke tests on UAT Job/Project Build

    Pipeline Stage Step Execution on 17.01.2018 Smoke test pipeline • Prepare environment • Run tests • Report • Generate report • Run Maven build • Create directory to store results • Execute shell command Node/Agent • Machine capable to execute pipeline steps • Unix box • Docker container
  14. Automation Framework for Jenkins Building Blocks • Jenkins Pipeline DSL

    • Job DSL • Shared libraries • Configuration as Code • 22
  15. ü Get agent where to run tests ü Pull Test

    Code from GIT ü Build it ü Run Tests using provided parameters ü Report results Here comes most differences! Common Testing Pipeline Script 27
  16. Groovy • Jenkins supported language • Yet another “Java like”

    language to learn • Data types • Strings • Lists, Maps • Functions, Closures • Work with files, parse json 29
  17. 1) Create function to reuse across different pipelines 2) Use

    it in pipeline script Shared Library (global vars) https://www.jenkins.io/doc/book/pipeline/shared-libraries/ ü Stored in /vars directory ü File name = function name ü Implements call method 31
  18. • Custom reporting • Messages to Slack • Gitlab comments

    • Parse test reports • Store data in Influx DB • Build optimizations • Trigger jobs in parallel • Pre-build test code • Create test environment 33 Libraries We Have
  19. “Seed Job” The seed job is a Jenkins job which

    runs a DSL script, and then generates a new job. https://tech.gogoair.com/jenkins-jobs-as-code-with-groovy-dsl-c8143837593a 35
  20. Define Similar Jobs Data in JSON Job name Build parameters

    Slack channel to report {JSON} Seed template script Job Job Job 39
  21. • Users work with data in JSON • Master Seed”

    run on merge • Jobs automatically • Generated • Included into dashboard • Removed Regular CI Activities Simplified 40
  22. • Split test scope to smaller jobs • informative dashboards

    • simple re-run Better Test Suite Organization 41
  23. 42 Job DSL scripts Shared Libraries Pipeline scripts Local development

    Jenkins JSON files for similar jobs Framework structure • IDE support • Compilation • Tests
  24. • Jenkins fully managed from code • Code reviews by

    QA, DevOps, developers • Community that understands CI slightly increased 43 Results 43
  25. 45 • Simple technical migrations • Common features for all

    teams • Development of advanced CI/CD setup CI automation unlocks improvements
  26. • ”You build it, you run it” • Microservices •

    Delivery pipelines • Testing Pyramid • Trunk based development • …. 47 47 Moving Organization to CD
  27. TypeScript, React, Babylon.js GitLab repository >40 code packages >10 Teams

    >200 contributors 49 Frontend Mono-Repo Baccarat Poker Roulette Shared UI components Blackjack … …
  28. • Code Review • Test Automation • Manual Testing 51

    Build QA around Merge Request workflow Testing code from GIT branch
  29. Changing our approach for Frontend Test Automation • Each package

    contains • Unit & Integration tests • Few E2E tests • Visual regression tests 52 Poker Shared UI components … src tests src tests
  30. Visual Regression Tests screenshot comparison • Separate components • Games

    layout 53 ~1200 test cases X number of devices/ browsers baseline difference
  31. Changing our CI Setup To support work in Merge Requests

    1. Store CI configuration in same mono-repo 2. Launch tests for impacted packages 3. Use MR comments for communication with CI 4. Add automated quality gates before merge 54 Shared UI components poker blackjack Crazy time code change code change
  32. 1. Test config in each package • Test parameters •

    Paths to watch 60 roulette- common french roulette code change code change american roulette
  33. Test Orchestration Job Selects needed test jobs for code changes

    MR created Commit added 1) Get changed packages in GIT 2) Read all job configs in repo 3) Find matching jobs (between 1,2) 4) Trigger jobs from 5 to ~20 jobs triggered 62
  34. Generic Test Job for Frontend Tests 1. Build code 2.

    Deploy it 3. Run tests based on JSON config 4. Report to Gitlab 63
  35. Gitlab REST API Gitlab exposes secured API to get data

    about: • Merge Requests • Commits • Pipelines • Users & groups • etc. https://docs.gitlab.com/ee/api/ 69
  36. GIT: Package->users mapping file REST API: Get list of users

    who MR merge_requests/{MR_ID}/award_emoji Compare list of users with mapping Check Code Owner’s Approval Before Merge 70
  37. Other things we check/do • All needed pipelines were executed

    • Images are compressed enough • Reporting flaky tests by rerunning failed tests 71
  38. Result: QA System Around Mono-Repo Relevant tests executed on MR

    Can’t merge without: • All pipelines green • Code owners approved change MR comments • provide status update • used to trigger needed jobs 72
  39. 40 new Jenkins jobs From 4 seed scripts 1600 runs

    per day 73 20-40 merges in frontend repo daily Daily deployments to production QAs focus on changes instead of regression
  40. 1. Jenkins automation needs testing 2. Complexity of pipelines grows

    3. Throughput of Jenkins could become an issue Problems 75
  41. 1. Plug more automation into GitLab 2. Improve changed code

    footprint calculation • smarter test scope selection 3. Spawn production Jenkins instances • on as needed basis Future Plans 76
  42. • CI tools need to be automated • Jenkins has

    rich capabilities for automating it “As A Code” • QA engineers in CI/CD field improve the overall DevOps expertise 77 Short Summary Thank You!