Skip to content

Commit ed54561

Browse files
fix: semver versioning
1 parent e33f655 commit ed54561

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/pages/workloads/create-edit/WorkloadsCreateEditPage.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export default function WorkloadsCreateEditPage({
210210
{
211211
value: 'semver',
212212
label: 'Semver',
213-
caption: '1.x.x',
213+
caption: '1.x.x, ^1.0.2, ~1.0.2',
214214
},
215215
]
216216

@@ -356,7 +356,7 @@ export default function WorkloadsCreateEditPage({
356356
{/* Auto image updater */}
357357
<Section
358358
title='Auto Image Updater'
359-
description='Automatically update the image. Only supported when the image is stored in Harbor.'
359+
description='Automatically update the image. Only supported when the image is stored in Harbor. Image tag and repository can be set in the editor'
360360
>
361361
<ImgButtonGroup
362362
name='spec.imageUpdateStrategy.type'
@@ -365,6 +365,21 @@ export default function WorkloadsCreateEditPage({
365365
value={autoUpdaterType}
366366
onChange={handleAutoUpdaterChange}
367367
/>
368+
{autoUpdaterType === 'semver' && (
369+
<Box sx={{ mt: 3, maxWidth: 480 }}>
370+
<TextField
371+
label='Version constraint'
372+
width='large'
373+
noMarginTop
374+
placeholder='1.x.x'
375+
error={!!(errors.spec?.imageUpdateStrategy as any)?.semver?.versionConstraint}
376+
helperText={(
377+
errors.spec?.imageUpdateStrategy as any
378+
)?.semver?.versionConstraint?.message?.toString()}
379+
{...methods.register('spec.imageUpdateStrategy.semver.versionConstraint' as const)}
380+
/>
381+
</Box>
382+
)}
368383
</Section>
369384

370385
{/* Values editor */}

src/pages/workloads/create-edit/create-edit-workloads.validator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ export const createAplWorkloadApiResponseSchema = yup.object({
4949
type: yup.string().oneOf(['semver']).required(),
5050
semver: yup
5151
.object({
52-
imageRepository: yup.string().required(),
53-
versionConstraint: yup.string().required(),
52+
imageRepository: yup.string().optional(),
53+
versionConstraint: yup.string().required('A version constraint is required for Semver versioning'),
5454
imageParameter: yup.string().optional(),
5555
tagParameter: yup.string().optional(),
5656
})

0 commit comments

Comments
 (0)