Skip to content

Commit

Permalink
Merge branch '6.15.z' of github.com:SatelliteQE/robottelo into 6.15.z
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible committed May 10, 2024
2 parents 5773524 + 41f10f9 commit 0a199be
Show file tree
Hide file tree
Showing 525 changed files with 13,904 additions and 12,424 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto_assignment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
if: "!contains(github.event.pull_request.labels.*.name, 'Auto_Cherry_Picked')"
runs-on: ubuntu-latest
steps:
- uses: kentaro-m/auto-assign-action@v1.2.5
- uses: kentaro-m/auto-assign-action@v2.0.0
with:
configuration-path: ".github/auto_assign.yml"
23 changes: 19 additions & 4 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
prt_comment: ${{steps.fc.outputs.comment-body}}
steps:
- name: Find Comment
uses: peter-evans/find-comment@v2
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ env.number }}
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's
id: add-parent-prt-comment
if: ${{ always() && steps.cherrypick.outcome == 'success' }}
if: ${{ always() && needs.find-the-parent-prt-comment.outputs.prt_comment != '' && steps.cherrypick.outcome == 'success' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Expand All @@ -97,10 +97,25 @@ jobs:
labels: ["AutoMerge_Cherry_Picked"]
})
## Failure Logging to issues and GChat Group
- name: Check if cherrypick pr is created
id: search_pr
if: always()
run: |
PR_TITLE="[${{ matrix.label }}] ${{ env.title }}"
API_URL="https://api.github.com/repos/${{ github.repository }}/pulls?state=open"
PR_SEARCH_RESULT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$API_URL" | jq --arg title "$PR_TITLE" '.[] | select(.title == $title)')
if [ -n "$PR_SEARCH_RESULT" ]; then
echo "pr_found=true" >> $GITHUB_OUTPUT
echo "PR is Found with title $PR_TITLE"
else
echo "pr_found=false" >> $GITHUB_OUTPUT
echo "PR is not Found with title $PR_TITLE"
fi
## Failure Logging to issues
- name: Create Github issue on cherrypick failure
id: create-issue
if: ${{ always() && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }}
if: ${{ always() && steps.search_pr.outputs.pr_found == 'false' && steps.cherrypick.outcome != 'success' && startsWith(matrix.label, '6.') && matrix.label != github.base_ref }}
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.CHERRYPICK_PAT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto_cherry_pick_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
- id: automerge
name: Auto merge of cherry-picked PRs.
uses: "pascalgn/automerge-action@v0.15.6"
uses: "pascalgn/automerge-action@v0.16.2"
env:
GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}"
MERGE_LABELS: "AutoMerge_Cherry_Picked, Auto_Cherry_Picked"
Expand Down
54 changes: 20 additions & 34 deletions .github/workflows/dependency_merge.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,32 @@
name: Dependabot Auto Merge
on: pull_request

permissions:
pull-requests: write
name: Dependabot Auto Merge - ZStream
on:
pull_request_target:
branches-ignore:
- master

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@v4
with:
fetch-depth: 0
if: |
contains(github.event.pull_request.labels.*.name, 'dependencies')
- name: Find the tests for the dependency requirement
id: yaml
uses: mikefarah/yq@master
steps:
- id: find-prt-comment
name: Find the prt comment
uses: peter-evans/find-comment@v2
with:
cmd: yq e '.["${{ steps.metadata.outputs.dependency-names }}"]' ./.github/dependency_tests.yaml
issue-number: ${{ github.event.number }}
body-includes: "trigger: test-robottelo"
direction: last

- 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'
if: steps.find-prt-comment.outputs.comment-body != ''
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'
if: steps.find-prt-comment.outputs.comment-body != ''
id: outcome
uses: omkarkhatavkar/wait-for-status-checks@main
with:
Expand All @@ -54,16 +40,16 @@ jobs:
uses: lewagon/[email protected]
with:
ref: ${{ github.head_ref }}
repo-token: ${{ secrets.CHERRYPICK_PAT }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60
running-workflow-name: 'dependabot-auto-merge'
allowed-conclusions: success,skipped

- id: automerge
name: Auto merge of dependabot PRs.
uses: "pascalgn/automerge-action@v0.15.6"
uses: "pascalgn/automerge-action@v0.16.2"
env:
GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "dependencies"
MERGE_METHOD: "squash"
MERGE_RETRIES: 5
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/prt_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Remove the PRT label, for the new commit

on:
pull_request_target:
types: ["synchronize"]

jobs:
prt_labels_remover:
name: remove the PRT label when amendments or new commits added to PR
runs-on: ubuntu-latest
if: "(contains(github.event.pull_request.labels.*.name, 'PRT-Passed'))"
steps:
- name: Avoid the race condition as PRT result will be cleaned
run: |
echo "Avoiding the race condition if prt result will be cleaned" && sleep 60
- name: Fetch the PRT status
id: prt
uses: omkarkhatavkar/wait-for-status-checks@main
with:
ref: ${{ github.head_ref }}
context: 'Robottelo-Runner'
wait-interval: 2
count: 5

- name: remove the PRT Passed label, for new commit
if: always() && ${{steps.prt.outputs.result}} == 'not_found'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const prNumber = '${{ github.event.number }}';
const issue = await github.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const labelsToRemove = ['PRT-Passed'];
const labelsToRemoveFiltered = labelsToRemove.filter(label => issue.data.labels.some(({ name }) => name === label));
if (labelsToRemoveFiltered.length > 0) {
await Promise.all(labelsToRemoveFiltered.map(async label => {
await github.rest.issues.removeLabel({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
name: label
});
}));
}
84 changes: 84 additions & 0 deletions .github/workflows/prt_result.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
### The prt result workflow triggered through dispatch request from CI
name: post-prt-result

# Run on workflow dispatch from CI
on:
workflow_dispatch:
inputs:
pr_number:
type: string
description: pr number for PRT run
build_number:
type: string
description: build number for PRT run
pytest_result:
type: string
description: pytest summary result line
build_status:
type: string
description: status of jenkins build e.g. success, unstable or error
prt_comment:
type: string
description: prt pytest comment triggered the PRT checks


jobs:
post-the-prt-result:
runs-on: ubuntu-latest

steps:
- name: Add last PRT result into the github comment
id: add-prt-comment
if: ${{ always() && github.event.inputs.pytest_result != '' }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
**PRT Result**
```
Build Number: ${{ github.event.inputs.build_number }}
Build Status: ${{ github.event.inputs.build_status }}
PRT Comment: ${{ github.event.inputs.prt_comment }}
Test Result : ${{ github.event.inputs.pytest_result }}
```
pr_number: ${{ github.event.inputs.pr_number }}
GITHUB_TOKEN: ${{ secrets.CHERRYPICK_PAT }}

- name: Add the PRT passed/failed labels
id: prt-status
if: ${{ always() && github.event.inputs.build_status != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const prNumber = ${{ github.event.inputs.pr_number }};
const buildStatus = "${{ github.event.inputs.build_status }}";
const labelToAdd = buildStatus === "SUCCESS" ? "PRT-Passed" : "PRT-Failed";
github.rest.issues.addLabels({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [labelToAdd]
});
- name: Remove failed label on test pass or vice-versa
if: ${{ always() && github.event.inputs.build_status != '' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const prNumber = ${{ github.event.inputs.pr_number }};
const issue = await github.rest.issues.get({
owner: context.issue.owner,
repo: context.issue.repo,
issue_number: prNumber,
});
const buildStatus = "${{ github.event.inputs.build_status }}";
const labelToRemove = buildStatus === "SUCCESS" ? "PRT-Failed" : "PRT-Passed";
const labelExists = issue.data.labels.some(({ name }) => name === labelToRemove);
if (labelExists) {
github.rest.issues.removeLabel({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
name: [labelToRemove]
});
}
6 changes: 2 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ on:
env:
PYCURL_SSL_LIBRARY: openssl
ROBOTTELO_BUGZILLA__API_KEY: ${{ secrets.BUGZILLA_KEY }}
ROBOTTELO_JIRA__API_KEY: ${{ secrets.JIRA_KEY }}

jobs:
codechecks:
name: Code Quality
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand All @@ -41,9 +42,6 @@ jobs:
cp broker_settings.yaml.example broker_settings.yaml
cp .env.example .env
- name: Pre Commit Checks
uses: pre-commit/[email protected]

- name: Collect Tests
run: |
# To skip vault login in pull request checks
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11]
python-version: [3.12]
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand Down Expand Up @@ -55,6 +55,7 @@ jobs:
id: cscheck
env:
ROBOTTELO_BUGZILLA__API_KEY: ${{ secrets.BUGZILLA_KEY }}
ROBOTTELO_JIRA__API_KEY: ${{ secrets.JIRA_KEY }}

- name: Customer scenario status
run: |
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# configuration for pre-commit git hooks

ci:
autofix_prs: false # disable autofixing PRs

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: tests/foreman/data/
- id: check-yaml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.277
rev: v0.4.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: local
hooks:
- id: fix-uuids
Expand All @@ -28,6 +28,6 @@ repos:
types: [text]
require_serial: true
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
rev: v8.18.2
hooks:
- id: gitleaks
2 changes: 2 additions & 0 deletions conf/capsule.yaml.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
CAPSULE:
# Capsule hostname for N-minus testing
HOSTNAME:
VERSION:
# The full release version (6.9.2)
RELEASE: # populate with capsule version
Expand Down
9 changes: 4 additions & 5 deletions conf/dynaconf_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def get_ohsnap_repos(settings):
settings,
repo='capsule',
product='capsule',
release=settings.server.version.release,
os_release=settings.server.version.rhel_version,
snap=settings.server.version.snap,
release=settings.capsule.version.release,
os_release=settings.capsule.version.rhel_version,
snap=settings.capsule.version.snap,
)

data['SATELLITE_REPO'] = get_ohsnap_repo_url(
Expand Down Expand Up @@ -157,12 +157,11 @@ def get_dogfood_satclient_repos(settings):


def get_ohsnap_repo_url(settings, repo, product=None, release=None, os_release=None, snap=''):
repourl = dogfood_repository(
return dogfood_repository(
settings.ohsnap,
repo=repo,
product=product,
release=release,
os_release=os_release,
snap=snap,
).baseurl
return repourl
Loading

0 comments on commit 0a199be

Please sign in to comment.