-
Notifications
You must be signed in to change notification settings - Fork 17
EDM-3209 EDM-3069 update repo spec types #459
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
EDM-3209 EDM-3069 update repo spec types #459
Conversation
WalkthroughRefactors repository spec types: removes GenericRepoSpec and SshRepoSpec, introduces GitRepoSpec, renames enum members (e.g., GIT → RepoSpecTypeRepoSpecTypeGit), switches some discriminators to string literals, and updates UI components and utilities to use the new types and enum values. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@libs/ui-components/src/components/Repository/CreateRepository/utils.ts`:
- Around line 420-440: In httpConfigToFormValues, ca.crt is decoded with atob
but tls.crt and tls.key are returned raw; update the mTlsAuth fields inside
httpConfigToFormValues to base64-decode httpConfig['tls.crt'] and
httpConfig['tls.key'] (use atob like caCrt) so tlsCrt and tlsKey contain decoded
strings, while preserving the existing use checks and other fields.
- Around line 566-581: The SSH private key is being assigned raw from
gitRepoSpec.sshConfig.sshPrivateKey but elsewhere (in getRepository()) keys are
base64-encoded with btoa(); update the branch handling
RepoSpecType.RepoSpecTypeGit so that when gitRepoSpec.sshConfig exists you
base64-decode the stored sshPrivateKey before assigning it to
formValues.sshConfig.sshPrivateKey (use the corresponding decode function used
for btoa/encoding in your environment, e.g., atob in the browser), keeping other
fields (privateKeyPassphrase, skipServerVerification) unchanged.
🧹 Nitpick comments (1)
libs/ui-components/src/components/Repository/CreateRepository/utils.ts (1)
805-877: Consider extracting shared httpConfig building logic.The HTTP config construction logic (lines 814-839 for HTTP repos, lines 843-864 for Git repos) is largely duplicated. Consider extracting a shared helper to reduce duplication and ensure consistency.
♻️ Suggested helper extraction
const buildHttpConfig = (httpConfigValues: RepositoryFormValues['httpConfig']): HttpConfig | undefined => { if (!httpConfigValues) return undefined; const config: HttpConfig = { skipServerVerification: httpConfigValues.skipServerVerification, }; const caCrt = httpConfigValues.caCrt; if (caCrt && !httpConfigValues.skipServerVerification) { config['ca.crt'] = btoa(caCrt); } if (httpConfigValues.basicAuth?.use) { config.username = httpConfigValues.basicAuth.username; config.password = httpConfigValues.basicAuth.password; } if (httpConfigValues.mTlsAuth?.use) { const tlsCrt = httpConfigValues.mTlsAuth.tlsCrt; if (tlsCrt) config['tls.crt'] = btoa(tlsCrt); const tlsKey = httpConfigValues.mTlsAuth.tlsKey; if (tlsKey) config['tls.key'] = btoa(tlsKey); } return config; };Then use it in both HTTP and Git spec creation paths.
120eedf to
15db5ff
Compare
|
Waiting for the backend part to merge first, there are some CI issues. |
The OpenAPI schema now has 3 main types: Git, Http, Oci.
Before it was mixing the repository type with the credential settings type.
Related backend changes: flightctl/flightctl#2412
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.