chore(deps): update npm (major) #1943
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TAs Regression Test | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
pull_request: | |
branches: | |
- "**" | |
workflow_dispatch: | |
inputs: | |
target_repo: | |
description: "TA repository (leave empty to test all TAs)" | |
required: false | |
default: "" | |
target_branch: | |
description: "TA repository branch" | |
required: false | |
default: "main" | |
splunktaucclib_branch: | |
description: "Branch of splunk/addonfactory-ucc-library to use (leave empty to use latest from PyPI)" | |
required: false | |
default: "" | |
jobs: | |
build-ucc: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout UCC Framework Repository | |
uses: actions/checkout@v4 | |
with: | |
path: UCC | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.7" | |
- name: Install Poetry 1.5.1 | |
run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1 | |
- name: Install Poetry Dependencies | |
working-directory: UCC | |
run: poetry install | |
- name: Build UCC Framework Package | |
working-directory: UCC | |
run: poetry build | |
- name: Upload UCC Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ucc-package-whl | |
path: UCC/dist/*.whl | |
determine-repos: | |
# This job determines the repositories to run tests on based on the event type and inputs | |
runs-on: ubuntu-22.04 | |
outputs: | |
repos: ${{ steps.set-repos.outputs.repos }} | |
steps: | |
- id: set-repos | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && -n "${{ github.event.inputs.target_repo }}" ]]; then | |
echo "repos=[\"${{ github.event.inputs.target_repo }}\"]" >> $GITHUB_OUTPUT | |
else | |
echo "repos<<EOF" >> $GITHUB_OUTPUT | |
echo '[ | |
"splunk/splunk-add-on-for-amazon-web-services", | |
"splunk/splunk-add-on-for-google-cloud-platform", | |
"splunk/splunk-add-on-for-google-workspace", | |
"splunk/splunk-add-on-for-microsoft-cloud-services", | |
"splunk/splunk-add-on-for-microsoft-office-365", | |
"splunk/splunk-add-on-for-salesforce", | |
"splunk/splunk-add-on-for-servicenow", | |
"splunk/splunk-add-on-for-mysql", | |
"splunk/splunk-add-on-for-cisco-asa", | |
"splunk/splunk-add-on-for-unix-and-linux" | |
]' >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
fi | |
test-addons: | |
needs: [ build-ucc, determine-repos ] | |
strategy: | |
matrix: | |
target_repo: ${{ fromJSON(needs.determine-repos.outputs.repos) }} | |
continue-on-error: true | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout Target Add-on Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.target_repo }} | |
path: TA | |
token: ${{ secrets.GH_TOKEN_ADMIN }} | |
ref: ${{ github.event.inputs.target_branch }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.7" | |
- name: Install Poetry 1.5.1 | |
run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1 | |
- name: Download UCC Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ucc-package-whl | |
path: UCC | |
- name: Install Dependencies in Target Add-on | |
working-directory: TA | |
run: | | |
UCC_WHL=$(ls ../UCC/*.whl) | |
# https://github.com/python-poetry/poetry/issues/7491#issuecomment-1423763839 | |
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf https://github.com | |
git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf ssh://[email protected] | |
# Retry logic for poetry install | |
MAX_RETRIES=3 | |
RETRY_COUNT=0 | |
until [ $RETRY_COUNT -ge $MAX_RETRIES ] | |
do | |
poetry add ../UCC/$UCC_WHL --group dev && break | |
RETRY_COUNT=$((RETRY_COUNT+1)) | |
echo "Poetry install failed, retry attempt $RETRY_COUNT of $MAX_RETRIES" | |
sleep 5 | |
done | |
# Install splunktaucclib with retries | |
RETRY_COUNT=0 | |
until [ $RETRY_COUNT -ge $MAX_RETRIES ] | |
do | |
if [[ -n "${{ github.event.inputs.splunktaucclib_branch }}" ]]; then | |
echo "Installing splunktaucclib from branch ${{ github.event.inputs.splunktaucclib_branch }}" | |
poetry add git+https://github.com/splunk/addonfactory-ucc-library.git@${{ github.event.inputs.splunktaucclib_branch }} && break | |
else | |
echo "Installing latest splunktaucclib from PyPI" | |
poetry add splunktaucclib@latest && break | |
fi | |
RETRY_COUNT=$((RETRY_COUNT+1)) | |
echo "splunktaucclib install failed, retry attempt $RETRY_COUNT of $MAX_RETRIES" | |
sleep 5 | |
done | |
mkdir -p package/lib | |
poetry export --without-hashes -o package/lib/requirements.txt | |
- name: Run ucc-gen build in Target Add-on | |
working-directory: TA | |
run: | | |
poetry run ucc-gen build > build_output.log 2>&1 | |
if tail -n 1 build_output.log | grep -q "^INFO: File creation summary: created: "; then | |
echo "✓ Build completed successfully with expected output" | |
cat build_output.log | |
else | |
echo "✗ Build did not complete with expected output" | |
echo "Last line of output should start with 'INFO: File creation summary: created: '" | |
echo "Full output:" | |
cat build_output.log | |
exit 1 | |
fi |