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

Fix: UI validation functions #65

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion operatorcourier/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def verify(self):
parser.add_argument('source_dir', help='Path of your directory of yaml '
'files to bundle. Either set this or '
'use the files argument for bundle data.')
parser.add_argument('--ui_validate_io',
parser.add_argument('--ui-validate-io',
Copy link
Member

Choose a reason for hiding this comment

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

This should be a separate pr, since we are introducing a breaking change on a released feature.

help='Validate bundle for operatorhub.io UI',
action='store_true')
parser.add_argument('--validation-output', dest='validation_output',
Expand Down
7 changes: 4 additions & 3 deletions operatorcourier/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,15 @@ def is_email(field):
def is_version(field):
pattern1 = re.compile(r'v(\d+\.)(\d+\.)(\d)')
pattern2 = re.compile(r'(\d+\.)(\d+\.)(\d)')
return pattern1.match(field) or pattern2.match(field)
pattern3 = re.compile(r'(v)?(\d+\.)(\d+\.)(\d)(-[a-z0-9\-\.]+)?')
return pattern1.match(field) or pattern2.match(field) or pattern3.match(field)

def is_capability_level(field):
levels = [
"Basic Install",
"Seamless Upgrades",
"Full Lifecycle",
"Deep Insight",
"Deep Insights",
"Auto Pilot"
]
return field in levels
Expand Down Expand Up @@ -467,7 +468,7 @@ def get_alm_kinds(alm_examples):
# capabilities check
if not is_capability_level(annotations["capabilities"]):
self._log_error("metadata.annotations.capabilities %s is not a "
"valid capabilities level", annotations["capability"])
"valid capabilities level", annotations["capabilities"])
valid = False

return valid
Copy link
Member

Choose a reason for hiding this comment

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

The three changes in this file all seem unrelated. Can you please submit them as separate pull requests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing!