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:

pipeline {
agent any
stages {
  stage('Running Jmeter') {
    agent {
      kubernetes {
          label "jmeter_tests_executor"
          yaml '''
          apiVersion: batch/v1
kind: Job
metadata:
    name: jmeter
    namespace: jenkins
spec:
  parallelism: 2 
  completions: 2 
  backoffLimit: 1 
  ttlSecondsAfterFinished: 100 
  template:
    spec:
      initContainers:
      - name: nft-tests-downloader
        image: git
        command: ['sh', '-c', "git clone --depth 1  --branch master 
https://some.org.com/repo.git /tmp/nft/;chown 1000:1000 /tmp/nft_logs"]
        securityContext:
        volumeMounts:
        - mountPath: /tmp/nft
          name: nft-tests
        - name: nft-test-logs
          mountPath: /tmp/nft_logs
      containers:
      - name: jmeter
        image: jmeter
        command: ["/bin/sh","-c"]
        args: ["jmeter run performance test"]
        tty: true
        imagePullPolicy: Always
        securityContext:
            runAsUser: 1000
        volumeMounts:
            - mountPath: /tmp/nft
              name: nft-tests
            - name: nft-test-logs
              mountPath: /tmp/nft_logs
      restartPolicy: OnFailure
      volumes:
      - emptyDir: {}
        name: nft-tests
      - name: nft-test-logs
        persistentVolumeClaim:
              claimName: nft-test-logs

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).
If someone had experience with it, please share your workarounds or ideas 
how to implement this idea.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/33b2c31c-5c84-4a88-b731-717f75ae7457o%40googlegroups.com.

Reply via email to