Skip to content

Commit

Permalink
ci: use new master(s) workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Feb 1, 2024
1 parent cb2e21e commit f931cc6
Show file tree
Hide file tree
Showing 9 changed files with 832 additions and 700 deletions.
165 changes: 76 additions & 89 deletions .github/actions/logs-and-summary/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,87 +2,77 @@
name: logs-and-summary
description: 'Add logs and summary for an Elemental E2E test'

# Action inputs
# Variables to set when calling this action
inputs:
ca_type:
description: CA type to use (selfsigned or private)
default: selfsigned
type: string
elemental_support:
description: URL of the elemental support binary
default: https://github.com/rancher/elemental-operator/releases/download/v1.1.4/elemental-support_1.1.4_linux_amd64
type: string
elemental_ui_version:
description: Version of the elemental ui which will be installed (dev/stable)
default: dev
type: string
k8s_version_to_provision:
description: Name and version of installed K8s distribution
required: true
type: string
node_number:
description: Number of nodes to deploy on the provisioned cluster
default: 5
type: string
os_to_test:
description: OS repository to test (dev/staging/stable)
type: string
default: dev
proxy:
description: Deploy a proxy
type: string
rancher_log_collector:
description: URL of the Rancher log collector script
default: https://raw.githubusercontent.com/rancherlabs/support-tools/master/collection/rancher/v2.x/logs-collector/rancher2_logs_collector.sh
type: string
rancher_version:
description: Rancher Manager channel/version/head_version to use for installation
default: stable/latest/none
type: string
sequential:
description: Defines if bootstrapping is done sequentially (true) or in parallel (false)
default: false
type: boolean
test_description:
description: Short description of the test
type: string
test_type:
description: Type of test to run (cli or ui)
default: single_cli
type: string
ui_account:
description: Account used to test RBAC role in UI
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
# Secrets inputs!
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 Cypress tests
backup_restore_version:
default: "Unknown"
type: string
ca_type:
default: "Unknown"
type: string
cert_manager_version:
default: "Unknown"
type: string
elemental_ui_version:
default: "Unknown"
type: string
image_tag:
default: "Unknown"
type: string
k8s_version_to_provision:
default: "Unknown"
type: string
node_number:
default: "Unknown"
type: string
operator_upgrade:
default: "Unknown"
type: string
operator_version:
default: "Unknown"
type: string
os_to_test:
default: "Unknown"
type: string
os_version:
default: "Unknown"
type: string
proxy:
default: "Unknown"
type: string
rancher_image_version:
default: "Unknown"
type: string
rancher_version:
default: "Unknown"
type: string
sequential:
default: "Unknown"
type: boolean
test_description:
default: "Unknown"
type: string
test_type:
default: "Unknown"
type: string
ui_account:
default: "Unknown"
type: string
upgrade_image:
default: "Unknown"
type: string
upgrade_os_channel:
default: "Unknown"
type: string

runs:
using: "composite"
steps:
- name: Get logs
env:
ELEMENTAL_SUPPORT: ${{ inputs.elemental_support }}
ELEMENTAL_SUPPORT: https://github.com/rancher/elemental-operator/releases/download/v1.3.4/elemental-support_1.3.4_linux_amd64
PROXY: ${{ inputs.proxy }}
RANCHER_LOG_COLLECTOR: ${{ inputs.rancher_log_collector }}
RANCHER_LOG_COLLECTOR: https://raw.githubusercontent.com/rancherlabs/support-tools/master/collection/rancher/v2.x/logs-collector/rancher2_logs_collector.sh
shell: bash
run: |
cd tests && (
Expand All @@ -100,6 +90,7 @@ runs:
if-no-files-found: ignore

- name: Add summary
if: ${{ always() }}
shell: bash
run: |
# Define some variable(s)
Expand All @@ -123,32 +114,28 @@ runs:
echo "Type of cluster deployed: ${CLUSTER_TYPE:-normal}" >> ${GITHUB_STEP_SUMMARY}
echo "Bootstrap method: ${BOOTSTRAP_METHOD}" >> ${GITHUB_STEP_SUMMARY}
echo "### Rancher Manager" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Image: ${{ steps.component.outputs.rm_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Image: ${{ inputs.rancher_image_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Version: ${{ inputs.rancher_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "CertManager Image: ${{ steps.component.outputs.cert_manager_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "CertManager Image: ${{ inputs.cert_manager_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "### Elemental" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental ISO image: ${{ inputs.os_to_test }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental OS version: ${{ steps.iso_version.outputs.image_tag }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Image: ${{ steps.component.outputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Backup/Restore Operator Image: ${{ steps.component.outputs.backup_restore_version }}" >> ${GITHUB_STEP_SUMMARY}
if ${{ inputs.elemental_ui_version != '' }}; then
echo "Elemental UI Extension Version: ${{ inputs.elemental_ui_version }}" >> ${GITHUB_STEP_SUMMARY}
fi
if ${{ inputs.ui_account != '' }}; then
echo "Elemental UI User: ${{ inputs.ui_account }}" >> ${GITHUB_STEP_SUMMARY}
fi
echo "Elemental OS version: ${{ inputs.os_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Image: ${{ inputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Backup/Restore Operator Image: ${{ inputs.backup_restore_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental UI Extension Version: ${{ inputs.elemental_ui_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental UI User: ${{ inputs.ui_account }}" >> ${GITHUB_STEP_SUMMARY}
echo "### Kubernetes" >> ${GITHUB_STEP_SUMMARY}
echo "K3s on Rancher Manager: ${{ env.INSTALL_K3S_VERSION }}" >> ${GITHUB_STEP_SUMMARY}
echo "K8s version deployed on the cluster(s): ${{ inputs.k8s_version_to_provision }}" >> ${GITHUB_STEP_SUMMARY}
echo "### Cluster nodes" >> ${GITHUB_STEP_SUMMARY}
echo "Number of CPU: ${VCPU:-unknown}" >> ${GITHUB_STEP_SUMMARY}
echo "Memory size: ${VMEM:-unknown}GB" >> ${GITHUB_STEP_SUMMARY}
echo "Number of CPU: ${VCPU:-Unknown}" >> ${GITHUB_STEP_SUMMARY}
echo "Memory size: ${VMEM:-Unknown}GB" >> ${GITHUB_STEP_SUMMARY}
# Upgrade details
if ${{ inputs.upgrade_image != '' || inputs.upgrade_os_channel != '' }}; then
echo "## Upgrade details" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Upgrade: ${{ steps.operator_upgrade.outputs.operator_upgrade }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Image: ${{ steps.operator_upgrade.outputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Image: ${{ steps.rancher_upgrade.outputs.rm_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Upgrade: ${{ inputs.operator_upgrade }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Image: ${{ inputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Image: ${{ inputs.rancher_image_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Rancher Manager Version: ${{ inputs.rancher_upgrade }}" >> ${GITHUB_STEP_SUMMARY}
echo "Channel: ${{ inputs.upgrade_os_channel }}" >> ${GITHUB_STEP_SUMMARY}
echo "Upgrade image: ${{ inputs.upgrade_image }}" >> ${GITHUB_STEP_SUMMARY}
Expand Down
54 changes: 12 additions & 42 deletions .github/workflows/master_clean-and-delete-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,64 @@ name: (template) Clean and delete GitHub Actions runner on GCP

on:
workflow_call:
# Jobs inputs
# Variables to set when calling this reusable workflow
inputs:
create_runner_result:
description: Status of the create-runner job
required: true
type: string
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
required: true
type: boolean
qase_run_id:
description: Case run ID where the results will be reported
type: string
runner:
description: Name of the GCP runner
runner_hostname:
required: true
type: string
steps_status:
description: Status of all the steps from the previous job
required: true
type: string
uuid:
description: UUID of the GitHub runner
runner_label:
required: true
type: string
zone:
description: GCP zone to host the runner
default: us-central1-a
required: true
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 Cypress tests

jobs:
clean-delete:
runs-on: ubuntu-latest
# Don't block if a step fails
continue-on-error: true
env:
# QASE variables
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
QASE_PROJECT_CODE: ELEMENTAL
QASE_RUN_ID: ${{ inputs.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: ${{ env.QASE_RUN_ID != '' && !contains(inputs.steps_status, 'cancelled') }}
run: cd tests && make publish-qase-run
- name: Delete Qase Run if job has been cancelled
if: ${{ env.QASE_RUN_ID != '' && contains(inputs.steps_status, 'cancelled') }}
run: cd tests && make delete-qase-run

- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.credentials }}

- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v2

- name: Delete GCP secrets
run: |
for SECRET in PAT_TOKEN GH_REPO; do
gcloud --quiet secrets delete ${SECRET}_${{ inputs.uuid }} || true
gcloud --quiet secrets delete ${SECRET}_${{ inputs.runner_label }} || true
done
- name: Delete runner
if: ${{ inputs.create_runner_result == 'success' && inputs.destroy_runner == true }}
run: |
# Disable failure on first error, needed for the "delete" check
set +e
# If runner is already deleted we can bypass the error
if ! LOGS=$(gcloud --quiet compute instances delete ${{ inputs.runner }} \
if ! LOGS=$(gcloud --quiet compute instances delete ${{ inputs.runner_hostname }} \
--delete-disks all \
--zone ${{ inputs.zone }} 2>&1); then
echo "${LOGS}" | grep -q "resource .* was not found" || RC=1
Expand Down
Loading

0 comments on commit f931cc6

Please sign in to comment.