Files
wlan-testing/.github/workflows/manual_reports_to_s3.yml
Jitendrakumar Kushavah 155ba95f0d Workflow for upload local allure report to s3 (#1055)
* Added workflow file for upload manual allure report to s3 for testing purpose

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>

* Modified the file as per existing code stucture

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>

* Added code for upload manual report to S3

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>

* Added option for multiple drive links

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>

* Modified the description

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>

---------

Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>
2025-07-04 12:10:31 +05:30

132 lines
4.7 KiB
YAML

name: Manual reports to s3
env:
# AWS credentials
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: ap-south-1
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# Validation lists
ALLOWED_USERS: "Jitendra,User2,User3"
ALLOWED_TEST_TYPES: "sanity,regression,performance,custom_tests"
APPROVED_AP_MODELS: "cig_wf186h,edgecore_eap104,cig_wf196,udaya_a6-id2,sonicfi_rap630c-311g,hfcl_ion4xe,yuncore_fap655,cig_wf189,edgecore_eap105,sonicfi_rap7110c-341x,edgecore_eap101,edgecore_eap111"
on:
workflow_dispatch:
inputs:
drive_link:
description: 'Drive link to Allure report .zip'
required: true
user_name:
description: 'User name'
required: true
default: 'Jitendra'
test_type:
description: 'Test type (sanity/regression/performance/custom_tests)'
required: true
default: 'sanity'
AP_model:
description: 'AP model'
required: true
default: "cig_wf196"
jobs:
validate-inputs:
runs-on: ubuntu-latest
outputs:
is_valid: ${{ steps.validation.outputs.is_valid }}
steps:
- name: Validate inputs
id: validation
run: |
if [[ ! ",${{ env.ALLOWED_USERS }}," =~ ",${{ inputs.user_name }}," ]]; then
echo "::error::User ${{ inputs.user_name }} not allowed!"
echo "is_valid=false" >> $GITHUB_OUTPUT
exit 1
fi
if [[ ! ",${{ env.ALLOWED_TEST_TYPES }}," =~ ",${{ inputs.test_type }}," ]]; then
echo "::error::Invalid test type. Allowed: ${{ env.ALLOWED_TEST_TYPES }}"
echo "is_valid=false" >> $GITHUB_OUTPUT
exit 1
fi
if [[ ! ",${{ env.APPROVED_AP_MODELS }}," =~ ",${{ inputs.AP_model }}," ]]; then
echo "::error::Invalid AP model. Allowed: ${{ env.APPROVED_AP_MODELS }}"
echo "is_valid=false" >> $GITHUB_OUTPUT
exit 1
fi
echo "is_valid=true" >> $GITHUB_OUTPUT
process-report:
needs: validate-inputs
if: needs.validate-inputs.outputs.is_valid == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download report
run: |
# Handle Google Drive links
if [[ "${{ inputs.drive_link }}" == *"drive.google.com"* ]]; then
FILE_ID=$(echo "${{ inputs.drive_link }}" | sed -n -e 's/^.*d\/\([^\/]*\)\/.*$/\1/p')
curl -L -o allure-report.zip "https://drive.google.com/uc?export=download&id=${FILE_ID}" || {
echo "::error::Failed to download from Google Drive"
exit 1
}
# Handle OneDrive/SharePoint links
elif [[ "${{ inputs.drive_link }}" == *"onedrive.live.com"* ]] || [[ "${{ inputs.drive_link }}" == *"sharepoint.com"* ]]; then
curl -L -o allure-report.zip "${{ inputs.drive_link }}" | sed 's/.*\(https:\/\/[^"]*\).*/\1/' | head -1 | xargs curl -L -o allure-report.zip || {
echo "::error::Failed to download from OneDrive/SharePoint"
exit 1
}
# Handle Dropbox links
elif [[ "${{ inputs.drive_link }}" == *"dropbox.com"* ]]; then
curl -L -o allure-report.zip "${url%?dl=0}?dl=1" || {
echo "::error::Failed to download from Dropbox"
exit 1
}
# Handle other direct download links
else
curl -L -o allure-report.zip "${{ inputs.drive_link }}" || {
echo "::error::Failed to download from provided URL"
exit 1
}
fi
unzip -t allure-report.zip || {
echo "::error::Invalid ZIP file"
exit 1
}
- name: Extract report
run: |
unzip -q allure-report.zip -d allure-report
rm allure-report.zip
- name: Verify report structure
run: |
if [ ! -f "allure-report/index.html" ]; then
echo "::error::Extracted folder doesn't contain valid Allure report"
exit 1
fi
- name: Upload report as artifact
uses: actions/upload-artifact@v4
with:
name: allure-report
path: allure-report
- name: Upload to S3
uses: ./.github/actions/manual-allure-report-to-s3
with:
test_type: ${{ inputs.test_type }}
testbed: ${{ inputs.AP_model }}
report_path: allure-report
s3_access_key_id: ${{ secrets.ALLURE_S3_ACCESS_KEY_ID }}
s3_access_key_secret: ${{ secrets.ALLURE_S3_ACCESS_KEY_SECRET }}
username: ${{ inputs.user_name }}