Skip to content

tests: TA tests #1745

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

Draft
wants to merge 32 commits into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
1e8af2a
TA tests
kkedziak-splunk May 14, 2025
d1a7bf2
Merge branch 'develop' into tests/ta-pipelines
kkedziak-splunk May 14, 2025
c113959
TA tests
kkedziak-splunk May 14, 2025
d1c9116
TA tests
kkedziak-splunk May 14, 2025
f33e27c
TA tests
kkedziak-splunk May 14, 2025
cd96b1a
TA tests
kkedziak-splunk May 14, 2025
ecf6962
TA tests
kkedziak-splunk May 14, 2025
d45b8c3
TA tests
kkedziak-splunk May 14, 2025
9d80f57
TA tests
kkedziak-splunk May 14, 2025
cff381f
Merge branch 'develop' into tests/ta-pipelines
kkedziak-splunk May 19, 2025
9217080
Pipeline
kkedziak-splunk May 19, 2025
601100f
Pipeline
kkedziak-splunk May 20, 2025
dc7e2ea
Pipeline
kkedziak-splunk May 20, 2025
025ed9e
Pipeline
kkedziak-splunk May 20, 2025
05ad76b
Pipeline
kkedziak-splunk May 20, 2025
f5b0438
Pipeline
kkedziak-splunk May 21, 2025
f95849f
Pipeline
kkedziak-splunk May 21, 2025
2aafda1
Pipeline
kkedziak-splunk May 21, 2025
efcf8e2
Pipeline
kkedziak-splunk May 21, 2025
8d9099a
Merge branch 'develop' into tests/ta-pipelines
kkedziak-splunk May 21, 2025
8cff81f
Pipeline
kkedziak-splunk May 21, 2025
ef8b91e
Pipeline
kkedziak-splunk May 21, 2025
48eb60a
Pipeline
kkedziak-splunk May 21, 2025
3107382
Pipeline
kkedziak-splunk May 21, 2025
c020a14
Pipeline
kkedziak-splunk May 21, 2025
b0eda1f
Pipeline
kkedziak-splunk May 21, 2025
27442ef
Pipeline
kkedziak-splunk May 22, 2025
878d8a1
Pipeline
kkedziak-splunk May 22, 2025
15f244d
Pipeline
kkedziak-splunk May 22, 2025
25eec75
Pipeline
kkedziak-splunk May 22, 2025
1f79602
Pipeline
kkedziak-splunk May 22, 2025
12a6bff
Merge branch 'develop' into tests/ta-pipelines
kkedziak-splunk May 22, 2025
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
60 changes: 57 additions & 3 deletions .github/workflows/ta-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ on:
description: "Branch of splunk/addonfactory-ucc-library to use (leave empty to use latest from PyPI)"
required: false
default: ""
run_pipelines:
description: "Run pipelines for all TAs (true/false)"
required: false
default: "false"

jobs:
build-ucc:
Expand Down Expand Up @@ -109,21 +113,46 @@ jobs:
name: ucc-package-whl
path: UCC

- name: Install Dependencies in Target Add-on
- name: Prepare the Target Add-on
id: prepare
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]

# Use the special branch
if [[ "${{ github.event.inputs.run_pipelines }}" == "true" ]]; then
GIT_BRANCH="ucc/ci_tests_trigger_pipeline"

git fetch origin

if git ls-remote --exit-code --heads origin "$GIT_BRANCH"; then
echo "Branch $GIT_BRANCH already exists, checking it out"
git checkout "$GIT_BRANCH"
git pull origin main --no-ff --no-edit # Merge main into the branch
echo "branch-created=false" >> "$GITHUB_OUTPUT"
else
echo "Branch $GIT_BRANCH does not exist, creating it"
git checkout -b "$GIT_BRANCH" "origin/main"
echo "branch-created=true" >> "$GITHUB_OUTPUT"
fi

echo "GIT_BRANCH=$GIT_BRANCH" >> "$GITHUB_ENV"
fi

rm splunk_add_on_ucc_framework-*.whl || true
cp ../UCC/*.whl ./
UCC_WHL=$(ls *.whl)

# 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
echo "Installing UCC package $UCC_WHL"
poetry add "./$UCC_WHL" --group dev && break
RETRY_COUNT=$((RETRY_COUNT+1))
echo "Poetry install failed, retry attempt $RETRY_COUNT of $MAX_RETRIES"
sleep 5
Expand All @@ -147,7 +176,32 @@ jobs:

mkdir -p package/lib
poetry export --without-hashes -o package/lib/requirements.txt

# Add to commit
if [[ "${{ github.event.inputs.run_pipelines }}" == "true" ]]; then
echo "Adding UCC, pyproject.toml and poetry.lock to commit"
git add pyproject.toml poetry.lock *.whl
fi
- name: Run ucc-gen build in Target Add-on
working-directory: TA
run: |
poetry run ucc-gen build
- name: Importing GPG key
if: success() && github.event.inputs.run_pipelines == 'true'
uses: crazy-max/ghaction-import-gpg@v6
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
workdir: TA
- name: Push changes to a temporary branch in order to trigger the pipeline
if: success() && github.event.inputs.run_pipelines == 'true'
working-directory: TA
run: |
git config --global user.name "${{ secrets.SA_GH_USER_NAME }}"
git config --global user.email "${{ secrets.SA_GH_USER_EMAIL }}"
git commit -S -m "CI: UCC build for ${{ github.event_name }} event"
git push origin $GIT_BRANCH
Loading