Skip to content

Commit

Permalink
Merge branch '6.13.z' into cherry-pick-6.13.z-fa4bc0fc6c900fe89271155…
Browse files Browse the repository at this point in the history
…de5764ee38bf13a40
  • Loading branch information
shweta83 authored Sep 17, 2024
2 parents f47cb0e + 3e5742f commit c732bc7
Show file tree
Hide file tree
Showing 58 changed files with 823 additions and 288 deletions.
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@v2
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
28 changes: 21 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:
PYCURL_SSL_LIBRARY: openssl
ROBOTTELO_BUGZILLA__API_KEY: ${{ secrets.BUGZILLA_KEY }}
ROBOTTELO_JIRA__API_KEY: ${{ secrets.JIRA_KEY }}
ROBOTTELO_ROBOTTELO__SETTINGS__IGNORE_VALIDATION_ERRORS: true

jobs:
codechecks:
Expand All @@ -18,6 +17,9 @@ jobs:
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
env:
UV_CACHE_DIR: /tmp/.uv-cache
UV_SYSTEM_PYTHON: 1
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand All @@ -27,22 +29,34 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install Dependencies
run: |
sudo apt update
sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev
wget https://raw.githubusercontent.com/SatelliteQE/broker/master/broker_settings.yaml.example
# link vs compile time ssl implementations can break the environment when installing requirements
# Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change
# Then compile and install it with PYCURL_SSL_LIBRARY set to openssl
pip install -U pip wheel
pip uninstall -y pycurl
pip install --compile --no-cache-dir pycurl
pip install -U --no-cache-dir -r requirements.txt -r requirements-optional.txt
uv pip uninstall pycurl
uv pip install --compile --no-cache-dir pycurl
uv pip install -r requirements.txt -r requirements-optional.txt
for conffile in conf/*.yaml.template; do mv -- "$conffile" "${conffile%.yaml.template}.yaml"; done
cp broker_settings.yaml.example broker_settings.yaml
cp .env.example .env
- name: Minimize uv cache
run: uv cache prune --ci

- name: Collect Tests
run: |
# To skip vault login in pull request checks
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update_robottelo_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# do not store the auth token in git config
persist-credentials: false

- name: Get image tag
id: image_tag
Expand Down
31 changes: 23 additions & 8 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
strategy:
matrix:
python-version: [3.12]
env:
UV_CACHE_DIR: /tmp/.uv-cache
UV_SYSTEM_PYTHON: 1
steps:
- name: Checkout Robottelo
uses: actions/checkout@v4
Expand All @@ -24,22 +27,34 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install Dependencies
run: |
sudo apt-get update -y
sudo apt update
sudo apt-get install -y libgnutls28-dev libcurl4-openssl-dev libssl-dev
wget https://raw.githubusercontent.com/SatelliteQE/broker/master/broker_settings.yaml.example
# link vs compile time ssl implementations can break the environment when installing requirements
# Uninstall pycurl - its likely not installed, but in case the ubuntu-latest packages change
# Then compile and install it with PYCURL_SSL_LIBRARY set to openssl
pip install -U pip
pip uninstall -y pycurl
pip install --compile --no-cache-dir pycurl
pip install -U -r requirements.txt -r requirements-optional.txt
uv pip uninstall pycurl
uv pip install --compile --no-cache-dir pycurl
uv pip install -r requirements.txt -r requirements-optional.txt
for conffile in conf/*.yaml.template; do mv -- "$conffile" "${conffile%.yaml.template}.yaml"; done
cp broker_settings.yaml.example broker_settings.yaml
cp .env.example .env
- name: Minimize uv cache
run: uv cache prune --ci

- name: Customer scenario check
run: |
touch .env.md
Expand All @@ -48,7 +63,7 @@ jobs:
echo "assignees: pondrejk " >> .env.md
echo "labels: Documentation" >> .env.md
echo "---" >> .env.md
echo CS_TAGS="$(make customer-scenario-check)" >> .env.md
echo CS_TAGS="$(make customer-scenario-check-jira)" >> .env.md
if grep 'The following tests need customerscenario tags' .env.md; then
echo "::set-output name=result::0"
fi
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ logs/**
/inventory.yaml

# manifester local files
/manifester_inventory.yaml
/manifester_settings.yaml
/manifests/

Expand Down Expand Up @@ -80,11 +81,6 @@ tests/foreman/pytest.ini
/conf/*.conf
!/conf/supportability.yaml

# I don't know where those 2 files come from
# but they are always there.
full_upgrade
upgrade_highlights

#Robottelo artifact
screenshots/
tmp/
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM fedora:38
FROM quay.io/fedora/python-312:latest
MAINTAINER https://github.com/SatelliteQE

RUN dnf install -y gcc git make cmake libffi-devel openssl-devel python3-devel \
python3-pip redhat-rpm-config which libcurl-devel libxml2-devel
ENV PYCURL_SSL_LIBRARY=openssl \
ROBOTTELO_DIR="${HOME}/robottelo"

COPY / /robottelo/
WORKDIR /robottelo
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

ENV PYCURL_SSL_LIBRARY=openssl
RUN pip install -r requirements.txt
USER 1001
COPY --chown=1001:0 / ${ROBOTTELO_DIR}

WORKDIR "${ROBOTTELO_DIR}"
RUN uv pip install -r requirements.txt

CMD make test-robottelo
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ clean-cache:

clean-all: docs-clean logs-clean pyc-clean clean-cache clean-shared

customer-scenario-check:
@scripts/customer_scenarios.py
customer-scenario-check-bz:
@scripts/customer_scenarios.py --bz

customer-scenario-check-jira:
@scripts/customer_scenarios.py --jira

vault-login:
@scripts/vault_login.py --login
Expand Down
2 changes: 1 addition & 1 deletion conf/capsule.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ CAPSULE:
PRODUCT: deploy-capsule # workflow to deploy OS with product running on top of it
OS: deploy-rhel # workflow to deploy OS that is ready to run the product
# Dictionary of arguments which should be passed along to the deploy workflow
DEPLOY_ARGUMENTS:
DEPLOY_ARGUMENTS: {}
2 changes: 1 addition & 1 deletion conf/dynaconf_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def config_migrations(settings, data):
:type data: dict
"""
logger.info('Running config migration hooks')
sys.path.append(str(Path(__file__).parent))
sys.path.append(str(Path(__file__).parent.parent))
from conf import migrations

migration_functions = [
Expand Down
4 changes: 2 additions & 2 deletions conf/gce.yaml.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
GCE:
# Google Provider as Compute Resource
# client json Certificate path which is local path on satellite
CERT_PATH: /path/to/certificate.json
CERT_PATH: /usr/share/foreman/path/to/certificate.json
# Zones
ZONE: example-zone
ZONE: northamerica-northeast1-a
# client certificate
CERT: "{}" # client json Certificate
2 changes: 2 additions & 0 deletions conf/provisioning.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ PROVISIONING:
HOST_ROOT_PASSWORD:
HOST_SSH_KEY_PRIV:
HOST_SSH_KEY_PUB:
PROVISIONING_SAT_WORKFLOW:
PROVISIONING_HOST_WORKFLOW:
Loading

0 comments on commit c732bc7

Please sign in to comment.