Skip to content

Commit

Permalink
Add /test-platforms GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rvykydal committed Mar 11, 2024
1 parent eda6bb9 commit 3f2f554
Showing 1 changed file with 159 additions and 45 deletions.
204 changes: 159 additions & 45 deletions .github/workflows/test-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,11 @@ jobs:
echo "launch arguments are: $LAUNCH_ARGS"
echo "launch_args=${LAUNCH_ARGS}" >> $GITHUB_OUTPUT
# - name: Set KS test arguments
# id: ks_test_args
# run: |
# set -eux
# TARGET_BRANCH="${{ fromJson(steps.pr_api.outputs.data).base.ref }}"
#
# if [ "$TARGET_BRANCH" == "master" ]; then
# echo "skip_tests=skip-on-fedora" >> $GITHUB_OUTPUT
# echo "platform=fedora_rawhide" >> $GITHUB_OUTPUT
# elif echo "$TARGET_BRANCH" | grep -qE "fedora-[[:digit:]]+$"; then
# echo "skip_tests=skip-on-fedora" >> $GITHUB_OUTPUT
# echo "platform=fedora_rawhide" >> $GITHUB_OUTPUT
# elif echo "$TARGET_BRANCH" | grep -qE "rhel-8(\.[[:digit:]]+)?$"; then
# echo "skip_tests=skip-on-rhel,skip-on-rhel-8" >> $GITHUB_OUTPUT
# echo "platform=rhel8" >> $GITHUB_OUTPUT
# elif echo "$TARGET_BRANCH" | grep -qE "rhel-9(\.[[:digit:]]+)?$"; then
# echo "skip_tests=skip-on-rhel,skip-on-rhel-9" >> $GITHUB_OUTPUT
# echo "platform=rhel9" >> $GITHUB_OUTPUT
# else
# echo "Branch $TARGET_BRANCH is not supported by kickstart tests yet!"
# exit 1
# fi
outputs:
allowed_user: ${{ steps.check_user_perm.outputs.allowed_user }}
base_ref: ${{ fromJson(steps.pr_api.outputs.data).base.ref }}
sha: ${{ fromJson(steps.pr_api.outputs.data).head.sha }}
# TODO: generate test names
launch_args: ${{ steps.parse_launch_args.outputs.launch_args }}
# skip_tests: ${{ steps.ks_test_args.outputs.skip_tests }}
# platform: ${{ steps.ks_test_args.outputs.platform }}


platform:
Expand All @@ -93,11 +67,14 @@ jobs:
name: Run tests on the platform
runs-on: [self-hosted, kstest-test]
env:
TARGET_BRANCH: ${{ needs.pr-info.outputs.base_ref }}
TARGET_BRANCH: ${{ needs.pr-info.outputs.base_ref }}
TEST_JOBS: 16
GITHUB_TOKEN: /home/github/github-token
strategy:
matrix:
#platform: [daily-iso, rawhide, rhel8, rhel9]
platform: [daily-iso]
#platform: [daily-iso]
platform: [rawhide]
fail-fast: false

steps:
Expand All @@ -113,19 +90,40 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ needs.pr-info.outputs.sha }}
# TODO use just main directory?
path: kickstart-tests

# - name: Rebase to current ${{ env.TARGET_BRANCH }}
# working-directory: ./kickstart-tests
# run: |
# git fetch origin
# git config user.name github-actions
# git config user.email [email protected]
# git log --oneline -1 origin/${{ env.TARGET_BRANCH }}
# git rebase origin/${{ env.TARGET_BRANCH }}
#
- name: Check out kickstart-tests
uses: actions/checkout@v4
with:
#TODO change
#repository: rhinstaller/kickstart-tests
repository: rvykydal/kickstart-tests
path: kickstart-tests

- name: Generate test cases
working-directory: ./kickstart-tests
run: scripts/generate-testcases.py -t ./testlib/test_cases/kstest-template.tc.yaml.j2 . -o ./testlib/test_cases

- name: Clone Permian repository
uses: actions/checkout@v4
with:
repository: rhinstaller/permian
path: permian
ref: main

- name: Clone tplib repository
uses: actions/checkout@v4
with:
repository: rhinstaller/tplib
path: tplib

- name: Ensure http proxy is running
run: sudo containers/squid.sh start
working-directory: ./kickstart-tests

- name: Update container images used here
run: |
sudo podman pull quay.io/rhinstaller/kstest-runner:latest
- name: Get changed tests
working-directory: ./kickstart-tests
Expand Down Expand Up @@ -155,25 +153,141 @@ jobs:
exit 1
fi
- name: Generate query arguments for "${{ steps.get_changed_tests.outputs.changed_tests }}"
- name: Generate test selection query arguments for "${{ steps.get_changed_tests.outputs.changed_tests }}"
id: generate_query
working-directory: ./kickstart-tests
run: |
set -eux
if [ -n ${{ needs.pr-info.outputs.base_ref }} ]; then
LAUNCH_ARGS = "${{ needs.pr-info.outputs.base_ref }}"
if [ -n ${{ steps.get_changed_tests.outputs.changed_tests }} ]; then
LAUNCH_ARGS = "${{ steps.get_changed_tests.outputs.changed_tests }}"
else
LAUNCH_ARGS = "--testtype smoke"
fi
source ./containers/runner/skip-testtypes
PERMIAN_QUERY=$(scripts/generate-permian-query.py \
--skip-testtypes $SKIP_TESTTYPES_ANACONDA_PR \
--skip-testtypes ${{ steps.get_platform_skiptest.outputs.skip_tests }} \
${{ steps.get_changed_tests.outputs.changed_tests }} )
${LAUNCH_ARGS} )
if [ $? == 0 ]; then
echo "query=$PERMIAN_QUERY" >> $GITHUB_OUTPUT
else
echo "Parsing of the request arguments failed"
exit 1
fi
# TODO: use supplied arguments (overriding)
# TODO: timeouts?
# TODO: implement progress from anaconda repo
# # Fetch boot.iso and configiure its local location
# - name: Fetch boot.iso if available for platform ${{ matrix.platform }}
# id: boot_iso_for_platform
# run: |
# set -eux
# BOOT_ISO_PATH="${{ github.workspace }}/${{ matrix.platform }}.boot.iso"
# BOOT_ISO_URL="file://$BOOT_ISO_PATH"
# if [ "${{ matrix.platform }}" == "daily-iso" ]; then
# ${{ github.workspace }}/kickstart-tests/containers/runner/fetch_daily_iso.sh $GITHUB_TOKEN $BOOT_ISO_PATH
# echo "boot_iso=\"bootIso\":{\"x86_64\":\"${BOOT_ISO_URL}\"}," >> $GITHUB_OUTPUT
# elif [ "${{ matrix.platform }}" == "rawhide" ]; then
# curl -L https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Server/x86_64/os/images/boot.iso --output $BOOT_ISO_PATH
# echo "boot_iso=\"bootIso\":{\"x86_64\":\"${BOOT_ISO_URL}\"}," >> $GITHUB_OUTPUT
# else
# echo "Boot.iso for ${{ matrix.platform }} can't be fetched."
# echo "boot_iso=" >> $GITHUB_OUTPUT
# fi
#
# # Configure location of installation repositories for the platform
# # Also default boot.iso is defined by the value of urls.installation_tree
# # of kstestParams event structure.
# - name: Set installation_tree for the platform
# id: set_installation_urls
# run: |
# set -eux
# if [ "${{ matrix.platform }}" == "rhel8" ]; then
# echo "installation_tree=http://download.eng.bos.redhat.com/rhel-8/nightly/RHEL-8/latest-RHEL-8.10.0/compose/BaseOS/x86_64/os" >> $GITHUB_OUTPUT
# echo "modular_url=http://download.eng.bos.redhat.com/rhel-8/nightly/RHEL-8/latest-RHEL-8.10.0/compose/AppStream/x86_64/os" >> $GITHUB_OUTPUT
# elif [ "${{ matrix.platform }}" == "rhel9" ]; then
# echo "installation_tree=http://download.eng.bos.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-9.4.0/compose/BaseOS/x86_64/os" >> $GITHUB_OUTPUT
# echo "modular_url=http://download.eng.bos.redhat.com/rhel-9/nightly/RHEL-9/latest-RHEL-9.4.0/compose/AppStream/x86_64/os" >> $GITHUB_OUTPUT
# else
# echo "Installation tree location for ${{ matrix.platform }} not configured"
# if [ -z "${{ steps.boot_iso_for_platform.outputs.boot_iso }}" ]; then
# echo "No boot.iso source is defined"
# exit 2
# fi
# echo "installation_tree=" >> $GITHUB_OUTPUT
# echo "modular_url=" >> $GITHUB_OUTPUT
# fi
#
# - name: Create Permian settings file
# working-directory: ./permian
# run: |
# cat <<EOF > settings.ini
# [kickstart_test]
# kstest_local_repo=${{ github.workspace }}/kickstart-tests
# [library]
# directPath=${{ github.workspace }}/kickstart-tests/testlib
# EOF
#
# - name: Run kickstart tests in container
# working-directory: ./permian
# run: |
# sudo --preserve-env=TEST_JOBS \
# PYTHONPATH=${PYTHONPATH:-}:${{ github.workspace }}/tplib \
# ./run_subset --debug-log permian.log \
# --settings settings.ini \
# --override workflows.dry_run=True \
# --testcase-query '${{ steps.generate_query.outputs.query }}' \
# run_event '{
# "type":"everything",
# "everything_testplan":{
# "configurations":[{"architecture":"x86_64"}],
# "point_person":"[email protected]"
# },
# ${{ steps.boot_iso_from_platform.outputs.boot_iso }}
# "kstestParams":{
# "platform":"${{ steps.platform_from_scenario.outputs.platform }}",
# "urls":{
# "x86_64":{
# "installation_tree":"${{ steps.set_installation_urls.outputs.installation_tree }}",
# "modular_url":"${{ steps.set_installation_urls.outputs.modular_url }}"
# }
# }
# }
# }'
#
# # Permian hides the exit code of launcher, so error out this step manually based on logs
# rc=$( awk '/Runner return code: /{ print $4 }' permian.log)
# if [ -n "$rc" ]; then
# exit $rc
# else
# exit 111
# fi
#
# - name: Collect anaconda logs
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: 'logs-${{ matrix.scenario }}'
# # skip the /anaconda subdirectories, too large
# path: |
# kickstart-tests/data/logs/kstest*.log
# kickstart-tests/data/logs/kstest.log.json
# kickstart-tests/data/logs/kstest-*/*.log
# kickstart-tests/data/logs/kstest-*/anaconda/lorax-packages.log
#
# - name: Collect Permian logs
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: 'logs-permian-${{ matrix.scenario }}'
# path: |
# permian/permian.log
#
# # TODO: use supplied arguments (overriding)
# # TODO: timeouts?
# # TODO: implement waive
# # TODO: solve empty changed tests (smoke?)
# # TODO: implement progress from anaconda repo
# # TODO?: installation_tree from defaults file ?

0 comments on commit 3f2f554

Please sign in to comment.