Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63279

Running parallel kubernetes jobs in Jenkins pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • Jenkins 2.235.2
      Kubernetes v1.16.3

      I'm running perfomance tests on Jenkins. Test that may include multiple instances of the same container to generate necessary load. I can't hardcode number of instances as it varies based on params for tests. I've tried to use the following code:

                                          apiVersion: batch/v1
                                          kind: Job
                                          metadata:
                                              name: jmeter
                                              namespace: jenkins
                                          spec:
                                          # parallelism: 
                                          # completions: 2 
                                          backoffLimit: 1 
                                          ttlSecondsAfterFinished: 100 
                                          template:
                                              spec:
                                              initContainers:
                                              - name: nft-tests-downloader
                                                image: git:latest
                                                command: ['sh', '-c', "git clone --depth 1  --branch master https://some_git/nft_performance.git /tmp/nft/;chown 1000:1000 /tmp/nft_logs"]
                                                securityContext: 
                                                  runAsUser: 0
                                                volumeMounts:
                                                - mountPath: /tmp/nft
                                                  name: nft-tests
                                                - name: nft-test-logs
                                                  mountPath: /tmp/nft_logs
                                                containers:
                                                - name: jmeter
                                                  image: jmeter
                                                command:
                                                - /bin/cat
                                                tty: true
                                                volumeMounts:
                                                - mountPath: /tmp/nft
                                                  name: nft-tests
                                          volumes:
                                          - emptyDir: {}
                                              name: nft-tests
      
       
      

      But it doesn't work. It's hanging on pod scheduling(jobs works ok if you apply this manifest directly on kubernetes cluster without Jenkins).

            Unassigned Unassigned
            davidgreen55 David Green
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: