Skip to content

Daily run in Permian #947

Daily run in Permian

Daily run in Permian #947

# Run all kickstart tests for all active branches in Permian
name: Daily run in Permian
on:
schedule:
# run after daily-boot-iso.yml
- cron: 0 23 * * *
workflow_dispatch:
permissions:
contents: read
jobs:
scenario:
name: Scenario in Permian
runs-on: [self-hosted, kstest]
strategy:
matrix:
scenario: [daily-iso, rhel9, rhel10]
fail-fast: false
# these settings depend on the infrastructure; on upshift ocp-master-xxl they take about 4 hours
timeout-minutes: 560
env:
TEST_JOBS: 16
GITHUB_TOKEN: /home/github/github-token
# The timeout should be ~20 minutes less then the job's timeout-minutes
# so that we get partial results and logs in case of the timeout.
LAUNCHER_TIMEOUT_MINUTES: 540
steps:
# self-hosted runners don't do this automatically; also useful to keep stuff around for debugging
# need to run sudo as the launch script and the container create root/other user owned files
- name: Clean up previous run
run: |
sudo podman ps -q --all --filter='ancestor=kstest-runner' | xargs -tr sudo podman rm -f
sudo podman volume rm --all || true
sudo rm -rf *
- name: Clone repository
uses: actions/checkout@v4
with:
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: Generate test plan for the scenario
working-directory: ./kickstart-tests
run: |
set -eux
TESTPLAN="./testlib/test_plans/daily-${{ matrix.scenario }}.plan.yaml"
TEMPLATE="${TESTPLAN}.j2"
if [ "${{ matrix.scenario }}" == "daily-iso" ]; then
VARIABLE="SKIP_TESTTYPES_DAILY_ISO"
elif [ "${{ matrix.scenario }}" == "rhel8" ]; then
VARIABLE="SKIP_TESTTYPES_RHEL8"
elif [ "${{ matrix.scenario }}" == "rhel9" ]; then
VARIABLE="SKIP_TESTTYPES_RHEL9"
elif [ "${{ matrix.scenario }}" == "rhel10" ]; then
VARIABLE="SKIP_TESTTYPES_RHEL10"
fi
if [ -e ${TEMPLATE} ] && [ -n ${VARIABLE} ]; then
scripts/generate-testplan.py \
-t ${TEMPLATE} \
-f ./containers/runner/skip-testtypes \
-s ${VARIABLE} \
-o ${TESTPLAN} \
--verbose
fi
- 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
# use the latest official packages for the nightly runs
- name: Clean up squid cache
run: sudo containers/squid.sh clean
working-directory: ./kickstart-tests
- name: Ensure http proxy is running
run: sudo containers/squid.sh start
working-directory: ./kickstart-tests
- name: Set platform from scenario
id: platform_from_scenario
run: |
set -eux
if [ "${{ matrix.scenario }}" == "daily-iso" ] || [ "${{ matrix.scenario }}" == "minimal" ]; then
echo "platform=fedora_rawhide" >> $GITHUB_OUTPUT
elif [ "${{ matrix.scenario }}" == "rhel8" ]; then
echo "platform=rhel8" >> $GITHUB_OUTPUT
elif [ "${{ matrix.scenario }}" == "rhel9" ]; then
echo "platform=rhel9" >> $GITHUB_OUTPUT
elif [ "${{ matrix.scenario }}" == "rhel10" ]; then
echo "platform=rhel10" >> $GITHUB_OUTPUT
else
echo "Scenario ${{ matrix.scenario }} can't be mapped to platform"
exit 1
fi
# Fetch boot.iso and configiure its local location
- name: Set boot.iso from scenario
id: boot_iso_from_scenario
run: |
set -eux
BOOT_ISO_PATH="${{ github.workspace }}/${{ matrix.scenario }}.boot.iso"
BOOT_ISO_URL="file://$BOOT_ISO_PATH"
if [ "${{ matrix.scenario }}" == "daily-iso" ] || [ "${{ matrix.scenario }}" == "minimal" ]; 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
else
echo "Boot.iso URL for ${{ matrix.scenario }} not configured"
echo "boot_iso=" >> $GITHUB_OUTPUT
fi
# Configure location of installation repositories for the scenario
# Also default boot.iso is defined by the value of urls.installation_tree
# of kstestParams event structure.
- name: Set installation_tree for the scenario
working-directory: ./kickstart-tests
id: set_installation_urls
run: |
set -eux
if [ "${{ matrix.scenario }}" == "rhel8" ] || \
[ "${{ matrix.scenario }}" == "rhel9" ] || \
[ "${{ matrix.scenario }}" == "rhel10" ]; then
source ./scripts/defaults-${{ matrix.scenario }}.sh
echo "installation_tree=${KSTEST_URL}" >> $GITHUB_OUTPUT
echo "modular_url=${KSTEST_MODULAR_URL}" >> $GITHUB_OUTPUT
else
echo "Installation tree location for ${{ matrix.scenario }} not configured"
if [ -z "${{ steps.boot_iso_from_scenario.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]
timeout=${LAUNCHER_TIMEOUT_MINUTES}m
retry_on_failure=True
kstest_local_repo=${{ github.workspace }}/kickstart-tests
# gh#795
added_boot_options=inst.xtimeout=100
[library]
directPath=${{ github.workspace }}/kickstart-tests/testlib
EOF
- name: Run scenario ${{ matrix.scenario }} in container
working-directory: ./permian
run: |
sudo --preserve-env=TEST_JOBS \
PYTHONPATH=${PYTHONPATH:-}:${{ github.workspace }}/tplib \
./pipeline --debug-log permian.log \
--settings settings.ini \
--override workflows.dry_run=False \
run_event '{
"type":"github.scheduled.daily.kstest.${{ matrix.scenario }}",
${{ steps.boot_iso_from_scenario.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@v4
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
kickstart-tests/data/logs/kstest-*/original-ks.cfg
- name: Collect json summary
if: always()
uses: actions/upload-artifact@v4
with:
name: 'summary-${{ matrix.scenario }}'
path: |
kickstart-tests/data/logs/kstest.log.json
- name: Collect Permian logs
if: always()
uses: actions/upload-artifact@v4
with:
name: 'logs-permian-${{ matrix.scenario }}'
path: |
permian/permian.log
- name: Collect Permian xunit reporter results
if: always()
uses: actions/upload-artifact@v4
with:
name: 'results-xunit-${{ matrix.scenario }}'
path: |
permian/xunit-*.xml