Skip to content

improvement(SCTParameterWizard): add validation for Scylla BYO install#698

Open
jsmolar wants to merge 1 commit into
scylladb:masterfrom
jsmolar:byo_wizard
Open

improvement(SCTParameterWizard): add validation for Scylla BYO install#698
jsmolar wants to merge 1 commit into
scylladb:masterfrom
jsmolar:byo_wizard

Conversation

@jsmolar
Copy link
Copy Markdown
Contributor

@jsmolar jsmolar commented Jun 11, 2025

Similar to Clone run/job, this PR adds validation for the GitHub repository and branch.

image
image
image

}

def validate_repo(self, repo: str, branch: str):
try:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is ugly. I was considering using code from jenkins_service.py instead. Don't know what is better:

response = requests.get(
    url=f"https://api.github.com/repos/{user}/{repo}/contents/{new_settings['pipelineFile']}?ref={new_settings['gitBranch']}",
    headers={
        "Accept": "application/vnd.github+json",
        "Authorization": f"Bearer {token}",
    }
)

if response.status_code == 404:
    return (False, f"Pipeline file not found in the <a href=\"https://github.com/{user}/{repo}/tree/{new_settings['gitBranch']}\"> target repository</a>, please check the repository before continuing")

if response.status_code == 403:
    return (True, "No access to this repository using your token. The pipeline file cannot be verified.")

if response.status_code == 200:
    return (True, "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think GithubException in this context is not very interesting to handle as it's just slightly better formatted message, this branch can be removed.

internalName: "byo_scylla_repo",
requiresValidation: true,
validated: true,
validated: false,
Copy link
Copy Markdown
Collaborator

@k0machi k0machi Jun 11, 2025

Choose a reason for hiding this comment

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

Without updating validate function of this object, the validation result from validate_BYO_repo_params will be ignored when user presses Build button, it would be better to use this object state instead of a separate repoValidation object to do validation calls. (validationHelpText can be dynamically updated).

validate function will be required to switch to async however, as well as handleParameterSubmit in ParameterEditor.svelte

Copy link
Copy Markdown
Contributor Author

@jsmolar jsmolar Jun 12, 2025

Choose a reason for hiding this comment

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

validated parameter is used in this PR just for disabled={repoValidation.inProgress || !paramDefinitions.scyllaVersion.params.scyllaBranchBYO.validated || !paramDefinitions.scyllaVersion.params.scyllaRepoBYO.validated} where I deactivate the Validate button when the wizard is first shown with empty BYO fields.

My idea here was that scyllaRepoBYO and scyllaBranchBYO need to by validated first by validate function. After that they can manually click validate button to verify if repo exists.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I changed it slightly (see the condition for validation button disable) so I keep default validated: true as the rest of the params.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@k0machi please review again

Comment thread frontend/TestRun/Jenkins/SCTParameterWizard.svelte Outdated
Copy link
Copy Markdown
Contributor

@pehala pehala left a comment

Choose a reason for hiding this comment

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

How can the image from cover letter be valid? does git@github.com:personal-username/scylla.git exist?

@pehala
Copy link
Copy Markdown
Contributor

pehala commented Jul 30, 2025

@jsmolar please fix the conflicts

@soyacz
Copy link
Copy Markdown
Collaborator

soyacz commented Nov 21, 2025

@k0machi please re-review

@k0machi
Copy link
Copy Markdown
Collaborator

k0machi commented Nov 21, 2025

@k0machi please re-review

I'll pick this up later and fix, this PR is still trying to go around the normal validation routine instead of registering validation function for those new fields and I believe will still not fail form submit if validation fails (or at least partially reimplements validation mechanism)

@soyacz
Copy link
Copy Markdown
Collaborator

soyacz commented Jan 28, 2026

@k0machi remember about this one

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.

4 participants