Skip to content

Commit

Permalink
Merge branch 'SatelliteQE:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jyejare authored Oct 19, 2024
2 parents 78d9b53 + bdbe401 commit 225c22a
Show file tree
Hide file tree
Showing 547 changed files with 17,104 additions and 17,084 deletions.
311 changes: 309 additions & 2 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ updates:
schedule:
interval: "daily"
labels:
- '6.16.z'
- "CherryPick"
- "dependencies"
- "6.15.z"
- "6.14.z"
- "6.13.z"
- "6.12.z"

# Maintain dependencies for our GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- '6.16.z'
- "CherryPick"
- "dependencies"
- "6.15.z"
- "6.14.z"
- "6.13.z"
- "6.12.z"
6 changes: 3 additions & 3 deletions .github/dependency_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
broker[docker]: "tests/foreman/ -k 'test_host_registration_end_to_end or test_positive_erratum_applicability or test_positive_upload_content'"
broker: "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'"
dynaconf: "tests/foreman/api/test_ldapauthsource.py -k 'test_positive_endtoend'"
manifester: "tests/foreman/cli/test_contentview.py -k 'test_positive_promote_rh_content'"
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'"
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/auto_branching.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ jobs:
old_url="https://raw.githubusercontent.com/SatelliteQE/robottelo/master/tests/foreman/data/uri.sh"
new_url="https://raw.githubusercontent.com/SatelliteQE/robottelo/${{ github.event.inputs.target_branch }}/tests/foreman/data/uri.sh"
FILE_PATH="./robottelo/constants/__init__.py"
awk '/SAT_NON_GA_VERSIONS =/ { sub(/\[[^,]*, /, "[", $0) } 1' "$FILE_PATH" > temp && mv temp "$FILE_PATH"
sed -i.bak "s|${old_url}|${new_url}|" "$FILE_PATH"
rm "$FILE_PATH.bak"
Expand Down Expand Up @@ -160,12 +159,12 @@ jobs:

- name: Add the prt comment for running the sanity tests
id: add-parent-prt-comment
uses: thollander/actions-comment-pull-request@v2
uses: thollander/actions-comment-pull-request@v3
with:
message: |
trigger: test-robottelo
pr_number: ${{ steps.create_pr.outputs.pr_number }}
GITHUB_TOKEN: ${{ secrets._REPO_ADMIN_TOKEN }}
pr-number: ${{ steps.create_pr.outputs.pr_number }}
github-token: ${{ secrets._REPO_ADMIN_TOKEN }}

- name: add the no-cherrypick label
uses: actions/github-script@v7
Expand Down Expand Up @@ -258,7 +257,6 @@ jobs:
# update the version
sed -i.bak "s/SATELLITE_VERSION = \"$old_stream_version\"/SATELLITE_VERSION = \"$new_stream_version\"/" "$FILE_PATH"
sed -i.bak "s/ SATELLITE_VERSION: \"$old_stream_version\"/ SATELLITE_VERSION: \"$new_stream_version\"/" ./conf/robottelo.yaml.template
sed -i.bak "s/SAT_NON_GA_VERSIONS = \[.*\]/SAT_NON_GA_VERSIONS = $non_ga_versions/" "$FILE_PATH"
rm "$FILE_PATH.bak" "./conf/robottelo.yaml.template.bak"
- name: git status
Expand Down Expand Up @@ -297,12 +295,12 @@ jobs:

- name: Add the prt comment for running the sanity tests
id: add-parent-prt-comment
uses: thollander/actions-comment-pull-request@v2
uses: thollander/actions-comment-pull-request@v3
with:
message: |
trigger: test-robottelo
pr_number: ${{ steps.create_pr.outputs.pr_number }}
GITHUB_TOKEN: ${{ secrets._REPO_ADMIN_TOKEN }}
pr-number: ${{ steps.create_pr.outputs.pr_number }}
github-token: ${{ secrets._REPO_ADMIN_TOKEN }}

- name: add the no-cherrypick label
uses: actions/github-script@v7
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ jobs:
- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's
id: add-parent-prt-comment
if: ${{ always() && needs.find-the-parent-prt-comment.outputs.prt_comment != '' && steps.cherrypick.outcome == 'success' }}
uses: thollander/actions-comment-pull-request@v2
uses: thollander/actions-comment-pull-request@v3
with:
message: |
${{ needs.find-the-parent-prt-comment.outputs.prt_comment }}
pr_number: ${{ steps.cherrypick.outputs.number }}
GITHUB_TOKEN: ${{ secrets.CHERRYPICK_PAT }}
pr-number: ${{ steps.cherrypick.outputs.number }}
github-token: ${{ secrets.CHERRYPICK_PAT }}

- name: is autoMerging enabled for Auto CherryPicked PRs ?
if: ${{ always() && steps.cherrypick.outcome == 'success' && contains(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') }}
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.16.2"
uses: "pascalgn/automerge-action@v0.16.4"
env:
GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}"
MERGE_LABELS: "AutoMerge_Cherry_Picked, Auto_Cherry_Picked"
Expand Down
169 changes: 169 additions & 0 deletions .github/workflows/auto_cherry_pick_merged.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
### The workflow for retrying/rerunning the merged PRs AutoCherryPick which was missed/failed due to any circumstances
name: Retry Merged PRs AutoCherryPick

# Run on workflow dispatch from CI
on:
workflow_dispatch:
inputs:
parent_pr:
type: string
description: |
An identifier for parent PR to retry it's cherrypick
e.g 12314
branches:
type: string
description: |
Comma separated list of branches where the master PR to be cherrypicked.
e.g: 6.15.z, 6.16.z
env:
number: ${{ github.event.inputs.parent_pr }}
is_dependabot_pr: ''

jobs:
get-parentPR-details:
runs-on: ubuntu-latest
outputs:
labels: ${{ steps.parentPR.outputs.labels }}
state: ${{ steps.parentPR.outputs.state }}
base_ref: ${{ steps.parentPR.outputs.base_ref }}
assignee: ${{ steps.parentPR.outputs.assignee }}
title: ${{ steps.parentPR.outputs.title }}
prt_comment: ${{ steps.fc.outputs.comment-body }}

steps:
- name: Find parent PR details
id: parentPR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ env.number }},
});
core.setOutput('labels', pr.labels);
core.setOutput('state', pr.state);
core.setOutput('base_ref', pr.base.ref);
core.setOutput('assignee', pr.assignee.login);
core.setOutput('title', pr.title);
- name: Find & Save last PRT comment of Parent PR
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ env.number }}
body-includes: "trigger: test-robottelo"
direction: last

- name: Print PR details
run: |
echo "Labels are ${{ steps.parentPR.outputs.labels }}"
echo "State is ${{ steps.parentPR.outputs.state }}"
echo "Base Ref is ${{ steps.parentPR.outputs.base_ref }}"
echo "Assignee is ${{ steps.parentPR.outputs.assignee }}"
echo "Title is ${{ steps.parentPR.outputs.title }}"
arrayconversion:
needs: get-parentPR-details
if: ${{ needs.get-parentPR-details.outputs.state }} == closed
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.conversion.outputs.branches }}
steps:
- name: Convert String to List
id: conversion
uses: actions/github-script@v7
with:
script: |
const branches = "${{ github.event.inputs.branches }}";
const branchesArray = branches.includes(',') ? branches.split(',').map(item => item.trim()) : [branches.trim()];
core.setOutput('branches', JSON.stringify(branchesArray));
run-the-branch-matrix:
name: Auto Cherry Pick to labeled branches
runs-on: ubuntu-latest
needs: [arrayconversion, get-parentPR-details]
if: ${{ needs.arrayconversion.outputs.branches != '' }}
strategy:
matrix:
branch: ${{ fromJson(needs.arrayconversion.outputs.branches) }}
steps:
- name: Tell me the branch name
run: |
echo "Branch is: ${{ matrix.branch }}"
# Needed to avoid out-of-memory error
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10

## Robottelo Repo Checkout
- uses: actions/checkout@v4
if: ${{ startsWith(matrix.branch, '6.') && matrix.branch != needs.get-parentPR-details.outputs.base_ref }}
with:
fetch-depth: 0

## Set env var for dependencies label PR
- name: Set env var is_dependabot_pr to `dependencies` to set the label
if: contains(needs.get-parentPR-details.outputs.labels.*.name, 'dependencies')
run: |
echo "is_dependabot_pr=dependencies" >> $GITHUB_ENV
## CherryPicking and AutoMerging
- name: Cherrypicking to zStream branch
id: cherrypick
if: ${{ startsWith(matrix.branch, '6.') && matrix.branch != needs.get-parentPR-details.outputs.base_ref }}
uses: jyejare/github-cherry-pick-action@main
with:
token: ${{ secrets.CHERRYPICK_PAT }}
pull_number: ${{ env.number }}
branch: ${{ matrix.branch }}
labels: |
Auto_Cherry_Picked
${{ matrix.branch }}
No-CherryPick
${{ env.is_dependabot_pr }}
assignees: ${{ needs.get-parentPR-details.outputs.assignee }}

- name: Add Parent PR's PRT comment to Auto_Cherry_Picked PR's
id: add-parent-prt-comment
if: ${{ always() && needs.get-parentPR-details.outputs.prt_comment != '' && steps.cherrypick.outcome == 'success' }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
${{ needs.get-parentPR-details.outputs.prt_comment }}
pr-number: ${{ steps.cherrypick.outputs.number }}
github-token: ${{ secrets.CHERRYPICK_PAT }}

- name: is autoMerging enabled for Auto CherryPicked PRs ?
if: ${{ always() && steps.cherrypick.outcome == 'success' && contains(needs.get-parentPR-details.outputs.labels.*.name, 'AutoMerge_Cherry_Picked') }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CHERRYPICK_PAT }}
script: |
github.rest.issues.addLabels({
issue_number: ${{ steps.cherrypick.outputs.number }},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["AutoMerge_Cherry_Picked"]
})
- name: Check if cherrypick pr is created
id: search_pr
if: always()
run: |
PR_TITLE="[${{ matrix.branch }}] ${{ needs.get-parentPR-details.outputs.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
4 changes: 2 additions & 2 deletions .github/workflows/dependency_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
id: yaml
uses: mikefarah/yq@master
with:
cmd: yq e '.["${{ steps.metadata.outputs.dependency-names }}"]' ./.github/dependency_tests.yaml
cmd: yq eval '.["${{ steps.metadata.outputs.dependency-names }}"|split("[")[0]]' ./.github/dependency_tests.yaml

- name: Add the PRT Comment
if: steps.yaml.outputs.result != 'null'
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

- id: automerge
name: Auto merge of dependabot PRs.
uses: "pascalgn/automerge-action@v0.16.2"
uses: "pascalgn/automerge-action@v0.16.4"
env:
GITHUB_TOKEN: "${{ secrets.CHERRYPICK_PAT }}"
MERGE_LABELS: "dependencies"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prt_labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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') || contains(github.event.pull_request.labels.*.name, 'PRT-Failed'))"
if: "(contains(github.event.pull_request.labels.*.name, 'PRT-Passed'))"
steps:
- name: Avoid the race condition as PRT result will be cleaned
run: |
Expand All @@ -23,7 +23,7 @@ jobs:
wait-interval: 2
count: 5

- name: remove the PRT Passed/Failed label, for new commit
- name: remove the PRT Passed label, for new commit
if: always() && ${{steps.prt.outputs.result}} == 'not_found'
uses: actions/github-script@v7
with:
Expand All @@ -35,7 +35,7 @@ jobs:
repo: context.repo.repo,
issue_number: prNumber,
});
const labelsToRemove = ['PRT-Failed', 'PRT-Passed'];
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 => {
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/prt_result.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- 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
uses: thollander/actions-comment-pull-request@v3
with:
message: |
**PRT Result**
Expand All @@ -40,8 +40,8 @@ jobs:
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 }}
pr-number: ${{ github.event.inputs.pr_number }}
github-token: ${{ secrets.CHERRYPICK_PAT }}

- name: Add the PRT passed/failed labels
id: prt-status
Expand Down
Loading

0 comments on commit 225c22a

Please sign in to comment.