feat(eks-anywhere): add update at specif version for an EKSA cluster#2571
feat(eks-anywhere): add update at specif version for an EKSA cluster#2571RemiBonnet merged 5 commits intonew-navigationfrom
Conversation
|
Qovery can create a Preview Environment for this PR.
This comment has been generated from Qovery AI 🤖.
|
409af52 to
8710520
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## new-navigation #2571 +/- ##
==================================================
- Coverage 45.85% 45.53% -0.32%
==================================================
Files 1125 769 -356
Lines 22841 18040 -4801
Branches 6686 5339 -1347
==================================================
- Hits 10474 8215 -2259
+ Misses 10458 8337 -2121
+ Partials 1909 1488 -421
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| "monaco-editor": "0.53.0", | ||
| "posthog-js": "1.260.1", | ||
| "qovery-typescript-axios": "1.1.851", | ||
| "qovery-typescript-axios": "^1.1.853", |
There was a problem hiding this comment.
@pggb25 The version needs to be a fixed number. Please get rid of the ^ symbol 🙏
There was a problem hiding this comment.
I do this command: yarn up qovery-typescript-axios
do you have another command to avoid this ^
| const [isGitEditing, setIsGitEditing] = useState(false) | ||
| const currentGitRepository = cluster?.infrastructure_charts_parameters?.eks_anywhere_parameters?.git_repository | ||
| const currentRepository = getEksAnywhereGitFormValues(cluster).repository | ||
| const hasConfiguredInfrastructureChartsSource = Boolean(currentGitRepository?.url && currentRepository) |
There was a problem hiding this comment.
Could you memoize this variable?
| const filterCommits: Record<string, Commit[]> = Object.fromEntries( | ||
| Object.entries(commitsByDay) | ||
| .map(([date, commitsForDate]) => { | ||
| return [ | ||
| date, | ||
| commitsForDate.filter( | ||
| (commit) => | ||
| commit.message.toLowerCase().includes(search.toLowerCase()) || | ||
| commit.git_commit_id.toLowerCase().includes(search.toLowerCase()) | ||
| ), | ||
| ] | ||
| }) | ||
| .filter(([, commitsForDate]) => commitsForDate.length) | ||
| ) |
| const hasSelectedCommitInResults = Object.values(filterCommits).some((commitsForDate) => | ||
| commitsForDate.some((commit) => commit.git_commit_id === targetCommitId) | ||
| ) |
There was a problem hiding this comment.
Could you memoize this as well?
| isEksAnywhereCluster && | ||
| hasEksAnywhereGitRepository && | ||
| (isDeployAvailable(clusterStatus.status) || isRedeployAvailable(clusterStatus.status)) && ( |
There was a problem hiding this comment.
Please extract this condition into a memoized variable at the top of the component's function 🙏
There was a problem hiding this comment.
I factorize but didn"t use memo because adding a hook here actually led to a hooks-order issue during deployment state transitions
| typeof clusterApiWithFallback.updateEksAnywhereCommit === 'function' | ||
| ? await clusterApiWithFallback.updateEksAnywhereCommit(organizationId, clusterId, { commit_id: commitId }) | ||
| : await clusterApiWithFallback.axios.put<EksAnywhereCommitResponse>( |
There was a problem hiding this comment.
Should be extracted to a variable to improve readability
| const response = | ||
| typeof clusterApiWithFallback.listEksAnywhereCommits === 'function' | ||
| ? await clusterApiWithFallback.listEksAnywhereCommits(organizationId, clusterId) | ||
| : await clusterApiWithFallback.axios.get<CommitResponseList>( |
There was a problem hiding this comment.
Should be extracted to a variable to improve readability
| const currentGitRepository = cluster?.infrastructure_charts_parameters?.eks_anywhere_parameters?.git_repository | ||
| const currentRepository = getEksAnywhereGitFormValues(cluster).repository | ||
| const hasConfiguredInfrastructureChartsSource = Boolean(currentGitRepository?.url && currentRepository) | ||
| const gitDisabled = hasConfiguredInfrastructureChartsSource && !isGitEditing |
88cb145 to
a8f1a21
Compare
| const getEksAnywhereCommitsPath = (organizationId: string, clusterId: string) => | ||
| `${getClusterApiBasePath()}/organization/${encodeURIComponent(organizationId)}/cluster/${encodeURIComponent(clusterId)}/eks-anywhere/commits` | ||
| const getEksAnywhereCommitPath = (organizationId: string, clusterId: string) => | ||
| `${getClusterApiBasePath()}/organization/${encodeURIComponent(organizationId)}/cluster/${encodeURIComponent(clusterId)}/eks-anywhere/commit` |
There was a problem hiding this comment.
Could you use the axios package please?
| }) | ||
| } | ||
| const mutationUpdateEksAnywhereVersion = () => { | ||
| queryClient.removeQueries({ |
There was a problem hiding this comment.
I think this one isn't necessary or you need to do it inside the hook with the onSuccess of your mutation
| enabled?: boolean | ||
| } | ||
|
|
||
| export function useEksAnywhereCommits(props: UseEksAnywhereCommitsProps) { |
There was a problem hiding this comment.
| export function useEksAnywhereCommits(props: UseEksAnywhereCommitsProps) { | |
| export function useEksAnywhereCommits({ enabled = true, organizationId, clusterId }: UseEksAnywhereCommitsProps) { |
| } | ||
|
|
||
| export function useEksAnywhereCommits(props: UseEksAnywhereCommitsProps) { | ||
| const { enabled = true, organizationId, clusterId } = props |
There was a problem hiding this comment.
| const { enabled = true, organizationId, clusterId } = props |
7b27d19 to
b6387d2
Compare
b6387d2 to
15667b3
Compare
15667b3 to
550058f
Compare
Summary
Can be tested here: http://localhost:4200/organization/148bff50-453d-4111-8353-915bd6ec08b3/cluster/eb77465e-a1b2-4c62-aa1c-89db4cac8bc3/overview
Only EKS anywhere cluster should be impacted
Screenshots / Recordings
Testing
yarn testoryarn test -u(if you need to regenerate snapshots)yarn formatyarn lintPR Checklist
.cursor/rules)feat(service): add new Terraform service) - required for semantic-release