Jenkins file to run k8s-deployment-full-grid.yaml and maven container

99 views
Skip to first unread message

Tawan Bhatia

unread,
May 20, 2021, 9:02:31 AM5/20/21
to Selenium Users
Hi Everyone
I need one help regarding jenkins file creation for running selenium grid in kubernetes in maven container.
Few things:
  1. The jenkins am using is running in kubernetes cluster.
  2. I  tried using https://github.com/SeleniumHQ/docker-selenium
       https://github.com/SeleniumHQ/docker-selenium/blob/trunk/k8s-deployment-full-grid.yaml
       where I used minikube in local mac machine and executed parallel tests.
       But am not able to understand how to create jenkins file for this using multiple services mentioned in yaml file and a maven container.
3. I also tried but then here firstly am not sure how to get the http://localhost:4444/wd/hub and also I feel it wont scale in case I have multiple feature files
podTemplate(yaml: """
apiVersion: v1
kind: Pod
spec:
 containers:
 - name: maven
  image: maven:3-openjdk-11
  command: ['cat']
  tty: true
services:
 hub:
  image: selenium/hub:3.14
  ports:
   - "4444:4444"
 chrome:
  image: selenium/node-chrome:3.14
  depends_on:
   - hub
  environment:
   - HUB_HOST=hub
 chrome1:
  image: selenium/node-chrome:3.14
  depends_on:
   - hub
  environment:
   - HUB_HOST=hub
"""
 ) { node(POD_LABEL) {
   try {
  stage('Checkout') {
  git branch: "${GIT_BRANCH}", url: "${GITREPO}", credentialsId: "${pullCredNameGitHub}"container('maven') {
  stage('Build and run test') {
             sh """
    mvn -Dwebdriver.remote.url ='http://localhost:4444/wd/hub' verify -Pgui-sg
     """
     }

Thanks,
Tawan
Reply all
Reply to author
Forward
0 new messages