forked from SatelliteQE/robottelo
-
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.
autodetect and add prt tests for dependabot PR's (SatelliteQE#11301)
* autodetect and add prt tests for dependabot PR's * further updates on automerge the depedabot pr's
- Loading branch information
1 parent
87b5f75
commit 07ab974
Showing
4 changed files
with
110 additions
and
44 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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
broker[docker]: "tests/foreman/ -k 'test_host_registration_end_to_end or test_positive_erratum_applicability or test_positive_upload_content'" | ||
deepdiff: "tests/foreman/endtoend/test_api_endtoend.py -k 'test_positive_get_links'" | ||
dynaconf[vault]: "tests/foreman/api/test_ldapauthsource.py -k 'test_positive_endtoend'" | ||
manifester: "tests/foreman/api/test_subscription.py -k 'test_positive_create_after_refresh'" | ||
navmazing: "tests/foreman/ui/test_repository.py -k 'test_positive_create_as_non_admin_user'" | ||
pyotp: "tests/foreman/ui/test_ldap_authentication.py -k 'test_positive_login_user_password_otp'" | ||
pytest-xdist: "tests/foreman/ -n 3 -m 'build_sanity'" | ||
pytest: "tests/foreman/ -m 'build_sanity'" | ||
python-box: "tests/foreman/cli/test_webhook.py -k 'test_positive_end_to_end'" | ||
requests: "tests/foreman/cli/test_repository.py -k 'test_file_repo_contains_only_newer_file'" | ||
wait-for: "tests/foreman/api/test_reporttemplates.py -k 'test_positive_schedule_entitlements_report'" | ||
wrapanapi: "tests/foreman/longrun/test_provisioning_computeresource.py -k 'test_positive_provision_vmware_with_host_group'" |
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 |
---|---|---|
|
@@ -48,54 +48,23 @@ jobs: | |
running-workflow-name: 'Automerge auto-cherry-picked pr' | ||
allowed-conclusions: success,skipped | ||
|
||
- name: is PRT check Passed ? | ||
run: | | ||
api_endpoint="https://api.github.com/repos/${{github.repository}}/statuses/${{ github.head_ref }}" | ||
function get_status() { | ||
curl -s "$api_endpoint" | jq '[.[] | .state] | .[0]' | tr -d '"' | ||
} | ||
function get_context() { | ||
curl -s "$api_endpoint" | jq '[.[] | .context] | .[0]' | tr -d '"' | ||
} | ||
statuses_length=$(curl -s $api_endpoint | jq 'length') | ||
if [ $statuses_length -eq 0 ]; then | ||
echo "PRT failed to start ! Stopping." | ||
exit 1 | ||
fi | ||
status=$(get_status) | ||
context=$(get_context) | ||
if [ "$context" != "Robottelo-Runner" ]; then | ||
echo "::error Failed to get Robottelo-Runner status" | ||
exit 1 | ||
fi | ||
counter=0 | ||
echo "Waiting for PRT to complete....." | ||
while [ "$status" != "success" ] && [ "$status" != "failure" ]; do | ||
if [ $counter -gt 20 ]; then | ||
echo "PRT Timeout" | ||
exit 1 | ||
fi | ||
sleep 300 | ||
status=$(get_status) | ||
echo "Robottelo-Runner : $status" | ||
counter=$((counter+1)) | ||
done | ||
- name: Fetch the PRT status | ||
id: outcome | ||
uses: omkarkhatavkar/wait-for-status-checks@main | ||
with: | ||
ref: ${{ github.head_ref }} | ||
context: 'Robottelo Runner' | ||
wait-interval: 60 | ||
count: 100 | ||
|
||
if [ "$status" != "success" ]; then | ||
echo "Robottelo-Runner : $status" | ||
echo "::error PRT failed" | ||
exit 1 | ||
- name: Check the PRT status | ||
run: | | ||
if [ ${{ steps.outcome.outputs.result }} == 'success' ]; then | ||
echo "Status check passed!" | ||
else | ||
echo "PRT Passed Successfully!" | ||
echo "Status check failed!" | ||
fi | ||
- id: automerge | ||
name: Auto merge of cherry-picked PRs. | ||
uses: "pascalgn/[email protected]" | ||
|
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 |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Dependabot Auto Merge | ||
on: pull_request | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
dependabot: | ||
name: dependabot-auto-merge | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Find the tests for the dependency requirement | ||
id: yaml | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq e ".${{ steps.metadata.outputs.dependency-names }}" ./.github/dependency_tests.yaml | ||
|
||
- name: Add the PRT Comment | ||
if: steps.yaml.outputs.result != 'null' | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
trigger: test-robottelo\r | ||
pytest: ${{ steps.yaml.outputs.result }} | ||
- name: Wait for PRT checks to get initiated | ||
if: steps.yaml.outputs.result != 'null' | ||
run: | | ||
echo "Waiting for ~ 10 mins, PRT to be initiated." && sleep 600 | ||
- name: Fetch and Verify the PRT status | ||
if: steps.yaml.outputs.result != 'null' | ||
id: outcome | ||
uses: omkarkhatavkar/wait-for-status-checks@main | ||
with: | ||
ref: ${{ github.head_ref }} | ||
context: 'Robottelo-Runner' | ||
wait-interval: 60 | ||
count: 100 | ||
|
||
- name: Wait for other status checks to Pass | ||
id: waitforstatuschecks | ||
uses: lewagon/[email protected] | ||
with: | ||
ref: ${{ github.head_ref }} | ||
repo-token: ${{ secrets.CHERRYPICK_PAT }} | ||
wait-interval: 60 | ||
running-workflow-name: 'dependabot-auto-merge' | ||
allowed-conclusions: success,skipped | ||
|
||
- id: automerge | ||
name: Auto merge of dependabot PRs. | ||
uses: "pascalgn/[email protected]" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}" | ||
MERGE_LABELS: "dependencies" | ||
MERGE_METHOD: "squash" | ||
MERGE_RETRIES: 5 | ||
MERGE_RETRY_SLEEP: 900000 | ||
|
||
- name: Auto Merge Status | ||
run: | | ||
if [ "${{ steps.automerge.outputs.mergeResult }}" == 'merged' ]; then | ||
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} is Auto Merged !" | ||
else | ||
echo "::error Auto Merge for Pull request failed !" | ||
exit 1 | ||
fi |