Skip to content

Commit

Permalink
Merge branch '6.13.z' into 6.13.z
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCallahan authored Mar 20, 2024
2 parents 91f6278 + c9c9249 commit cde15bd
Show file tree
Hide file tree
Showing 153 changed files with 769 additions and 884 deletions.
41 changes: 32 additions & 9 deletions .github/workflows/auto_cherry_pick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: auto_cherry_pick_commits

on:
pull_request_target:
types: [closed, labeled]
types: [closed]

# Github & Parent PR Env vars
env:
Expand All @@ -23,11 +23,12 @@ 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 }}
body-includes: "trigger: test-robottelo"
direction: last

# Auto CherryPicking and Failure Recording
auto-cherry-pick:
Expand All @@ -40,6 +41,12 @@ jobs:
label: ${{ github.event.pull_request.labels.*.name }}

steps:
# 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.label, '6.') && matrix.label != github.base_ref }}
Expand Down Expand Up @@ -69,12 +76,13 @@ 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' }}
uses: mshick/add-pr-comment@v2
if: ${{ always() && needs.find-the-parent-prt-comment.outputs.prt_comment != '' && steps.cherrypick.outcome == 'success' }}
uses: thollander/actions-comment-pull-request@v2
with:
issue: ${{ steps.cherrypick.outputs.number }}
message: ${{ needs.find-the-parent-prt-comment.outputs.prt_comment }}
repo-token: ${{ secrets.CHERRYPICK_PAT }}
message: |
${{ needs.find-the-parent-prt-comment.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(github.event.pull_request.labels.*.name, 'AutoMerge_Cherry_Picked') }}
Expand All @@ -89,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
3 changes: 1 addition & 2 deletions conf/dynaconf_hooks.py
Original file line number Diff line number Diff line change
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
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ select = [
"I", # isort
# "Q", # flake8-quotes
"PT", # flake8-pytest
"RET", # flake8-return
"SIM", # flake8-simplify
"UP", # pyupgrade
"W", # pycodestyle
]
Expand Down
12 changes: 4 additions & 8 deletions pytest_fixtures/component/activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,28 @@
@pytest.fixture(scope='module')
def module_activation_key(module_entitlement_manifest_org, module_target_sat):
"""Create activation key using default CV and library environment."""
activation_key = module_target_sat.api.ActivationKey(
module_target_sat.api.ActivationKey(
content_view=module_entitlement_manifest_org.default_content_view.id,
environment=module_entitlement_manifest_org.library.id,
organization=module_entitlement_manifest_org,
).create()
return activation_key


@pytest.fixture(scope='module')
def module_ak(module_lce, module_org, module_target_sat):
ak = module_target_sat.api.ActivationKey(
return module_target_sat.api.ActivationKey(
environment=module_lce,
organization=module_org,
).create()
return ak


@pytest.fixture(scope='module')
def module_ak_with_cv(module_lce, module_org, module_promoted_cv, module_target_sat):
ak = module_target_sat.api.ActivationKey(
return module_target_sat.api.ActivationKey(
content_view=module_promoted_cv,
environment=module_lce,
organization=module_org,
).create()
return ak


@pytest.fixture(scope='module')
Expand All @@ -45,12 +42,11 @@ def module_ak_with_synced_repo(module_org, module_target_sat):
{'product-id': new_product['id'], 'content-type': 'yum'}
)
Repository.synchronize({'id': new_repo['id']})
ak = module_target_sat.cli_factory.make_activation_key(
return module_target_sat.cli_factory.make_activation_key(
{
'lifecycle-environment': 'Library',
'content-view': 'Default Organization View',
'organization-id': module_org.id,
'auto-attach': False,
}
)
return ak
6 changes: 2 additions & 4 deletions pytest_fixtures/component/architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@

@pytest.fixture(scope='session')
def default_architecture(session_target_sat):
arch = (
return (
session_target_sat.api.Architecture()
.search(query={'search': f'name="{DEFAULT_ARCHITECTURE}"'})[0]
.read()
)
return arch


@pytest.fixture(scope='session')
def session_puppet_default_architecture(session_puppet_enabled_sat):
arch = (
return (
session_puppet_enabled_sat.api.Architecture()
.search(query={'search': f'name="{DEFAULT_ARCHITECTURE}"'})[0]
.read()
)
return arch


@pytest.fixture(scope='module')
Expand Down
3 changes: 1 addition & 2 deletions pytest_fixtures/component/contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ def module_ak_cv_lce(module_org, module_lce, module_published_cv, module_target_
content_view_version = module_published_cv.version[0]
content_view_version.promote(data={'environment_ids': module_lce.id})
module_published_cv = module_published_cv.read()
module_ak_with_cv_lce = module_target_sat.api.ActivationKey(
return module_target_sat.api.ActivationKey(
content_view=module_published_cv,
environment=module_lce,
organization=module_org,
).create()
return module_ak_with_cv_lce


@pytest.fixture(scope='module')
Expand Down
3 changes: 1 addition & 2 deletions pytest_fixtures/component/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ def default_os(
os.ptable.append(default_partitiontable)
os.provisioning_template.append(default_pxetemplate)
os.update(['architecture', 'ptable', 'provisioning_template'])
os = entities.OperatingSystem(id=os.id).read()
return os
return entities.OperatingSystem(id=os.id).read()


@pytest.fixture(scope='module')
Expand Down
24 changes: 8 additions & 16 deletions pytest_fixtures/component/provision_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,23 @@ def sat_azure_default_os(sat_azure):

@pytest.fixture(scope='module')
def sat_azure_default_architecture(sat_azure):
arch = (
return (
sat_azure.api.Architecture()
.search(query={'search': f'name="{DEFAULT_ARCHITECTURE}"'})[0]
.read()
)
return arch


@pytest.fixture(scope='session')
def azurerm_settings():
deps = {
return {
'tenant': settings.azurerm.tenant_id,
'app_ident': settings.azurerm.client_id,
'sub_id': settings.azurerm.subscription_id,
'resource_group': settings.azurerm.resource_group,
'secret': settings.azurerm.client_secret,
'region': settings.azurerm.azure_region.lower().replace(' ', ''),
}
return deps


@pytest.fixture(scope='session')
Expand All @@ -86,7 +84,7 @@ def azurermclient(azurerm_settings):
@pytest.fixture(scope='module')
def module_azurerm_cr(azurerm_settings, sat_azure_org, sat_azure_loc, sat_azure):
"""Create AzureRM Compute Resource"""
azure_cr = sat_azure.api.AzureRMComputeResource(
return sat_azure.api.AzureRMComputeResource(
name=gen_string('alpha'),
provider='AzureRm',
tenant=azurerm_settings['tenant'],
Expand All @@ -97,7 +95,6 @@ def module_azurerm_cr(azurerm_settings, sat_azure_org, sat_azure_loc, sat_azure)
organization=[sat_azure_org],
location=[sat_azure_loc],
).create()
return azure_cr


@pytest.fixture(scope='module')
Expand All @@ -108,15 +105,14 @@ def module_azurerm_finishimg(
module_azurerm_cr,
):
"""Creates Finish Template image on AzureRM Compute Resource"""
finish_image = sat_azure.api.Image(
return sat_azure.api.Image(
architecture=sat_azure_default_architecture,
compute_resource=module_azurerm_cr,
name=gen_string('alpha'),
operatingsystem=sat_azure_default_os,
username=settings.azurerm.username,
uuid=AZURERM_RHEL7_FT_IMG_URN,
).create()
return finish_image


@pytest.fixture(scope='module')
Expand All @@ -127,15 +123,14 @@ def module_azurerm_byos_finishimg(
sat_azure,
):
"""Creates BYOS Finish Template image on AzureRM Compute Resource"""
finish_image = sat_azure.api.Image(
return sat_azure.api.Image(
architecture=sat_azure_default_architecture,
compute_resource=module_azurerm_cr,
name=gen_string('alpha'),
operatingsystem=sat_azure_default_os,
username=settings.azurerm.username,
uuid=AZURERM_RHEL7_FT_BYOS_IMG_URN,
).create()
return finish_image


@pytest.fixture(scope='module')
Expand All @@ -146,7 +141,7 @@ def module_azurerm_cloudimg(
module_azurerm_cr,
):
"""Creates cloudinit image on AzureRM Compute Resource"""
finish_image = sat_azure.api.Image(
return sat_azure.api.Image(
architecture=sat_azure_default_architecture,
compute_resource=module_azurerm_cr,
name=gen_string('alpha'),
Expand All @@ -155,7 +150,6 @@ def module_azurerm_cloudimg(
uuid=AZURERM_RHEL7_UD_IMG_URN,
user_data=True,
).create()
return finish_image


@pytest.fixture(scope='module')
Expand All @@ -166,15 +160,14 @@ def module_azurerm_gallery_finishimg(
module_azurerm_cr,
):
"""Creates Shared Gallery Finish Template image on AzureRM Compute Resource"""
finish_image = sat_azure.api.Image(
return sat_azure.api.Image(
architecture=sat_azure_default_architecture,
compute_resource=module_azurerm_cr,
name=gen_string('alpha'),
operatingsystem=sat_azure_default_os,
username=settings.azurerm.username,
uuid=AZURERM_RHEL7_FT_GALLERY_IMG_URN,
).create()
return finish_image


@pytest.fixture(scope='module')
Expand All @@ -185,12 +178,11 @@ def module_azurerm_custom_finishimg(
module_azurerm_cr,
):
"""Creates Custom Finish Template image on AzureRM Compute Resource"""
finish_image = sat_azure.api.Image(
return sat_azure.api.Image(
architecture=sat_azure_default_architecture,
compute_resource=module_azurerm_cr,
name=gen_string('alpha'),
operatingsystem=sat_azure_default_os,
username=settings.azurerm.username,
uuid=AZURERM_RHEL7_FT_CUSTOM_IMG_URN,
).create()
return finish_image
2 changes: 1 addition & 1 deletion pytest_fixtures/component/provision_capsule_pxe.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def capsule_provisioning_rhel_content(
releasever=constants.REPOS['kickstart'][name]['version'],
)
# do not sync content repos for discovery based provisioning.
if not capsule_provisioning_sat.provisioning_type == 'discovery':
if capsule_provisioning_sat.provisioning_type != 'discovery':
rh_repo_id = sat.api_factory.enable_rhrepo_and_fetchid(
basearch=constants.DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
Expand Down
Loading

0 comments on commit cde15bd

Please sign in to comment.