Skip to content

Edk2 pr eval

edk2_pr_eval

Invocable that checks the diff between a branch and head.

Identifies any packages that needs to be build.

Contains a PrEvalSettingsManager that must be subclassed in a build settings file. This provides platform specific information to Edk2PrEval invocable while allowing the invocable itself to remain platform agnostic.

PrEvalSettingsManager

Platform specific Settings for Edk2PrEval.

provide information necessary for stuart_pr_eval.exe or edk2_pr_eval.py to successfully execute.

Example of Overriding PrEvalSettingsManager

from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager
class PrEvalManager(PrEvalSettingsManager):
    def FilterPackagesToTest(self, changedFilesList: list, potentialPackagesList: list) -> list:
        filtered_packages = []
        for file in changedFilesList:
            for package in potentialPackagesList:
                if package.startswith(potentialPackagesList):
                    filtered_packages.append(package)

        return list(set(filtered_packages))

    def GetPlatformDscAndConfig(self) -> tuple:
        return None

FilterPackagesToTest

FilterPackagesToTest(
    changedFilesList: list, potentialPackagesList: list
) -> list

Filter potential packages to test based on changed files.

Tip

Optional Override in a subclass

Parameters:

Name Type Description Default
changedFilesList list

files changed in this PR

required
potentialPackagesList list

packages from GetPackagesSupported() or from command line option -p, --pkg, --pkg-dir from Edk2MultiPkgAwareInvocable

required

Returns:

Type Description
list

filtered packages to test

Note

Default implementation does zero filtering

GetPlatformDscAndConfig

GetPlatformDscAndConfig() -> tuple

Provide a platform dsc and config.

If a platform desires to provide its DSC then Policy 4 will evaluate if any of the changes will be built in the dsc.

Tip

Optional Override in a subclass

Returns:

Type Description
tuple

(workspace relative path to dsc file, input dictionary of dsc key value pairs)

Edk2PrEval

Invocable to determine what packages should be tested.

Evaluate the changes and determine what packages of the supplied packages should be tested based on impact from the changes

AddCommandLineOptions

AddCommandLineOptions(
    parserObj: argparse.ArgumentParser,
) -> None

Adds command line options to the argparser.

RetrieveCommandLineOptions

RetrieveCommandLineOptions(
    args: argparse.Namespace,
) -> None

Retrieve command line options from the argparser.

GetVerifyCheckRequired

GetVerifyCheckRequired() -> bool

Will not call self_describing_environment.VerifyEnvironment because it might not be set up yet.

GetSettingsClass

GetSettingsClass() -> type

Returns the PrEvalSettingsManager class.

Warning

PrEvalSettingsManager must be subclassed in your platform settings file.

GetLoggingFileName

GetLoggingFileName(loggerType: str) -> str

Returns the filename (PREVALLOG) of where the logs for the Edk2CiBuild invocable are stored in.

Go

Go() -> int

Executes the core functionality of the Edk2CiBuild invocable.

get_packages_to_build

get_packages_to_build(possible_packages: list) -> dict

Returns a dictionary of packages to build.

Parameters:

Name Type Description Default
possible_packages list

list of possible packages

required

Returns:

Type Description
dict

filtered packages to build

main

main() -> None

Entry point to invoke Edk2PrEval.