mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-02-14 18:10:00 +00:00
added quotes renamed trigger to funtest Co-authored-by: Naga Ravi Chaitanya Elluri <nelluri@redhat.com>
112 lines
4.4 KiB
YAML
112 lines
4.4 KiB
YAML
on: issue_comment
|
|
|
|
jobs:
|
|
check_user:
|
|
# This job only runs for pull request comments
|
|
name: Check User Authorization
|
|
env:
|
|
USERS: ${{vars.USERS}}
|
|
if: contains(github.event.comment.body, '/funtest') && contains(github.event.comment.html_url, '/pull/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check User
|
|
run: |
|
|
for name in `echo $USERS`
|
|
do
|
|
name="${name//$'\r'/}"
|
|
name="${name//$'\n'/}"
|
|
if [ $name == "${{github.event.sender.login}}" ]
|
|
then
|
|
echo "user ${{github.event.sender.login}} authorized, action started..."
|
|
exit 0
|
|
fi
|
|
done
|
|
echo "user ${{github.event.sender.login}} is not allowed to run functional tests Action"
|
|
exit 1
|
|
pr_commented:
|
|
# This job only runs for pull request comments containing /functional
|
|
name: Functional Tests
|
|
if: contains(github.event.comment.body, '/funtest') && contains(github.event.comment.html_url, '/pull/')
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- check_user
|
|
steps:
|
|
- name: Check out Kraken
|
|
uses: actions/checkout@v3
|
|
- name: Checkout Pull Request
|
|
run: hub pr checkout ${{ github.event.issue.number }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Install OC CLI
|
|
uses: redhat-actions/oc-installer@v1
|
|
with:
|
|
oc_version: latest
|
|
- name: Install python 3.9
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Setup kraken dependencies
|
|
run: pip install -r requirements.txt
|
|
- name: Create Workdir & export the path
|
|
run: |
|
|
mkdir workdir
|
|
echo "WORKDIR_PATH=`pwd`/workdir" >> $GITHUB_ENV
|
|
- name: Teardown CRC (Post Action)
|
|
uses: webiny/action-post-run@3.0.0
|
|
id: post-run-command
|
|
with:
|
|
# currently using image coming from tsebastiani quay.io repo
|
|
# waiting that a fix is merged in the upstream one
|
|
# post action run cannot (apparently) be properly indented
|
|
run: docker run -v "${{ env.WORKDIR_PATH }}:/workdir" -e WORKING_MODE=T -e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} -e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} -e AWS_DEFAULT_REGION=us-west-2 -e TEARDOWN_RUN_ID=crc quay.io/tsebastiani/crc-cloud
|
|
- name: Run CRC
|
|
# currently using image coming from tsebastiani quay.io repo
|
|
# waiting that a fix is merged in the upstream one
|
|
run: |
|
|
docker run -v "${{ env.WORKDIR_PATH }}:/workdir" \
|
|
-e WORKING_MODE=C \
|
|
-e PULL_SECRET="${{ secrets.PULL_SECRET }}" \
|
|
-e AWS_ACCESS_KEY_ID="${{ secrets.AWS_ACCESS_KEY_ID }}" \
|
|
-e AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" \
|
|
-e AWS_DEFAULT_REGION=us-west-2 \
|
|
-e CREATE_RUN_ID=crc \
|
|
-e PASS_KUBEADMIN="${{ secrets.KUBEADMIN_PWD }}" \
|
|
-e PASS_REDHAT="${{ secrets.REDHAT_PWD }}" \
|
|
-e PASS_DEVELOPER="${{ secrets.DEVELOPER_PWD }}" \
|
|
quay.io/tsebastiani/crc-cloud
|
|
- name: OpenShift login and example deployment, GitHub Action env init
|
|
env:
|
|
NAMESPACE: test-namespace
|
|
DEPLOYMENT_NAME: test-nginx
|
|
KUBEADMIN_PWD: '${{ secrets.KUBEADMIN_PWD }}'
|
|
run: ./CI/CRC/init_github_action.sh
|
|
- name: Setup test suite
|
|
run: |
|
|
yq -i '.kraken.port="8081"' CI/config/common_test_config.yaml
|
|
yq -i '.kraken.signal_address="0.0.0.0"' CI/config/common_test_config.yaml
|
|
|
|
echo "test_app_outages_gh" > ./CI/tests/my_tests
|
|
echo "test_container" >> ./CI/tests/my_tests
|
|
echo "test_namespace" >> ./CI/tests/my_tests
|
|
echo "test_net_chaos" >> ./CI/tests/my_tests
|
|
echo "test_time" >> ./CI/tests/my_tests
|
|
|
|
- name: Print affected config files
|
|
run: |
|
|
echo -e "## CI/config/common_test_config.yaml\n\n"
|
|
cat CI/config/common_test_config.yaml
|
|
|
|
- name: Running test suite
|
|
run: |
|
|
./CI/run.sh
|
|
- name: Print test output
|
|
run: cat CI/out/*
|
|
- name: Create coverage report
|
|
run: |
|
|
echo "# Test results" > $GITHUB_STEP_SUMMARY
|
|
cat CI/results.markdown >> $GITHUB_STEP_SUMMARY
|
|
echo "# Test coverage" >> $GITHUB_STEP_SUMMARY
|
|
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
|
|
|
|
|