Uploaded image for project: 'OpenShift Virtualization'
  1. OpenShift Virtualization
  2. CNV-79243

Optimize cnv-tests Jenkinsfile to use single pod

XMLWordPrintable

    • Quality / Stability / Reliability
    • 0.42
    • False
    • Hide

      None

      Show
      None
    • False
    • None
    • CNV QE DevOps Sprint 284
    • None

      Summary

      Optimize resource usage for pytest-based CNV test jobs by consolidating the pipeline from two Kubernetes pods (infra + tests) into a single pod with three containers (infra-pod, tests-container, jnlp).

      Context / Quick Research

      • Current pipeline file: src/jobs/tests/cnv-tests/Jenkinsfile-cnv-tests
      • The pipeline spins up an infra pod for most stages via pytest.renderInfraPodYaml() and a separate tests pod for the "Run the tests" stage via pytest.renderCnvTestsPodYaml()/renderSmokeCnvTestsPodYaml().
      • Each pod includes a jnlp container, so the job consumes 2 pods × 2 containers today.
      • There is already a combined-pod helper in vars/upgrade.groovy (renderInfraPodYamlWithTestsContainer) that shows how to build a single pod with infra + tests containers sharing the same PVC/mounts.

      Proposed Work

      • Add a reusable helper in vars/pytest.groovy (or refactor from upgrade.groovy) to render a single pod with both infra and tests containers.
      • Centralize tier-based sizing/timeout in Job DSL (OcpVirtTestJob): if tier == 0 use MEDIUM and short timeout, else LARGE and longer timeout.
      • Expose these as env vars via addEnvironmentVariables (e.g., CNV_POD_SIZE / CNV_TEST_TIMEOUT_HOURS).
      • Consume env vars in Jenkinsfile/pod rendering to avoid duplicated tier checks.
      • Update Jenkinsfile-cnv-tests to use the combined pod as the pipeline agent.
      • Remove the per-stage kubernetes agent in "Run the tests".
      • Use container('tests-container') for pytest execution; use infra-pod for infra stages.
      • Validate job behavior and resource usage (pods count, mounts, envs) in a dev job.

      Steps to Reproduce

      1. Trigger any standard cnv-tests job (non-gating).
      2. Observe Kubernetes pods for the build.

      Actual Result

      Two pods are created: infra pod (infra-pod + jnlp) and tests pod (tests-container + jnlp).

      Expected Result

      Single pod with three containers (infra-pod, tests-container, jnlp) is used for the whole pipeline.

              lbednar@redhat.com Lukas Bednar
              lbednar@redhat.com Lukas Bednar
              Daniel Keler Daniel Keler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: