Skip to content

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

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. It uses make.runTarget() for cluster/registry/rancher operations (same as Slice 2) and shares the same infrastructure setup stages.

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, using shared functions):
    • Tofu init → workspace create → apply
    • Generate inventory from tofu outputs
    • Configure Ansible variables via airgap.configureAnsible
    • Copy SSH keys to nodes via ansible.runPlaybook
    • Deploy RKE2 cluster via make.runTarget(target: 'cluster')
    • Configure private registry via make.runTarget(target: 'registry') (conditional)
    • Deploy Rancher via make.runTarget(target: 'rancher') (unconditional in this pipeline)
  4. Generate cattle-config.yaml — retrieve tofu outputs, run admin token generation playbook
  5. Run Go test suite via gotestsum with standardized flags and output format
  6. Optionally report results to Qase (controlled by QASE_TEST_RUN_ID parameter)
  7. Teardown infrastructure if DESTROY_AFTER_TESTS=true (via post { always })
  8. 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 same airgap.teardownInfrastructure function as the destroy pipeline.

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
  • Standard branch parameters, version parameters, TERRAFORM_CONFIG, ANSIBLE_VARIABLES

Acceptance criteria

  • Jenkinsfile.airgap-rke2-tests created in Declarative Pipeline syntax
  • Infrastructure setup uses same shared functions as Slice 2
  • RKE2 deployment uses make.runTarget(target: 'cluster')
  • Rancher deployment is unconditional (always runs via make.runTarget(target: 'rancher'))
  • 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 destroy
  • 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 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)
  • User story 22-24 (Makefile integration for cluster/registry/rancher)

Metadata

Metadata

Assignees

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