openshift-helm-charts / development

0 stars 17 forks source link

Create extra job for extracting and validating all needed info from PR #296

Open mgoerens opened 10 months ago

mgoerens commented 10 months ago

At several places in the build.yaml workflow, we extract and validate information from the PR, its files, etc. Typically we need the category, organization, chart_name, chart_version at different times.

There are several occurrences of such redundant calls (e.g. to get_modified_files) at different stages of the workflow.

We should create a separate job that takes care of:

  1. Extracting all information that is needed by later steps from the PR content.
  2. Validate those info (e.g. valid semver version, match between directory structure and info in report.yaml, etc.)
  3. Present those info to the other steps

For 3. instead of GitHub outputs, we could populate a file and pass it to the other jobs as a PR artifact (see https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow)

Such a file could look for example like this:

pre-check:
    content:
        modified_files:
            - charts/partners/hashicorp/vault/1.13.0/report.yaml
            - ...
        category: partners
        organization: hashicorp # vendor
        version: 1.13.0
        chart_name: vault
        source:
            provided: False
        report:
            provided: True
            signed: False
        owners_file_modified: False
        web_catalog_only: True
    pr_infos:
        api_url:
        PR_number: 30145
komish commented 10 months ago

@mgoerens 100% agree. Looking at the certified chart dependency project, I may need to implement a small portion of this to accomplish a few things required in that pipeline. I may continue to use GITHUB_OUTPUT for those cases, but we can transition that down to some kind of format that looks like the above down the line.

mgoerens commented 7 months ago

See https://github.com/openshift-helm-charts/development/pull/314#discussion_r1471308712 for future work item