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 Jan 31, 2024
1 parent 90e9831 commit d758c89
Show file tree
Hide file tree
Showing 8 changed files with 627 additions and 664 deletions.
102 changes: 31 additions & 71 deletions .github/actions/logs-and-summary/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,38 @@
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
ca_type:
type: string
elemental_support:
type: string
elemental_ui_version:
type: string
k8s_version_to_provision:
type: string
node_number:
type: string
os_to_test:
type: string
proxy:
type: string
rancher_log_collector:
type: string
rancher_version:
type: string
sequential:
type: boolean
test_description:
type: string
test_type:
type: string
ui_account:
type: string
upgrade_image:
type: string
upgrade_os_channel:
type: string

runs:
using: "composite"
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 d758c89

Please sign in to comment.