Skip to content
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

modify payload tests #22

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Run kickstart tests in a PR triggered by a "/test-platforms" command from an organization member
# Run kickstart tests in a PR triggered by a "/test-os-variants" command from an organization member
#
# /test-platforms - execute all tests affected by the PR or smoke tests if there is no such.
# /test-os-variants - execute all tests affected by the PR or smoke tests if there is no such.
# Or specify tests by combination of test names and/or options:
# /test-platforms --testtype TESTTYPE --skip-testtypes TYPE[,TYPE..] TEST1 TEST2
# /test-os-variants --testtype TESTTYPE --skip-testtypes TYPE[,TYPE..] TEST1 TEST2
#
# For dry run use:
# /test-platforms-dry
name: test-platforms
# /test-os-variants-dry
name: test-os-variants
on:
issue_comment:
types: [created]
Expand All @@ -17,7 +17,7 @@ permissions:

jobs:
pr-info:
if: startsWith(github.event.comment.body, '/test-platforms')
if: startsWith(github.event.comment.body, '/test-os-variants')
runs-on: ubuntu-latest
steps:
- name: Query comment author repository permissions
Expand Down Expand Up @@ -46,43 +46,43 @@ 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-platforms" 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
# extract first line and cut out the "/test-os-variants" first word
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-platforms-dry" && DRY_RUN=True
echo "$BODY" | grep -q "/test-os-variants-dry" && DRY_RUN=True
echo "Dry run: ${DRY_RUN}"
echo "dry_run=${DRY_RUN}" >> $GITHUB_OUTPUT

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 }}
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 }}


platform:
os-variant:
needs: pr-info
if: needs.pr-info.outputs.allowed_user == 'true'
name: Run tests on the platform
runs-on: [self-hosted, kstest]
name: Run on os variant
runs-on: [self-hosted, kstest-test]
env:
STATUS_NAME: test-platforms
STATUS_NAME: test-os-variants
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, rhel10]
os-variant: [daily-iso, rawhide, rhel8, rhel9, rhel10]
fail-fast: false

steps:
Expand Down Expand Up @@ -137,122 +137,88 @@ 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 platform ${{ matrix.platform }}
id: get_platform_specs
working-directory: ./kickstart-tests
run: |
set -eux

source ./containers/runner/skip-testtypes
if [ ${{ matrix.platform }} == "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.platform }} == "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.platform }} == "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.platform }} == "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.platform }} == "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_platform_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
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_platform_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 }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Fetch boot.iso and configure its local location
- name: Fetch boot.iso if available for platform ${{ matrix.platform }}
id: boot_iso_for_platform
- name: Fetch boot.iso if available for os variant ${{ matrix.os-variant }}
id: boot_iso_for_os_variant
run: |
set -eux
BOOT_ISO_PATH="${{ github.workspace }}/${{ matrix.platform }}.boot.iso"
BOOT_ISO_PATH="${{ github.workspace }}/${{ matrix.os-variant }}.boot.iso"
BOOT_ISO_URL="file://$BOOT_ISO_PATH"
if [ "${{ matrix.platform }}" == "daily-iso" ]; then
if [ "${{ matrix.os-variant }}" == "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
elif [ "${{ matrix.os-variant }}" == "rawhide" ]; then
curl -L https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/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 for ${{ matrix.os-variant }} can't be fetched."
echo "boot_iso=" >> $GITHUB_OUTPUT
fi

# Configure location of installation repositories for the platform
# Configure location of installation repositories for the os variant
# Also default boot.iso is defined by the value of urls.installation_tree
# of kstestParams event structure.
- name: Set installation tree for the platform
- name: Set installation tree for the os variant
id: set_installation_urls
working-directory: ./kickstart-tests
run: |
set -eux
if [ "${{ matrix.platform }}" == "rhel8" ] || \
[ "${{ matrix.platform }}" == "rhel9" ] || \
[ "${{ matrix.platform }}" == "rhel10" ]; then
source ./scripts/defaults-${{ matrix.platform }}.sh
if [ "${{ matrix.os-variant }}" == "rhel8" ] || \
[ "${{ matrix.os-variant }}" == "rhel9" ] || \
[ "${{ matrix.os-variant }}" == "rhel10" ]; then
source ./scripts/defaults-${{ matrix.os-variant }}.sh
echo "installation_tree=${KSTEST_URL}" >> $GITHUB_OUTPUT
echo "modular_url=${KSTEST_MODULAR_URL}" >> $GITHUB_OUTPUT
else
echo "Installation tree location for ${{ matrix.platform }} not configured"
if [ -z "${{ steps.boot_iso_for_platform.outputs.boot_iso }}" ]; then
echo "Installation tree location for ${{ matrix.os-variant }} not configured"
if [ -z "${{ steps.boot_iso_for_os_variant.outputs.boot_iso }}" ]; then
echo "No boot.iso source is defined"
exit 2
fi
Expand Down Expand Up @@ -285,9 +251,9 @@ jobs:
"configurations":[{"architecture":"x86_64"}],
"point_person":"[email protected]"
},
${{ steps.boot_iso_for_platform.outputs.boot_iso }}
${{ steps.boot_iso_for_os_variant.outputs.boot_iso }}
"kstestParams":{
"platform":"${{ steps.get_platform_specs.outputs.platform }}",
"platform":"${{ steps.generate_query.outputs.platform }}",
"urls":{
"x86_64":{
"installation_tree":"${{ steps.set_installation_urls.outputs.installation_tree }}",
Expand All @@ -309,7 +275,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: 'logs-${{ matrix.platform }}'
name: 'logs-${{ matrix.os-variant }}'
# skip the /anaconda subdirectories, too large
path: |
kickstart-tests/data/logs/kstest*.log
Expand All @@ -322,25 +288,25 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: 'logs-permian-${{ matrix.platform }}'
name: 'logs-permian-${{ matrix.os-variant }}'
path: |
permian/permian.log

result:
needs: [platform, pr-info]
needs: [os-variant, pr-info]
if: ${{ always() && needs.pr-info.outputs.allowed_user == 'true' }}
name: Set result status
runs-on: ubuntu-latest
env:
STATUS_NAME: test-platforms
STATUS_NAME: test-os-variants
steps:
- name: Show overall 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: 'finished'
state: ${{ needs.platform.result }}
state: ${{ needs.os-variant.result }}
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ PR runs do *not* auto-retry test failures. This avoids introducing unstable
tests, and PRs usually just run a few tests so that flakes are much less likely
to ruin the result.

To test a PR on all supported platforms (including rhel) there is a
`test-platforms`_ workflow running the tests on a comment in a PR.
To test a PR on all supported os versions (including rhel) there is a
`test-os-versions`_ workflow running the tests on a comment in a PR.
Running it requires admin repository permissions.

Service jobs
Expand Down
2 changes: 2 additions & 0 deletions hmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# shellcheck disable=SC2034
TESTTYPE="manual payload"

# modified

. ${KSTESTDIR}/functions.sh

kernel_args() {
Expand Down
2 changes: 2 additions & 0 deletions rpm-ostree-container-bootc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# shellcheck disable=SC2034
TESTTYPE="payload ostree bootc reboot skip-on-rhel-8 skip-on-rhel-10"

# modifies

. ${KSTESTDIR}/functions.sh

copy_interesting_files_from_system() {
Expand Down
2 changes: 2 additions & 0 deletions rpm-ostree-container-luks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# shellcheck disable=SC2034
TESTTYPE="payload ostree bootc luks reboot skip-on-rhel-8 skip-on-rhel-10"

#modified

. ${KSTESTDIR}/functions.sh

copy_interesting_files_from_system() {
Expand Down
2 changes: 2 additions & 0 deletions rpm-ostree-container-silverblue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# shellcheck disable=SC2034
TESTTYPE="payload ostree skip-on-rhel"

# modified

. ${KSTESTDIR}/functions.sh

kernel_args() {
Expand Down
2 changes: 2 additions & 0 deletions rpm-ostree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
# shellcheck disable=SC2034
TESTTYPE="payload ostree skip-on-rhel gh1023"

# modifies

. ${KSTESTDIR}/functions.sh

kernel_args() {
Expand Down
Loading