mirror of https://github.com/rancher/elemental.git
315 lines
12 KiB
YAML
315 lines
12 KiB
YAML
# This workflow is a reusable one called by other workflows
|
|
name: (template) Main template
|
|
|
|
on:
|
|
workflow_call:
|
|
# Variables to set when calling this reusable workflow
|
|
inputs:
|
|
backup_restore_version:
|
|
description: Version of backup-restore-operator to use
|
|
type: string
|
|
boot_type:
|
|
description: Choose booting type (pxe, iso, raw)
|
|
default: pxe
|
|
type: string
|
|
ca_type:
|
|
description: CA type to use (selfsigned or private)
|
|
default: selfsigned
|
|
type: string
|
|
cert-manager_version:
|
|
description: Version of cert-manager to use
|
|
type: string
|
|
cluster_name:
|
|
description: Name of the provisioned cluster
|
|
default: elemental-cluster
|
|
type: string
|
|
cluster_number:
|
|
description: Number of clusters to deploy in multi-cluster test
|
|
type: string
|
|
cluster_type:
|
|
description: Cluster type (empty if normal or hardened)
|
|
type: string
|
|
cypress_tags:
|
|
description: Tags to filter tests we want to run
|
|
default: main
|
|
type: string
|
|
destroy_runner:
|
|
description: Destroy the auto-generated self-hosted runner
|
|
default: true
|
|
type: boolean
|
|
elemental_ui_version:
|
|
description: Version of the elemental ui which will be installed (dev/stable)
|
|
default: dev
|
|
type: string
|
|
force_downgrade:
|
|
description: Force OS downgrade
|
|
default: false
|
|
type: boolean
|
|
full_backup_restore:
|
|
description: Test migration-like backup/restore functionality
|
|
default: false
|
|
type: boolean
|
|
k8s_downstream_version:
|
|
description: Rancher cluster downstream version to use
|
|
type: string
|
|
k8s_upstream_version:
|
|
description: Rancher cluster upstream version to use
|
|
type: string
|
|
node_number:
|
|
description: Number of nodes to deploy on the provisioned cluster
|
|
default: 5
|
|
type: string
|
|
operator_install_type:
|
|
description: Type of installation to use for the Elemental operator (cli/ui)
|
|
default: cli
|
|
type: string
|
|
operator_repo:
|
|
description: Elemental operator repository to use
|
|
type: string
|
|
default: oci://registry.opensuse.org/isv/rancher/elemental/maintenance/6.0/charts/rancher
|
|
operator_upgrade:
|
|
description: Elemental operator version to upgrade to
|
|
type: string
|
|
os_to_test:
|
|
description: OS repository to test (dev/staging/stable)
|
|
type: string
|
|
default: stable
|
|
os_version_install:
|
|
description: OS version to install
|
|
type: string
|
|
os_version_target:
|
|
description: OS version to target when upgrading
|
|
type: string
|
|
proxy:
|
|
description: Deploy a proxy
|
|
type: string
|
|
qase_run_id:
|
|
description: Case run ID where the results will be reported
|
|
default: auto
|
|
type: string
|
|
rancher_git_chart:
|
|
description: Point to github or rancher git for chart installation
|
|
default: rancher
|
|
type: string
|
|
rancher_upgrade:
|
|
description: Rancher Manager channel/version to upgrade to
|
|
type: string
|
|
rancher_version:
|
|
description: Rancher Manager channel/version/head_version to use
|
|
default: stable/latest
|
|
type: string
|
|
reset:
|
|
description: Allow reset test (mainly used on CLI tests)
|
|
default: false
|
|
type: boolean
|
|
runner_template:
|
|
description: Runner template to use
|
|
default: elemental-e2e-ci-runner-spot-x86-64-template-n2-standard-16-v5
|
|
type: string
|
|
selinux:
|
|
description: Use/configure SELinux
|
|
default: false
|
|
type: boolean
|
|
sequential:
|
|
description: Defines if bootstrapping is done sequentially (true) or in parallel (false)
|
|
default: false
|
|
type: boolean
|
|
snap_type:
|
|
description: Type to use for snapshot partitions (btrfs/loopdevice)
|
|
default: btrfs
|
|
type: string
|
|
test_type:
|
|
description: Type of test to run (cli/ui)
|
|
required: true
|
|
type: string
|
|
ui_account:
|
|
description: Account used to test RBAC role in UI
|
|
type: string
|
|
upgrade_from_version:
|
|
description: Elemental operator version to upgrade from
|
|
type: string
|
|
upgrade_image:
|
|
description: Image to use for the Elemental OS upgrade
|
|
type: string
|
|
upgrade_os_channel:
|
|
description: Channel to use for the Elemental OS upgrade
|
|
type: string
|
|
upgrade_type:
|
|
description: Type of upgrade to use for the Elemental OS upgrade
|
|
type: string
|
|
zone:
|
|
description: GCP zone to host the runner
|
|
default: us-central1-f
|
|
type: string
|
|
|
|
# Secrets to set when calling this reusable workflow
|
|
secrets:
|
|
credentials:
|
|
description: Credentials to use to connect
|
|
required: true
|
|
pat_token:
|
|
# A token is needed to be able to add runner on the repo, maybe this can be changed later
|
|
# This token is linked to a personal account
|
|
# So in case of token issue you have to check (no specific order and for example):
|
|
# - the expiration date
|
|
# - if the account associated still exists
|
|
# - if the person still has access to the repo
|
|
description: PAT token used to add runner
|
|
required: true
|
|
qase_api_token:
|
|
description: Qase API token to use for Qase reporting
|
|
|
|
jobs:
|
|
create-runner:
|
|
uses: ./.github/workflows/sub_create-runner.yaml
|
|
secrets:
|
|
credentials: ${{ secrets.credentials }}
|
|
pat_token: ${{ secrets.pat_token }}
|
|
with:
|
|
runner_template: ${{ inputs.runner_template }}
|
|
zone: ${{ inputs.zone }}
|
|
|
|
pre-qase:
|
|
needs: create-runner
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
|
|
QASE_PROJECT_CODE: ELEMENTAL
|
|
outputs:
|
|
qase_run_description: ${{ steps.qase.outputs.qase_run_description }}
|
|
qase_run_id: ${{ steps.qase.outputs.qase_run_id }}
|
|
qase_run_name: ${{ steps.qase.outputs.qase_run_name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache-dependency-path: tests/go.sum
|
|
go-version-file: tests/go.mod
|
|
|
|
- name: Create/Export Qase Run
|
|
id: qase
|
|
run: |
|
|
if ${{ inputs.qase_run_id == 'auto' }}; then
|
|
# Define and export URL of GH test run in Qase run description
|
|
GH_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
export QASE_RUN_DESCRIPTION="${GH_RUN_URL}"
|
|
|
|
# Define and export the Qase run name, as it cannot be done
|
|
# in 'env:' because GITHUB_WORKFLOW is a shell variable
|
|
# Export them also to be used locally
|
|
export QASE_RUN_NAME="${GITHUB_WORKFLOW}-RM_${{inputs.rancher_version}}-UP_${{inputs.k8s_upstream_version}}-DOWN_${{inputs.k8s_downstream_version}}"
|
|
|
|
# Create a Qase run, get its ID
|
|
ID=$(cd tests && make create-qase-run)
|
|
|
|
# Export outputs for future use
|
|
echo "qase_run_description=${QASE_RUN_DESCRIPTION}" >> ${GITHUB_OUTPUT}
|
|
echo "qase_run_id=${ID}" >> ${GITHUB_OUTPUT}
|
|
echo "qase_run_name=${QASE_RUN_NAME}" >> ${GITHUB_OUTPUT}
|
|
|
|
# Just an info for debugging purposes
|
|
echo -e "Exported values:\nQASE_RUN_ID=${ID}\nQASE_RUN_DESCRIPTION=${QASE_RUN_DESCRIPTION}\nQASE_RUN_NAME=${QASE_RUN_NAME}"
|
|
elif ${{ inputs.qase_run_id != '' }}; then
|
|
# If the run ID has been specified
|
|
echo "qase_run_id=${{ inputs.qase_run_id }}" >> ${GITHUB_OUTPUT}
|
|
fi
|
|
|
|
e2e:
|
|
needs: [create-runner, pre-qase]
|
|
uses: ./.github/workflows/sub_test_choice.yaml
|
|
secrets:
|
|
credentials: ${{ secrets.credentials }}
|
|
qase_api_token: ${{ secrets.qase_api_token }}
|
|
with:
|
|
backup_restore_version: ${{ inputs.backup_restore_version }}
|
|
boot_type: ${{ inputs.boot_type }}
|
|
ca_type: ${{ inputs.ca_type }}
|
|
cert-manager_version: ${{ inputs.cert-manager_version }}
|
|
cluster_name: ${{ inputs.cluster_name }}
|
|
cluster_namespace: fleet-default
|
|
cluster_number: ${{ inputs.cluster_number }}
|
|
cluster_type: ${{ inputs.cluster_type }}
|
|
cypress_tags: ${{ inputs.cypress_tags }}
|
|
destroy_runner: ${{ inputs.destroy_runner }}
|
|
elemental_ui_version: ${{ inputs.elemental_ui_version }}
|
|
force_downgrade: ${{ inputs.force_downgrade }}
|
|
full_backup_restore: ${{ inputs.full_backup_restore }}
|
|
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
|
|
node_number: ${{ inputs.node_number }}
|
|
operator_install_type: ${{ inputs.operator_install_type }}
|
|
operator_repo: ${{ inputs.operator_repo }}
|
|
operator_upgrade: ${{ inputs.operator_upgrade }}
|
|
os_to_test: ${{ inputs.os_to_test }}
|
|
os_version_install: ${{ inputs.os_version_install }}
|
|
os_version_target: ${{ inputs.os_version_target }}
|
|
proxy: ${{ inputs.proxy }}
|
|
public_domain: ${{ needs.create-runner.outputs.public_domain }}
|
|
public_fqdn: ${{ needs.create-runner.outputs.public_fqdn }}
|
|
qase_project_code: ELEMENTAL
|
|
qase_run_id: ${{ needs.pre-qase.outputs.qase_run_id }}
|
|
rancher_git_chart: ${{ inputs.rancher_git_chart }}
|
|
rancher_upgrade: ${{ inputs.rancher_upgrade }}
|
|
rancher_version: ${{ inputs.rancher_version }}
|
|
reset: ${{ inputs.reset }}
|
|
runner_label: ${{ needs.create-runner.outputs.runner_label }}
|
|
selinux: ${{ inputs.selinux }}
|
|
sequential: ${{ inputs.sequential }}
|
|
snap_type: ${{ inputs.snap_type }}
|
|
test_type: ${{ inputs.test_type }}
|
|
ui_account: ${{ inputs.ui_account }}
|
|
upgrade_from_version: ${{ inputs.upgrade_from_version }}
|
|
upgrade_image: ${{ inputs.upgrade_image }}
|
|
upgrade_os_channel: ${{ inputs.upgrade_os_channel }}
|
|
upgrade_type: ${{ inputs.upgrade_type }}
|
|
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
|
|
|
|
clean-and-delete-runner:
|
|
needs: [create-runner, e2e]
|
|
if: ${{ always() && needs.create-runner.result == 'success' && inputs.destroy_runner == true }}
|
|
uses: ./.github/workflows/sub_clean-and-delete-runner.yaml
|
|
secrets:
|
|
credentials: ${{ secrets.credentials }}
|
|
with:
|
|
runner_hostname: ${{ needs.create-runner.outputs.runner_hostname }}
|
|
zone: ${{ inputs.zone }}
|
|
|
|
post-qase:
|
|
needs: [pre-qase, e2e]
|
|
if: ${{ always() && needs.pre-qase.outputs.qase_run_id != '' }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
|
|
QASE_PROJECT_CODE: ELEMENTAL
|
|
QASE_REPORT: 1
|
|
QASE_RUN_COMPLETE: 1
|
|
QASE_RUN_ID: ${{ needs.pre-qase.outputs.qase_run_id }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
cache-dependency-path: tests/go.sum
|
|
go-version-file: tests/go.mod
|
|
|
|
- name: Finalize Qase Run and publish Results
|
|
if: ${{ !contains(needs.e2e.outputs.steps_status, 'cancelled') }}
|
|
run: |
|
|
REPORT=$(cd tests && make publish-qase-run)
|
|
echo "${REPORT}"
|
|
|
|
# Extract report URL and put it in summary
|
|
REPORT_URL=$(awk '/available:/ { print $NF }' <<<${REPORT})
|
|
if [[ -n "${REPORT_URL}" ]]; then
|
|
echo "## QASE Reporting" >> ${GITHUB_STEP_SUMMARY}
|
|
echo "Public Qase report: ${REPORT_URL}" >> ${GITHUB_STEP_SUMMARY}
|
|
fi
|
|
|
|
- name: Delete Qase Run if job has been cancelled
|
|
if: ${{ contains(needs.e2e.outputs.steps_status, 'cancelled') }}
|
|
run: cd tests && make delete-qase-run
|