-
Task
-
Resolution: Done
-
Major
-
None
-
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
- Trigger any standard cnv-tests job (non-gating).
- 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.
- links to