Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to run tests on available Rancher Manager #65

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 16 additions & 22 deletions .github/workflows/aks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow calls the main workflow with custom variables
name: AKS-E2E
run-name: AKS ${{ inputs.downstream_k8s_version }} on Rancher v${{ inputs.rancher_version }} deployed on ${{ inputs.k3s_version}}
run-name: AKS ${{ inputs.downstream_k8s_version || '1.26.6' }} on Rancher v${{ inputs.rancher_version || '2.8-head' }} deployed on ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}

on:
schedule:
Expand All @@ -22,22 +22,6 @@ on:
default: true
required: true
type: boolean
run_p0_provisioning_tests:
required: true
default: true
type: boolean
run_p0_importing_tests:
required: true
default: true
type: boolean
run_support_matrix_provisioning_tests:
required: true
default: false
type: boolean
run_support_matrix_importing_tests:
required: true
default: false
type: boolean
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
Expand All @@ -49,6 +33,15 @@ on:
downstream_k8s_version:
description: Downstream cluster K8s version to test
default: 1.26.6
rancher_installed:
description: Rancher details if already installed
default: 'hostname/password'
type: string
tests_to_run:
description: Tests to run (p0_provisioning/p0_importing/support_matrix_provisioning/support_matrix_importing)
type: string
required: true
default: p0_provisioning/p0_importing

jobs:
aks-e2e:
Expand All @@ -59,10 +52,11 @@ jobs:
rancher_version: ${{ inputs.rancher_version || '2.8-head' }}
k3s_version: ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}
operator_nightly_chart: ${{ inputs.operator_nightly_chart == true || (github.event_name == 'schedule' && true) }}
run_p0_provisioning_tests: ${{ inputs.run_p0_provisioning_tests == true || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ inputs.run_p0_importing_tests == true || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ inputs.run_support_matrix_provisioning_tests == true || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ inputs.run_support_matrix_importing_tests == true || (github.event_name == 'schedule' && false) }}
destroy_runner: ${{ inputs.destroy_runner ==true || (github.event_name == 'schedule' && true) }}
run_p0_provisioning_tests: ${{ contains(inputs.tests_to_run, 'p0_provisioning') || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ contains(inputs.tests_to_run, 'p0_importing') || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_provisioning') || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_importing') || (github.event_name == 'schedule' && false) }}
destroy_runner: ${{ inputs.destroy_runner == true || (github.event_name == 'schedule' && true) }}
runner_template: ${{ inputs.runner_template || 'hosted-prov-e2e-ci-runner-spot-n2-highmem-16-gl-template-v1' }}
downstream_k8s_version: ${{ inputs.downstream_k8s_version || '1.26.6' }}
rancher_installed: ${{ inputs.rancher_installed || 'hostname/password' }}
37 changes: 16 additions & 21 deletions .github/workflows/eks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow calls the main workflow with custom variables
name: EKS-E2E
run-name: EKS ${{ inputs.downstream_k8s_version }} on Rancher v${{ inputs.rancher_version }} deployed on ${{ inputs.k3s_version}}
run-name: EKS ${{ inputs.downstream_k8s_version || '1.26' }} on Rancher v${{ inputs.rancher_version || '2.8-head' }} deployed on ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}

on:
schedule:
Expand All @@ -22,22 +22,6 @@ on:
default: true
required: true
type: boolean
run_p0_provisioning_tests:
required: true
default: true
type: boolean
run_p0_importing_tests:
required: true
default: true
type: boolean
run_support_matrix_provisioning_tests:
required: true
default: false
type: boolean
run_support_matrix_importing_tests:
required: true
default: false
type: boolean
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
Expand All @@ -49,6 +33,16 @@ on:
downstream_k8s_version:
description: Downstream cluster K8s version to test
default: 1.26
rancher_installed:
description: Rancher details if already installed
default: 'hostname/password'
type: string
tests_to_run:
description: Tests to run (p0_provisioning/p0_importing/support_matrix_provisioning/support_matrix_importing)
type: string
required: true
default: p0_provisioning/p0_importing

jobs:
eks-e2e:
uses: ./.github/workflows/main.yaml
Expand All @@ -58,10 +52,11 @@ jobs:
rancher_version: ${{ inputs.rancher_version || '2.8-head' }}
k3s_version: ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}
operator_nightly_chart: ${{ inputs.operator_nightly_chart == true || (github.event_name == 'schedule' && true) }}
run_p0_provisioning_tests: ${{ inputs.run_p0_provisioning_tests == true || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ inputs.run_p0_importing_tests == true || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ inputs.run_support_matrix_provisioning_tests == true || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ inputs.run_support_matrix_importing_tests == true || (github.event_name == 'schedule' && false) }}
run_p0_provisioning_tests: ${{ contains(inputs.tests_to_run, 'p0_provisioning') || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ contains(inputs.tests_to_run, 'p0_importing') || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_provisioning') || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_importing') || (github.event_name == 'schedule' && false) }}
destroy_runner: ${{ inputs.destroy_runner ==true || (github.event_name == 'schedule' && true) }}
runner_template: ${{ inputs.runner_template || 'hosted-prov-e2e-ci-runner-spot-n2-highmem-16-gl-template-v1' }}
downstream_k8s_version: ${{ inputs.downstream_k8s_version || '1.26' }}
rancher_installed: ${{ inputs.rancher_installed || 'hostname/password' }}
36 changes: 15 additions & 21 deletions .github/workflows/gke.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow calls the main workflow with custom variables
name: GKE-E2E
run-name: GKE ${{ inputs.downstream_k8s_version }} on Rancher v${{ inputs.rancher_version }} deployed on ${{ inputs.k3s_version}}
run-name: GKE ${{ inputs.downstream_k8s_version || '1.27.3-gke.100' }} on Rancher v${{ inputs.rancher_version || '2.8-head' }} deployed on ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}

on:
schedule:
Expand All @@ -22,22 +22,6 @@ on:
default: true
required: true
type: boolean
run_p0_provisioning_tests:
required: true
default: true
type: boolean
run_p0_importing_tests:
required: true
default: true
type: boolean
run_support_matrix_provisioning_tests:
required: true
default: false
type: boolean
run_support_matrix_importing_tests:
required: true
default: false
type: boolean
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
Expand All @@ -49,6 +33,15 @@ on:
downstream_k8s_version:
description: Downstream cluster K8s version to test
default: 1.27.3-gke.100
rancher_installed:
description: Rancher details if already installed
default: 'hostname/password'
type: string
tests_to_run:
description: Tests to run (p0_provisioning/p0_importing/support_matrix_provisioning/support_matrix_importing)
type: string
required: true
default: p0_provisioning/p0_importing

jobs:
gke-e2e:
Expand All @@ -59,10 +52,11 @@ jobs:
rancher_version: ${{ inputs.rancher_version || '2.8-head' }}
k3s_version: ${{ inputs.k3s_version || 'v1.27.9+k3s1' }}
operator_nightly_chart: ${{ inputs.operator_nightly_chart == true || (github.event_name == 'schedule' && true) }}
run_p0_provisioning_tests: ${{ inputs.run_p0_provisioning_tests == true || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ inputs.run_p0_importing_tests == true || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ inputs.run_support_matrix_provisioning_tests == true || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ inputs.run_support_matrix_importing_tests == true || (github.event_name == 'schedule' && false) }}
run_p0_provisioning_tests: ${{ contains(inputs.tests_to_run, 'p0_provisioning') || (github.event_name == 'schedule' && true) }}
run_p0_importing_tests: ${{ contains(inputs.tests_to_run, 'p0_importing') || (github.event_name == 'schedule' && true) }}
run_support_matrix_provisioning_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_provisioning') || (github.event_name == 'schedule' && false) }}
run_support_matrix_importing_tests: ${{ contains(inputs.tests_to_run, 'support_matrix_importing') || (github.event_name == 'schedule' && false) }}
destroy_runner: ${{ inputs.destroy_runner ==true || (github.event_name == 'schedule' && true) }}
runner_template: ${{ inputs.runner_template || 'hosted-prov-e2e-ci-runner-spot-n2-highmem-16-gl-template-v1' }}
downstream_k8s_version: ${{ inputs.downstream_k8s_version || '1.27.3-gke.100' }}
rancher_installed: ${{ inputs.rancher_installed || 'hostname/password' }}
40 changes: 34 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
description: Install hosted-provider nightly chart
required: true
type: boolean
rancher_installed:
description: Rancher details if already installed
type: string
run_p0_provisioning_tests:
required: true
type: boolean
Expand Down Expand Up @@ -111,14 +114,26 @@ jobs:
- name: Get Runner IP
id: runner-ip
run: echo "PUBLIC_IP=$(curl -s ifconfig.co)" >> "$GITHUB_OUTPUT"


- name: Set Rancher hostname / password
run: |
if [ ${{ inputs.rancher_installed }} != 'hostname/password' ]; then
echo RANCHER_HOSTNAME="$(echo ${{ inputs.rancher_installed }} | cut -d'/' -f1)" >> ${GITHUB_ENV}
echo RANCHER_PASSWORD="$(echo ${{ inputs.rancher_installed }} | cut -d'/' -f2)" >> ${GITHUB_ENV}
else
echo RANCHER_HOSTNAME=${{ steps.runner-ip.outputs.PUBLIC_IP }}.sslip.io >> $GITHUB_ENV
echo RANCHER_PASSWORD=${{ secrets.RANCHER_PASSWORD }} >> $GITHUB_ENV
fi

- name: Install K3s / Helm / Rancher
if: ${{ inputs.rancher_installed == 'hostname/password' }}
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
HELM_VERSION: 3.13.1
K3S_VERSION: ${{ inputs.k3s_version }}
RANCHER_VERSION: ${{ inputs.rancher_version }}
RANCHER_HOSTNAME: ${{steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
RANCHER_HOSTNAME: ${{ env.RANCHER_HOSTNAME }}
RANCHER_PASSWORD: ${{ env.RANCHER_PASSWORD }}
run: |
if [ ${{ inputs.operator_nightly_chart }} == true ]; then
make prepare-e2e-ci-rancher-hosted-nightly-chart
Expand Down Expand Up @@ -167,31 +182,35 @@ jobs:
- name: Provisioning cluster tests
if: ${{ inputs.run_p0_provisioning_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
RANCHER_HOSTNAME: ${{ env.RANCHER_HOSTNAME }}
RANCHER_PASSWORD: ${{ env.RANCHER_PASSWORD }}
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-provisioning.yaml
run: |
make e2e-provisioning-tests

- name: Importing cluster tests
if: ${{ !cancelled() && inputs.run_p0_importing_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
RANCHER_HOSTNAME: ${{ env.RANCHER_HOSTNAME }}
RANCHER_PASSWORD: ${{ env.RANCHER_PASSWORD }}
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-import.yaml
run: |
make e2e-import-tests

- name: Support matrix provisioning tests
if: ${{ !cancelled() && inputs.run_support_matrix_provisioning_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
RANCHER_HOSTNAME: ${{ env.RANCHER_HOSTNAME }}
RANCHER_PASSWORD: ${{ env.RANCHER_PASSWORD }}
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-provisioning.yaml
run: |
make e2e-support-matrix-provisioning-tests

- name: Support matrix importing tests
if: ${{ !cancelled() && inputs.run_support_matrix_importing_tests == true }}
env:
RANCHER_HOSTNAME: ${{ steps.runner-ip.outputs.PUBLIC_IP}}.sslip.io
RANCHER_HOSTNAME: ${{ env.RANCHER_HOSTNAME }}
RANCHER_PASSWORD: ${{ env.RANCHER_PASSWORD }}
CATTLE_TEST_CONFIG: ${{ github.workspace }}/cattle-config-import.yaml
run: |
make e2e-support-matrix-importing-tests
Expand All @@ -210,6 +229,15 @@ jobs:
path: ${{ github.workspace }}/logs/*
if-no-files-found: ignore

- name: Add summary
if: ${{ always() }}
run: |
# Add summary
echo "## General information" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Version: ${{ inputs.rancher_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "K3s on Rancher Manager: ${{ inputs.k3s_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Downstream ${{ inputs.hosted_provider }} version: ${{ inputs.downstream_k8s_version }}" >> ${GITHUB_STEP_SUMMARY}

delete-runner:
if: ${{ always() && inputs.destroy_runner == true }}
needs: [create-runner, installation-and-e2e-tests]
Expand Down
2 changes: 1 addition & 1 deletion hosted/helpers/helper_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/rancher/shepherd/extensions/clusters/aks"
"github.com/rancher/shepherd/extensions/clusters/eks"
"github.com/rancher/shepherd/extensions/clusters/gke"
"github.com/rancher/shepherd/extensions/pipeline"

. "github.com/onsi/gomega"
"github.com/rancher/shepherd/clients/rancher"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/rancher/shepherd/extensions/cloudcredentials/google"
"github.com/rancher/shepherd/extensions/clusters"
"github.com/rancher/shepherd/extensions/defaults"
"github.com/rancher/shepherd/extensions/pipeline"
"github.com/rancher/shepherd/pkg/config"
"github.com/rancher/shepherd/pkg/session"
"github.com/rancher/shepherd/pkg/wait"
Expand Down
Loading