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

Create an extra WF for PR CI runs only and do not push to QASE #56

Merged
merged 1 commit into from
Feb 27, 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
59 changes: 36 additions & 23 deletions .github/workflows/master-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ on:
type: boolean
qase_run_id:
description: Case run ID where the results will be reported
default: auto
type: string
rancher_version:
description: Rancher Manager channel/version/head_version to use for installation
Expand Down Expand Up @@ -139,31 +138,38 @@ jobs:
- 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 }}"
QASE_DESC="${{ inputs.test_description }} (${GH_RUN_URL})"
export QASE_RUN_DESCRIPTION="${QASE_DESC}"
case ${{ inputs.qase_run_id }} in
'auto')
# 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 }}"
QASE_DESC="${{ inputs.test_description }} (${GH_RUN_URL})"
export QASE_RUN_DESCRIPTION="${QASE_DESC}"

# 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}"
# 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}"

# Create a Qase run, get its ID
ID=$(cd tests && make create-qase-run)
# Create a Qase run, get its ID
ID=$(cd tests && make create-qase-run)

# Export outputs for future use
echo "qase_run_description=${QASE_DESC}" >> ${GITHUB_OUTPUT}
echo "qase_run_id=${ID}" >> ${GITHUB_OUTPUT}
echo "qase_run_name=${GITHUB_WORKFLOW}" >> ${GITHUB_OUTPUT}
# Export outputs for future use
echo "qase_run_description=${QASE_DESC}" >> ${GITHUB_OUTPUT}
echo "qase_run_id=${ID}" >> ${GITHUB_OUTPUT}
echo "qase_run_name=${GITHUB_WORKFLOW}" >> ${GITHUB_OUTPUT}

# Just an info for debugging purposes
echo -e "Exported values:\nQASE_RUN_ID=${ID}\nQASE_RUN_DESCRIPTION=${QASE_DESC}\nQASE_RUN_NAME=${GITHUB_WORKFLOW}"
elif ${{ inputs.qase_run_id != '' }}; then
# If the run ID has been specified
echo "qase_run_id=${{ inputs.qase_run_id }}" >> ${GITHUB_OUTPUT}
fi
# Just an info for debugging purposes
echo -e "Exported values:\nQASE_RUN_ID=${ID}\nQASE_RUN_DESCRIPTION=${QASE_DESC}\nQASE_RUN_NAME=${GITHUB_WORKFLOW}"
;;
'none')
echo "qase_run_id=" >> ${GITHUB_OUTPUT}
echo "### Test not reported in QASE!" >> ${GITHUB_STEP_SUMMARY}
;;
[0-9]*)
# If the run ID has been specified
echo "qase_run_id=${{ inputs.qase_run_id }}" >> ${GITHUB_OUTPUT}
;;
esac

e2e:
needs: [create-runner, pre-qase]
Expand Down Expand Up @@ -235,7 +241,14 @@ jobs:
SPEC: |
/workdir/e2e/unit_tests/first_login_rancher.spec.ts
/workdir/e2e/unit_tests/p0_fleet.spec.ts
run: cd tests && make start-cypress-tests
run: |
if ${{ inputs.qase_run_id == 'none' }}; then
# Unset default QASE_* variables when reporting is disabled
unset QASE_REPORT
unset QASE_API_TOKEN
# QASE_RUN_ID is empty string already
fi
cd tests && make start-cypress-tests
- name: Upload Cypress screenshots (Basics)
if: failure()
uses: actions/upload-artifact@v3
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/ui-pr_rm_head_2.8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow calls the master E2E workflow with custom variables
name: UI-Pull-Request_RM_head_2.8

on:
pull_request:
branches: [ main ]
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- 'README.md'

jobs:
ui:
uses: ./.github/workflows/master-e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
pat_token: ${{ secrets.SELF_HOSTED_RUNNER_PAT_TOKEN }}
rancher_password: ${{ secrets.RANCHER_PASSWORD }}
gitlab_private_user: ${{ secrets.GITLAB_PRIVATE_USER }}
gitlab_private_pwd: ${{ secrets.GITLAB_PRIVATE_PWD }}
qase_api_token: ${{ secrets.QASE_API_TOKEN }}
with:
test_description: "CI test for PR#${{ github.event.pull_request.number }} with K3s"
cluster_name: cluster-k3s
# WARNING, VALUES BELOW ARE HARDCODED FOR RUNS SCHEDULED BY PULL_REQUEST EVENT
destroy_runner: true
upstream_cluster_version: 'v1.27.10+k3s2'
rancher_version: 'devel/2.8'
# If qase_run_id is none the run is getting deleted in QASE
qase_run_id: 'none'
9 changes: 0 additions & 9 deletions .github/workflows/ui-rm_head_2.8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
name: UI-RM_head_2.8

on:
pull_request:
branches: [ main ]
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- 'README.md'
workflow_dispatch:
inputs:
qase_run_id:
Expand Down
Loading