forked from rhinstaller/kickstart-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test-os-variants: move logic from the workflow
- Loading branch information
Showing
1 changed file
with
27 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,16 +46,16 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Parse launch arguments | ||
id: parse_launch_args | ||
- name: Parse comment arguments | ||
id: parse_comment_args | ||
# Do not use comment body directly in the shell command to avoid possible code injection. | ||
env: | ||
BODY: ${{ github.event.comment.body }} | ||
run: | | ||
# extract first line and cut out the "/test-os-variants" first word | ||
LAUNCH_ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') | ||
echo "launch arguments are: $LAUNCH_ARGS" | ||
echo "launch_args=${LAUNCH_ARGS}" >> $GITHUB_OUTPUT | ||
ARGS=$(echo "$BODY" | sed -n '1 s/^[^ ]* *//p' | sed 's/[[:space:]]*$//') | ||
echo "comment arguments are: $ARGS" | ||
echo "comment_args=${ARGS}" >> $GITHUB_OUTPUT | ||
# check for dry run mode | ||
DRY_RUN=False | ||
echo "$BODY" | grep -q "/test-os-variants-dry" && DRY_RUN=True | ||
|
@@ -66,8 +66,8 @@ jobs: | |
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 }} | ||
launch_args: ${{ steps.parse_launch_args.outputs.launch_args }} | ||
dry_run: ${{ steps.parse_launch_args.outputs.dry_run }} | ||
comment_args: ${{ steps.parse_comment_args.outputs.comment_args }} | ||
dry_run: ${{ steps.parse_comment_args.outputs.dry_run }} | ||
|
||
|
||
os-variant: | ||
|
@@ -137,81 +137,46 @@ jobs: | |
CHANGED_TESTS=$(git diff --name-only $BASE_COMMIT HEAD -- *.ks.in $(find -maxdepth 1 -name '*.sh' -perm -u+x) | sed 's/\.ks\.in$//; s/\.sh$//' | sort -u | tr '\n' ' ') | ||
echo "changed_tests=${CHANGED_TESTS}" >> $GITHUB_OUTPUT | ||
- name: Get skipped tests for os variant ${{ matrix.os-variant }} | ||
id: get_os_variant_specs | ||
working-directory: ./kickstart-tests | ||
run: | | ||
set -eux | ||
source ./containers/runner/skip-testtypes | ||
if [ ${{ matrix.os-variant }} == "daily-iso" ]; then | ||
echo "skip_tests=skip-on-fedora" >> $GITHUB_OUTPUT | ||
echo "disabled_testtypes=$SKIP_TESTTYPES_DAILY_ISO" >> $GITHUB_OUTPUT | ||
echo "platform=fedora_rawhide" >> $GITHUB_OUTPUT | ||
elif [ ${{ matrix.os-variant }} == "rawhide" ]; then | ||
echo "skip_tests=skip-on-fedora" >> $GITHUB_OUTPUT | ||
echo "disabled_testtypes=$SKIP_TESTTYPES_RAWHIDE" >> $GITHUB_OUTPUT | ||
echo "platform=fedora_rawhide" >> $GITHUB_OUTPUT | ||
elif [ ${{ matrix.os-variant }} == "rhel8" ]; then | ||
echo "skip_tests=skip-on-rhel,skip-on-rhel-8" >> $GITHUB_OUTPUT | ||
echo "disabled_testtypes=$SKIP_TESTTYPES_RHEL8" >> $GITHUB_OUTPUT | ||
echo "platform=rhel8" >> $GITHUB_OUTPUT | ||
elif [ ${{ matrix.os-variant }} == "rhel9" ]; then | ||
echo "skip_tests=skip-on-rhel,skip-on-rhel-9" >> $GITHUB_OUTPUT | ||
echo "disabled_testtypes=$SKIP_TESTTYPES_RHEL9" >> $GITHUB_OUTPUT | ||
echo "platform=rhel9" >> $GITHUB_OUTPUT | ||
elif [ ${{ matrix.os-variant }} == "rhel10" ]; then | ||
echo "skip_tests=skip-on-rhel,skip-on-rhel-10" >> $GITHUB_OUTPUT | ||
echo "disabled_testtypes=$SKIP_TESTTYPES_RHEL10" >> $GITHUB_OUTPUT | ||
echo "platform=rhel10" >> $GITHUB_OUTPUT | ||
else | ||
echo "Platform is not supported by kickstart tests yet!" | ||
exit 1 | ||
fi | ||
- name: Generate test selection | ||
- name: Generate test selection for os variant ${{ matrix.os-variant }} | ||
id: generate_query | ||
working-directory: ./kickstart-tests | ||
run: | | ||
set -eux | ||
CHANGED_TESTS="${{ steps.get_changed_tests.outputs.changed_tests }}" | ||
DISABLED_TESTTYPES="${{ steps.get_os_variant_specs.outputs.disabled_testtypes }}" | ||
LAUNCH_ARGS="${{ needs.pr-info.outputs.launch_args }}" | ||
COMMENT_ARGS="${{ needs.pr-info.outputs.comment_args }}" | ||
if [ -n "${LAUNCH_ARGS}" ]; then | ||
if [ -n "${COMMENT_ARGS}" ]; then | ||
echo "description=Running tests required by the PR comment explicitly." >> $GITHUB_OUTPUT | ||
COMMENT_ARGS="--force ${COMMENT_ARGS}" | ||
elif [ -n "${CHANGED_TESTS}" ]; then | ||
echo "description=Running tests affected by changes (excluding disabled)." >> $GITHUB_OUTPUT | ||
LAUNCH_ARGS="${CHANGED_TESTS}" | ||
if [ -n "${DISABLED_TESTTYPES}" ]; then | ||
LAUNCH_ARGS="--skip-testtypes ${DISABLED_TESTTYPES} ${LAUNCH_ARGS}" | ||
fi | ||
COMMENT_ARGS="${CHANGED_TESTS}" | ||
else | ||
echo "description=Running smoke tests (no affected tests found)." >> $GITHUB_OUTPUT | ||
LAUNCH_ARGS="--testtype smoke" | ||
COMMENT_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_os_variant_specs.outputs.skip_tests }} \ | ||
${LAUNCH_ARGS} ) | ||
if [ $? == 0 ]; then | ||
echo "launch_args=$LAUNCH_ARGS" >> $GITHUB_OUTPUT | ||
echo "query=$PERMIAN_QUERY" >> $GITHUB_OUTPUT | ||
LAUNCH_ARGS=$(scripts/generate-launch-args.py ${COMMENT_ARGS} \ | ||
--os-variant ${{ matrix.os-variant }} ) || RC=$? | ||
if [ -z ${RC} ] || [ ${RC} == 0 ]; then | ||
echo "Generated launch arguments: $LAUNCH_ARGS" | ||
else | ||
echo "Parsing of the request arguments failed" | ||
echo "Generating of the arguments failed. See the workflow file for usage." | ||
exit 1 | ||
fi | ||
PERMIAN_QUERY=$(scripts/generate-permian-query.py $LAUNCH_ARGS) | ||
echo "Generated permian query: $PERMIAN_QUERY" | ||
echo "query=$PERMIAN_QUERY" >> $GITHUB_OUTPUT | ||
PLATFORM=$(scripts/generate-permian-query.py --print-platform $LAUNCH_ARGS) | ||
echo "Generated platform: $PLATFORM" | ||
echo "platform=$PLATFORM" >> $GITHUB_OUTPUT | ||
# we post statuses manually as this does not run from a pull_request event | ||
# https://developer.github.com/v3/repos/statuses/#create-a-status | ||
- name: Create in-progress status | ||
uses: octokit/[email protected] | ||
with: | ||
route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' | ||
context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' | ||
context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.comment_args }}' | ||
description: '${{ steps.generate_query.outputs.description }}' | ||
state: pending | ||
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | ||
|
@@ -287,7 +252,7 @@ jobs: | |
}, | ||
${{ steps.boot_iso_for_os_variant.outputs.boot_iso }} | ||
"kstestParams":{ | ||
"platform":"${{ steps.get_os_variant_specs.outputs.platform }}", | ||
"platform":"${{ steps.generate_query.outputs.platform }}", | ||
"urls":{ | ||
"x86_64":{ | ||
"installation_tree":"${{ steps.set_installation_urls.outputs.installation_tree }}", | ||
|
@@ -338,7 +303,7 @@ jobs: | |
uses: octokit/[email protected] | ||
with: | ||
route: 'POST /repos/${{ github.repository }}/statuses/${{ needs.pr-info.outputs.sha }}' | ||
context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.launch_args }}' | ||
context: '${{ env.STATUS_NAME }} ${{ needs.pr-info.outputs.comment_args }}' | ||
description: 'finished' | ||
state: ${{ needs.os-variant.result }} | ||
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' | ||
|