Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new pre-commit hook: validate ibm_catalog.json inputs #1080

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

akocbek
Copy link
Contributor

@akocbek akocbek commented Dec 16, 2024

Description

Check if all solution input variables are defined in ibm_catalog.json file. Same time checks if any input is defined in catalog.json file which is not defined in solutions input.

Release required?

  • No release
  • Patch release (x.x.X)
  • Minor release (x.X.x)
  • Major release (X.x.x)
Release notes content

Run the pipeline

If the CI pipeline doesn't run when you create the PR, the PR requires a user with GitHub collaborators access to run the pipeline.

Run the CI pipeline when the PR is ready for review and you expect tests to pass. Add a comment to the PR with the following text:

/run pipeline

Checklist for reviewers

  • If relevant, a test for the change is included or updated with this PR.
  • If relevant, documentation for the change is included or updated with this PR.

For mergers

  • Use a conventional commit message to set the release level. Follow the guidelines.
  • Include information that users need to know about the PR in the commit message. The commit message becomes part of the GitHub release notes.
  • Use the Squash and merge option.

@akocbek akocbek requested a review from ocofaigh as a code owner December 16, 2024 20:43
@akocbek
Copy link
Contributor Author

akocbek commented Dec 16, 2024

image

from subprocess import PIPE, Popen

IBM_CATALOG_FILE = "ibm_catalog.json"
DA_FOLDER = "solutions"
Copy link
Member

@ocofaigh ocofaigh Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all DAs will be in a solutions folder (for example landing zone in in patterns folder and WatsonX SaaS DA is in root level). The working directory of the DA will be in the ibm_catalog.json. And if its not, it means it defaults to the root directory of the repo.

inputs = []
with open(IBM_CATALOG_FILE) as f:
ibm_catalog = json.load(f)
if ibm_catalog and "products" in ibm_catalog and ibm_catalog["products"]:
Copy link
Member

@ocofaigh ocofaigh Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make sure we only do this for "product_kind": "solution", ? Since we also have module types, and they should be excluded from this check

Copy link
Member

@ocofaigh ocofaigh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see initial comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants