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

[ISV-5500] Validate ci.yaml file with json schema #781

Merged
merged 6 commits into from
Feb 14, 2025
Merged

[ISV-5500] Validate ci.yaml file with json schema #781

merged 6 commits into from
Feb 14, 2025

Conversation

haripate
Copy link
Contributor

@haripate haripate commented Feb 11, 2025

Merge Request Checklists

  • Development is done in feature branches
  • Code changes are submitted as pull request into a primary branch [Provide reason for non-primary branch submissions]
  • Code changes are covered with unit and integration tests.
  • Code passes all automated code tests:
    • Linting
    • Code formatter - Black
    • Security scanners
    • Unit tests
    • Integration tests
  • Code is reviewed by at least 1 team member
  • Pull request is tagged with "risk/good-to-go" label for minor changes

@haripate haripate requested a review from Allda February 11, 2025 04:18
"description": "Whether the operator already have FBC support or not",
"type": "boolean"
},
"catalog_mapping": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This section is part of a separate story. But now when you added it you can keep it.

"type": "object",
"properties": {
"enabled": {
"description": "Whether the operator already have FBC support or not",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's rephrase it.. Flag that determines whether the operator uses FBC delivery method. The original message might be misleading since FBC is not a feature that the operator offers.

"required": [ "catalog_mapping" ]
}
},
"required": [ "fbc" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

The FBC flag is not required.

"description": "json schema validating the ci.yaml",
"type": "object",
"additionaProperties": true,
"properties": {
Copy link
Contributor

Choose a reason for hiding this comment

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

There are couple of other properties that we use from the ci file.

  • updateGraph (str, optional)
  • reviewers (list of strings, optional)
  • merge (bool, optional)
  • cert_project_id (str, optional)

Please add the missing properties to the schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. As I was adding these fields, I realized that the updateGraph property is also valid for enum as we need to have only two values semver-mode or replaces-mode using for that. Should I add the enum for this property?

Copy link
Contributor

Choose a reason for hiding this comment

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

The place where you added the additional fields is not correct. You put them under fbc object however they are on the root level of the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it simple for now and don't add any additional enums.

"type": "object",
"properties": {
"template_name": {
"description": "Name of the catalog template file (required)",
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the pattern for adding (required) to the description? It is a bit inconsistent. Ether removed it from the description since it is already marked as required in the schema or add it to all descriptions for all required fields.

},
"minItems": 1
},
"type": {
Copy link
Contributor

Choose a reason for hiding this comment

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

The type is enum with set of allowed values. Please add it there. "enum": ["olm.template.basic", "olm.semver"]

@@ -167,6 +167,26 @@ def check_bundle_release_config(bundle: Bundle) -> Iterator[CheckResult]:
)


def check_validate_schema_ci_config(
Copy link
Contributor

Choose a reason for hiding this comment

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

The ci.yaml file is associated with the operator. Please move this check under the operator test suite.

@haripate
Copy link
Contributor Author

haripate commented Feb 13, 2025

@Allda I updated the PR with all suggested changes. Could you please review them?

}
},
"minItems": 1,
"required": [ "catalog_mapping" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

The catalog mapping is not a mandatory field. It depends on a fbc.enabled flag. Please keep it optional in the schema.

"required": [ "catalog_mapping" ]
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the missing empty line.

@Allda Allda merged commit f0e5ffc into main Feb 14, 2025
4 checks passed
@Allda Allda deleted the ISV-5500 branch February 14, 2025 07:55
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.

2 participants