Skip to content

Commit

Permalink
replace
Browse files Browse the repository at this point in the history
  • Loading branch information
rvykydal committed Apr 19, 2024
1 parent aa51b24 commit c0d9ecc
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions .github/workflows/kickstart-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,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 "/kickstart-tests" 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 "workflow arguments are: $ARGS"
echo "comment_args=${ARGS}" >> $GITHUB_OUTPUT
# - name: Set KS test arguments
# id: ks_test_args
Expand Down Expand Up @@ -105,15 +105,15 @@ 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 }}
comment_args: ${{ steps.parse_comment_args.outputs.comment_args }}
target_branch: ${{ fromJson(steps.pr_api.outputs.data).base.ref }}
#skip_tests: ${{ steps.ks_test_args.outputs.skip_tests }}
#platform: ${{ steps.ks_test_args.outputs.platform }}

run:
needs: pr-info
# only do this for Fedora for now; once we have RHEL 8/9 boot.iso builds working, also support these
if: needs.pr-info.outputs.allowed_user == 'true' && needs.pr-info.outputs.launch_args != '' && ! contains(github.event.comment.body, '--waive')
if: needs.pr-info.outputs.allowed_user == 'true' && needs.pr-info.outputs.comment_args != '' && ! contains(github.event.comment.body, '--waive')
runs-on: [self-hosted, kstest-test]
timeout-minutes: 300
env:
Expand All @@ -130,7 +130,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: 'gathering repositories [${{ runner.name }}]'
state: pending
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Expand Down Expand Up @@ -184,22 +184,26 @@ jobs:
repository: rhinstaller/tplib
path: tplib

- name: Generate query arguments for "${{ needs.pr-info.outputs.launch_args }}"
- name: Generate query arguments for "${{ needs.pr-info.outputs.target_branch }}"
id: generate_query
working-directory: ./kickstart-tests
run: |
set -eux
source ./containers/runner/skip-testtypes
PERMIAN_QUERY=$(scripts/generate-permian-query.py \
--skip-testtypes $SKIP_TESTTYPES_ANACONDA_PR \
--skip-testtypes ${{ needs.pr-info.outputs.skip_tests }} \
${{ needs.pr-info.outputs.launch_args }} )
LAUNCH_ARGS=$(scripts/generate-launch-args.py ${{ needs.pr-info.outputs.comment_args }} \
--branch ${{ needs.pr-info.outputs.target_branch }} )
if [ $? == 0 ]; then
echo "query=$PERMIAN_QUERY" >> $GITHUB_OUTPUT
echo "Parsed launch arguments: $LAUNCH_ARGS"
else
echo "Parsing of the request arguments failed"
echo "Parsing of the arguments failed"
exit 1
fi
PERMIAN_QUERY=$(scripts/generate-permian-query.py $LAUNCH_ARGS)
echo "Parsed permian query: $PERMIAN_QUERY"
echo "query=$PERMIAN_QUERY" >> $GITHUB_OUTPUT
PLATFORM=$(scripts/generate-permian-query.py --print-platform $LAUNCH_ARGS)
echo "Parsed platform: $PLATFORM"
echo "platform=$PLATFORM" >> $GITHUB_OUTPUT
- name: Ensure http proxy is running
run: sudo kickstart-tests/containers/squid.sh start
Expand All @@ -220,7 +224,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: 'building artifacts [${{ runner.name }}]'
state: pending
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Expand Down Expand Up @@ -278,7 +282,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: 'running tests [${{ runner.name }}]'
state: pending
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Expand All @@ -301,7 +305,7 @@ jobs:
"point_person":"[email protected]"
},
"bootIso":{"x86_64":"file://${{ github.workspace }}/images/boot.iso"},
"kstestParams":{"platform":"${{ needs.pr-info.outputs.platform }}"}
"kstestParams":{"platform":"${{ steps.generate_query.outputs.platform }}"}
}'
# Permian hides the exit code of launcher, so error out this step manually based on logs
Expand Down Expand Up @@ -338,7 +342,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 [${{ runner.name }}]'
state: ${{ job.status }}
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
Expand Down

0 comments on commit c0d9ecc

Please sign in to comment.