crs4 / life_monitor

Workflow Sustainability Service
MIT License
4 stars 4 forks source link

Features: Github app integration + framework to check for issues #206

Closed kikkomep closed 2 years ago

kikkomep commented 2 years ago

This PR introduces the following new features:

  1. intial support to register workflows stored on Github repos. For the registration to be successfull, you need to provide the github clone URL as roc_link parameter and the repository MUST contains all the files required to form a valid RO-Crate;

  2. full update of a workflow version. A new PUT method allows to fully update an existing workflow version either by providing a new RO-Crate (or link) or, for registry workflows, by refetching the RO-Crate from a registry. The upgrade is performed only if changes are detected in the ro-crate-metadata.json file;

  3. basic framework to check for issues on workflow (testing) RO-Crates. The API model has been extended with a new hierarchy of classes to inspect RO-Crates stored on folders, zip archive or Github repos through a common interface. The base class WorkflowRepository implements a generic method check(..) which tries to detect a predefined set of issue types on the RO-Crate repo. An issue is described by a concrete class inherited from WorkflowRepositoryIssue: e.g.,

class MissingWorkflowFile(WorkflowRepositoryIssue):
    name = "Missing workflow file"
    description = "No workflow found on this repository.<br>"\
        "You should place the workflow file (e.g., <code>.ga</code> file) on the root of this repository."
    labels = ['invalid', 'enhancement']

    def check(self, repo: WorkflowRepository) -> bool:
        return repo.find_workflow() is None
  1. a new /integrations/github endpoint to integrate LifeMonitor with Github as Github App. When installed on a Github repo, the integration provides:

    • feedbacks for issues as Github issues and proposals for integrating changes (e.g., adding template files) as pull requests. Both issues and PRs result from the mapping of the issue types described above. For example, the MissingWorkflowFile is automatically mapped to the following Github issue:

    Screenshot 2022-03-17 at 17 00 45

    • automatic registration of the RO-Crate repo as workflow version on LifeMonitor. Users can easily choose which repo branch and/or tag map to a LifeMonitor workflow version from the Github integration tab of their profile settings:

    Screenshot 2022-03-17 at 12 32 03