-
Notifications
You must be signed in to change notification settings - Fork 29
Slice 3: Create airgap test pipeline (Jenkinsfile.airgap-rke2-tests) #591
Description
Parent PRD
What to build
Create a Declarative Pipeline Jenkinsfile.airgap-rke2-tests that replaces Jenkinsfile.airgap.go-tests (405 lines) — the most comprehensive airgap pipeline that combines setup, test execution, and teardown into a single pipeline.
This pipeline consumes the shared functions added in #589, using airgapInfraPipeline for infrastructure setup and airgapTestPipeline for test execution and reporting. It coexists alongside the original file during migration.
Full lifecycle flow:
- Standard dual-repo checkout via
airgap.standardCheckout - Build
Dockerfile.airgap-go-testsimage (kept separate fromDockerfile.infrato preserve build time) - Setup infrastructure (same stages as Slice 2 setup flow, delegated to shared functions)
- Deploy RKE2 cluster via shared Ansible function
- Configure private registry
- Deploy Rancher (unconditional in this pipeline, unlike the infra pipeline)
- Generate
cattle-config.yaml— retrieve tofu outputs, run admin token generation playbook - Run Go test suite via gotestsum with standardized flags and output format
- Optionally report results to Qase (controlled by
QASE_TEST_RUN_IDparameter) - Teardown infrastructure if
DESTROY_AFTER_TESTS=true(viapost { always }) - Teardown infrastructure on failure if
DESTROY_ON_FAILURE=true(viapost { failure })
Key difference from Slice 2: This pipeline always deploys Rancher (no DEPLOY_RANCHER toggle), includes test execution stages, and has the DESTROY_AFTER_TESTS option. The teardown logic uses the exact same airgap.teardownInfrastructure function as the infra pipeline's destroy action.
Parameters (harmonized):
TEST_PACKAGE— Go test package to runCONFIG— Test configuration fileDESTROY_ON_FAILURE(boolean, default: true)DESTROY_AFTER_TESTS(boolean, default: true)QASE_TEST_RUN_ID(string, optional) — enables Qase reporting when setQA_JENKINS_LIBRARY_BRANCH,TESTS_BRANCH,QA_INFRA_BRANCH— standard branch parameters
Acceptance criteria
-
Jenkinsfile.airgap-rke2-testscreated in Declarative Pipeline syntax - Infrastructure setup matches original
Jenkinsfile.airgap.go-testssetup stages - RKE2 deployment uses shared Ansible function
- Rancher deployment is unconditional (always runs)
- cattle-config generation uses shared token extraction pattern
- gotestsum invocation uses standardized flags and output format
- JUnit XML and JSON test results are archived
- Qase reporting runs as optional stage when
QASE_TEST_RUN_IDis set - DESTROY_ON_FAILURE triggers teardown on any stage failure via
post { failure } - DESTROY_AFTER_TESTS triggers teardown after successful run via
post { always } - Teardown uses same
airgap.teardownInfrastructureas Slice 2 - All shared functions from Slice 1: Add shared pipeline functions to qa-jenkins-library #589 are consumed
- Original
Jenkinsfile.airgap.go-testsremains untouched (parallel coexistence) - Pipeline passes at least 2 successful live test execution cycles
Blocked by
- Blocked by Slice 1: Add shared pipeline functions to qa-jenkins-library #589 (shared pipeline functions must be available)
User stories addressed
- User story 4 (tfvars uploaded/downloaded via shared S3 function)
- User story 5 (tofu lifecycle via shared function)
- User story 7 (checkout via shared function)
- User story 9 (go-tests pipeline shares same checkout and infra functions)
- User story 10 (standardized gotestsum invocation)
- User story 11 (Qase reporting as optional stage)
- User story 12 (teardown logic shared with destroy pipeline)
- User story 13 (cattle-config generation as shared function)
- User story 21 (Declarative Pipeline syntax)
- User story 22 (parallel coexistence)
- User story 23 (simplified naming)
- User story 24 (harmonized parameters)