Skip to content

Slice 3: Create airgap test pipeline (Jenkinsfile.airgap-rke2-tests) #591

@floatingman

Description

@floatingman

Parent PRD

#585

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:

  1. Standard dual-repo checkout via airgap.standardCheckout
  2. Build Dockerfile.airgap-go-tests image (kept separate from Dockerfile.infra to preserve build time)
  3. Setup infrastructure (same stages as Slice 2 setup flow, delegated to shared functions)
  4. Deploy RKE2 cluster via shared Ansible function
  5. Configure private registry
  6. Deploy Rancher (unconditional in this pipeline, unlike the infra pipeline)
  7. Generate cattle-config.yaml — retrieve tofu outputs, run admin token generation playbook
  8. Run Go test suite via gotestsum with standardized flags and output format
  9. Optionally report results to Qase (controlled by QASE_TEST_RUN_ID parameter)
  10. Teardown infrastructure if DESTROY_AFTER_TESTS=true (via post { always })
  11. Teardown infrastructure on failure if DESTROY_ON_FAILURE=true (via post { 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 run
  • CONFIG — Test configuration file
  • DESTROY_ON_FAILURE (boolean, default: true)
  • DESTROY_AFTER_TESTS (boolean, default: true)
  • QASE_TEST_RUN_ID (string, optional) — enables Qase reporting when set
  • QA_JENKINS_LIBRARY_BRANCH, TESTS_BRANCH, QA_INFRA_BRANCH — standard branch parameters

Acceptance criteria

  • Jenkinsfile.airgap-rke2-tests created in Declarative Pipeline syntax
  • Infrastructure setup matches original Jenkinsfile.airgap.go-tests setup 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_ID is 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.teardownInfrastructure as Slice 2
  • All shared functions from Slice 1: Add shared pipeline functions to qa-jenkins-library #589 are consumed
  • Original Jenkinsfile.airgap.go-tests remains untouched (parallel coexistence)
  • Pipeline passes at least 2 successful live test execution cycles

Blocked by

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestteam/pit-crewslack notifier for pit crew

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions