diff --git a/libs/cypress/fixtures/repositories/initialRepositories.ts b/libs/cypress/fixtures/repositories/initialRepositories.ts
index f9d578ae5..df4ae625a 100644
--- a/libs/cypress/fixtures/repositories/initialRepositories.ts
+++ b/libs/cypress/fixtures/repositories/initialRepositories.ts
@@ -12,7 +12,7 @@ const repoList: Repository[] = [
},
spec: {
url: 'https://github.com/flightctl/flightctl-demos',
- type: RepoSpecType.GIT,
+ type: RepoSpecType.RepoSpecTypeGit,
},
status: {
conditions: [
diff --git a/libs/types/index.ts b/libs/types/index.ts
index 8ab150f66..07884afc2 100644
--- a/libs/types/index.ts
+++ b/libs/types/index.ts
@@ -111,9 +111,9 @@ export { FleetRolloutStartedDetails } from './models/FleetRolloutStartedDetails'
export type { FleetRolloutStatus } from './models/FleetRolloutStatus';
export type { FleetSpec } from './models/FleetSpec';
export type { FleetStatus } from './models/FleetStatus';
-export type { GenericRepoSpec } from './models/GenericRepoSpec';
export type { GitConfigProviderSpec } from './models/GitConfigProviderSpec';
export type { GitHubIntrospectionSpec } from './models/GitHubIntrospectionSpec';
+export type { GitRepoSpec } from './models/GitRepoSpec';
export type { HookAction } from './models/HookAction';
export type { HookActionRun } from './models/HookActionRun';
export type { HookCondition } from './models/HookCondition';
@@ -180,7 +180,6 @@ export type { RolloutDeviceSelection } from './models/RolloutDeviceSelection';
export type { RolloutPolicy } from './models/RolloutPolicy';
export { RolloutStrategy } from './models/RolloutStrategy';
export type { SshConfig } from './models/SshConfig';
-export type { SshRepoSpec } from './models/SshRepoSpec';
export type { Status } from './models/Status';
export { SystemdActiveStateType } from './models/SystemdActiveStateType';
export { SystemdEnableStateType } from './models/SystemdEnableStateType';
diff --git a/libs/types/models/GenericRepoSpec.ts b/libs/types/models/GenericRepoSpec.ts
deleted file mode 100644
index 1a5a1736b..000000000
--- a/libs/types/models/GenericRepoSpec.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/* generated using openapi-typescript-codegen -- do no edit */
-/* istanbul ignore file */
-/* tslint:disable */
-/* eslint-disable */
-import type { RepoSpecType } from './RepoSpecType';
-export type GenericRepoSpec = {
- /**
- * The (possibly remote) repository URL.
- */
- url: string;
- type: RepoSpecType;
-};
-
diff --git a/libs/types/models/GitRepoSpec.ts b/libs/types/models/GitRepoSpec.ts
new file mode 100644
index 000000000..bed87dfa7
--- /dev/null
+++ b/libs/types/models/GitRepoSpec.ts
@@ -0,0 +1,22 @@
+/* generated using openapi-typescript-codegen -- do no edit */
+/* istanbul ignore file */
+/* tslint:disable */
+/* eslint-disable */
+import type { HttpConfig } from './HttpConfig';
+import type { SshConfig } from './SshConfig';
+/**
+ * Git repository specification. Supports no auth (public repos), HTTP/HTTPS auth, or SSH auth.
+ */
+export type GitRepoSpec = {
+ /**
+ * The Git repository URL to clone from.
+ */
+ url: string;
+ /**
+ * The repository type discriminator.
+ */
+ type: 'git';
+ httpConfig?: HttpConfig;
+ sshConfig?: SshConfig;
+};
+
diff --git a/libs/types/models/HttpRepoSpec.ts b/libs/types/models/HttpRepoSpec.ts
index f07a16059..e960e6d26 100644
--- a/libs/types/models/HttpRepoSpec.ts
+++ b/libs/types/models/HttpRepoSpec.ts
@@ -3,14 +3,19 @@
/* tslint:disable */
/* eslint-disable */
import type { HttpConfig } from './HttpConfig';
-import type { RepoSpecType } from './RepoSpecType';
+/**
+ * HTTP endpoint specification for fetching configuration.
+ */
export type HttpRepoSpec = {
/**
- * The HTTP URL to call or clone from.
+ * The HTTP URL to call.
*/
url: string;
- type: RepoSpecType;
- httpConfig: HttpConfig;
+ /**
+ * The repository type discriminator.
+ */
+ type: 'http';
+ httpConfig?: HttpConfig;
/**
* URL suffix used only for validating access to the repository. Users might use the URL field as a root URL to be used by config sources adding suffixes. This will help with the validation of the http endpoint.
*/
diff --git a/libs/types/models/OciRepoSpec.ts b/libs/types/models/OciRepoSpec.ts
index 7913cea3e..62e1f7072 100644
--- a/libs/types/models/OciRepoSpec.ts
+++ b/libs/types/models/OciRepoSpec.ts
@@ -3,7 +3,6 @@
/* tslint:disable */
/* eslint-disable */
import type { OciAuth } from './OciAuth';
-import type { RepoSpecType } from './RepoSpecType';
/**
* OCI container registry specification.
*/
@@ -16,7 +15,10 @@ export type OciRepoSpec = {
* URL scheme for connecting to the registry.
*/
scheme?: OciRepoSpec.scheme;
- type: RepoSpecType;
+ /**
+ * The repository type discriminator.
+ */
+ type: 'oci';
/**
* Access mode for the registry: "Read" for read-only (pull), "ReadWrite" for read-write (pull and push).
*/
diff --git a/libs/types/models/RepoSpecType.ts b/libs/types/models/RepoSpecType.ts
index fa2e96a94..19064f83f 100644
--- a/libs/types/models/RepoSpecType.ts
+++ b/libs/types/models/RepoSpecType.ts
@@ -6,7 +6,7 @@
* RepoSpecType is the type of the repository.
*/
export enum RepoSpecType {
- GIT = 'git',
- HTTP = 'http',
- OCI = 'oci',
+ RepoSpecTypeGit = 'git',
+ RepoSpecTypeHttp = 'http',
+ RepoSpecTypeOci = 'oci',
}
diff --git a/libs/types/models/RepositorySpec.ts b/libs/types/models/RepositorySpec.ts
index c7e262898..7aa67223b 100644
--- a/libs/types/models/RepositorySpec.ts
+++ b/libs/types/models/RepositorySpec.ts
@@ -2,12 +2,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
-import type { GenericRepoSpec } from './GenericRepoSpec';
+import type { GitRepoSpec } from './GitRepoSpec';
import type { HttpRepoSpec } from './HttpRepoSpec';
import type { OciRepoSpec } from './OciRepoSpec';
-import type { SshRepoSpec } from './SshRepoSpec';
/**
* RepositorySpec describes a configuration repository.
*/
-export type RepositorySpec = (GenericRepoSpec | HttpRepoSpec | SshRepoSpec | OciRepoSpec);
+export type RepositorySpec = (GitRepoSpec | HttpRepoSpec | OciRepoSpec);
diff --git a/libs/types/models/SshRepoSpec.ts b/libs/types/models/SshRepoSpec.ts
deleted file mode 100644
index f6fa1091b..000000000
--- a/libs/types/models/SshRepoSpec.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-/* generated using openapi-typescript-codegen -- do no edit */
-/* istanbul ignore file */
-/* tslint:disable */
-/* eslint-disable */
-import type { RepoSpecType } from './RepoSpecType';
-import type { SshConfig } from './SshConfig';
-export type SshRepoSpec = {
- /**
- * The SSH Git repository URL to clone from.
- */
- url: string;
- type: RepoSpecType;
- sshConfig: SshConfig;
-};
-
diff --git a/libs/ui-components/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.tsx b/libs/ui-components/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.tsx
index 72a1bb350..d056b7831 100644
--- a/libs/ui-components/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.tsx
+++ b/libs/ui-components/src/components/Device/EditDeviceWizard/steps/ConfigWithRepositoryTemplateForm.tsx
@@ -3,7 +3,7 @@ import { useFormikContext } from 'formik';
import { FormGroup } from '@patternfly/react-core';
import { Trans } from 'react-i18next';
-import { GenericRepoSpec, HttpRepoSpec, RepoSpecType, Repository } from '@flightctl/types';
+import { GitRepoSpec, HttpRepoSpec, RepoSpecType, Repository } from '@flightctl/types';
import { DeviceSpecConfigFormValues, GitConfigTemplate, HttpConfigTemplate } from '../../../../types/deviceSpec';
import { useTranslation } from '../../../../hooks/useTranslation';
import TextField from '../../../form/TextField';
@@ -127,7 +127,7 @@ const ConfigWithRepositoryTemplateForm = ({
const ct = values.configTemplates[index] as HttpConfigTemplate | GitConfigTemplate;
const selectedRepo = repositories.find((repo) => repo.metadata.name === ct.repository);
- const repoSpec = selectedRepo?.spec as GenericRepoSpec | HttpRepoSpec | undefined;
+ const repoSpec = selectedRepo?.spec as GitRepoSpec | HttpRepoSpec | undefined;
return (
<>
@@ -140,10 +140,10 @@ const ConfigWithRepositoryTemplateForm = ({
repoRefetch={repoRefetch}
isRequired
/>
- {repoType === RepoSpecType.GIT && (
+ {repoType === RepoSpecType.RepoSpecTypeGit && (
)}
- {repoType === RepoSpecType.HTTP && (
+ {repoType === RepoSpecType.RepoSpecTypeHttp && (
}
{(type === ConfigType.GIT || type === ConfigType.HTTP) && (
{
endpoint: 'repositories',
});
- const gitRepositories = (repoList?.items || []).filter((repo) => repo.spec.type === RepoSpecType.GIT);
+ const gitRepositories = (repoList?.items || []).filter((repo) => repo.spec.type === RepoSpecType.RepoSpecTypeGit);
let body: React.ReactNode;
@@ -93,7 +93,7 @@ const ImportFleetWizard = () => {
} else {
const repoInitValues = getInitValues({
options: {
- allowedRepoTypes: [RepoSpecType.GIT],
+ allowedRepoTypes: [RepoSpecType.RepoSpecTypeGit],
showRepoTypes: false,
},
});
diff --git a/libs/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.tsx b/libs/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.tsx
index 223602b16..bb641f8e2 100644
--- a/libs/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.tsx
+++ b/libs/ui-components/src/components/Fleet/ImportFleetWizard/steps/RepositoryStep.tsx
@@ -3,7 +3,7 @@ import { FormGroup, FormSection, Grid, Radio } from '@patternfly/react-core';
import { FormikErrors, useFormikContext } from 'formik';
import { Table, Tbody, Td, Th, Thead, Tr } from '@patternfly/react-table';
-import { GenericRepoSpec, Repository } from '@flightctl/types';
+import { GitRepoSpec, Repository } from '@flightctl/types';
import { ImportFleetFormValues } from '../types';
import { RepositoryForm } from '../../../Repository/CreateRepository/CreateRepositoryForm';
@@ -36,7 +36,7 @@ const ExistingRepoForm = ({ repositories }: { repositories: Repository[] }) => {
const { values } = useFormikContext();
const currentRepo = repositories.find((r) => r.metadata.name === values.existingRepo);
- const repoSpec = currentRepo?.spec as GenericRepoSpec | undefined; // Only git repositories can be used for importing fleets;
+ const repoSpec = currentRepo?.spec as GitRepoSpec | undefined; // Only git repositories can be used for importing fleets;
return (
<>
diff --git a/libs/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.tsx b/libs/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.tsx
index 8e5f03f13..5d2223321 100644
--- a/libs/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.tsx
+++ b/libs/ui-components/src/components/ImageBuilds/CreateImageBuildWizard/steps/OutputImageStep.tsx
@@ -72,7 +72,7 @@ const OutputImageStep = () => {
{
name="source.repository"
label={t('Source repository')}
repositories={ociRegistries}
- repoType={RepoSpecType.OCI}
+ repoType={RepoSpecType.RepoSpecTypeOci}
canCreateRepo={canCreateRepo}
repoRefetch={refetch}
isRequired
diff --git a/libs/ui-components/src/components/ImageBuilds/OciRegistriesContext.tsx b/libs/ui-components/src/components/ImageBuilds/OciRegistriesContext.tsx
index 4402f36cc..cb7e9e03d 100644
--- a/libs/ui-components/src/components/ImageBuilds/OciRegistriesContext.tsx
+++ b/libs/ui-components/src/components/ImageBuilds/OciRegistriesContext.tsx
@@ -15,7 +15,7 @@ const OciRegistriesContext = React.createContext {
const [repoList, isLoading, error, refetch] = useFetchPeriodically({
- endpoint: `repositories?fieldSelector=spec.type=${RepoSpecType.OCI}`,
+ endpoint: `repositories?fieldSelector=spec.type=${RepoSpecType.RepoSpecTypeOci}`,
});
const ociRegistries = React.useMemo(() => repoList?.items || [], [repoList]);
diff --git a/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx b/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx
index b01218de0..eb70a60d8 100644
--- a/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx
+++ b/libs/ui-components/src/components/Repository/CreateRepository/CreateRepositoryForm.tsx
@@ -54,8 +54,8 @@ import './CreateRepositoryForm.css';
const AdvancedSection = () => {
const { t } = useTranslation();
const { values } = useFormikContext();
- const showConfigTypeRadios = values.repoType === RepoSpecType.GIT;
- const isOciRepo = values.repoType === RepoSpecType.OCI;
+ const showConfigTypeRadios = values.repoType === RepoSpecType.RepoSpecTypeGit;
+ const isOciRepo = values.repoType === RepoSpecType.RepoSpecTypeOci;
if (isOciRepo) {
return (
@@ -104,7 +104,7 @@ const AdvancedSection = () => {
)}
{values.configType === 'http' && (
- {values.repoType === RepoSpecType.HTTP && (
+ {values.repoType === RepoSpecType.RepoSpecTypeHttp && (
{
isDisabled={values.httpConfig?.skipServerVerification}
/>
- {values.repoType === RepoSpecType.HTTP && (
+ {values.repoType === RepoSpecType.RepoSpecTypeHttp && (
@@ -188,21 +188,21 @@ const RepositoryType = ({ isEdit }: { isEdit?: boolean }) => {
const isRepoTypeChangeDisabled = values.allowedRepoTypes?.length === 1;
const doChangeRepoType = (toType: RepoSpecType) => {
- if (toType === RepoSpecType.GIT) {
- void setFieldValue('repoType', RepoSpecType.GIT);
+ if (toType === RepoSpecType.RepoSpecTypeGit) {
+ void setFieldValue('repoType', RepoSpecType.RepoSpecTypeGit);
void setFieldValue('httpConfig.token', undefined);
void setFieldValue('canUseResourceSyncs', true);
}
- if (toType === RepoSpecType.HTTP) {
- void setFieldValue('repoType', RepoSpecType.HTTP);
+ if (toType === RepoSpecType.RepoSpecTypeHttp) {
+ void setFieldValue('repoType', RepoSpecType.RepoSpecTypeHttp);
void setFieldValue('configType', 'http');
void setFieldValue('useResourceSyncs', false);
void setFieldValue('canUseResourceSyncs', false);
}
- if (toType === RepoSpecType.OCI) {
- void setFieldValue('repoType', RepoSpecType.OCI);
+ if (toType === RepoSpecType.RepoSpecTypeOci) {
+ void setFieldValue('repoType', RepoSpecType.RepoSpecTypeOci);
void setFieldValue('useResourceSyncs', false);
void setFieldValue('canUseResourceSyncs', false);
if (!values.ociConfig) {
@@ -233,7 +233,7 @@ const RepositoryType = ({ isEdit }: { isEdit?: boolean }) => {
id="git-repo-radio"
name="repoType"
label={t('Use Git repository')}
- checkedValue={RepoSpecType.GIT}
+ checkedValue={RepoSpecType.RepoSpecTypeGit}
onChangeCustom={onRepoTypeChange}
noDefaultOnChange
isDisabled={isRepoTypeChangeDisabled}
@@ -244,7 +244,7 @@ const RepositoryType = ({ isEdit }: { isEdit?: boolean }) => {
id="http-repo-radio"
name="repoType"
label={t('Use HTTP service')}
- checkedValue={RepoSpecType.HTTP}
+ checkedValue={RepoSpecType.RepoSpecTypeHttp}
onChangeCustom={onRepoTypeChange}
noDefaultOnChange
isDisabled={isRepoTypeChangeDisabled}
@@ -255,7 +255,7 @@ const RepositoryType = ({ isEdit }: { isEdit?: boolean }) => {
id="oci-repo-radio"
name="repoType"
label={t('Use OCI registry')}
- checkedValue={RepoSpecType.OCI}
+ checkedValue={RepoSpecType.RepoSpecTypeOci}
onChangeCustom={onRepoTypeChange}
noDefaultOnChange
isDisabled={isRepoTypeChangeDisabled}
@@ -299,7 +299,7 @@ const RepositoryType = ({ isEdit }: { isEdit?: boolean }) => {
export const RepositoryForm = ({ isEdit }: { isEdit?: boolean }) => {
const { t } = useTranslation();
const { values } = useFormikContext();
- const isOciRepo = values.repoType === RepoSpecType.OCI;
+ const isOciRepo = values.repoType === RepoSpecType.RepoSpecTypeOci;
return (
<>
@@ -393,7 +393,7 @@ const CreateRepositoryFormContent = ({ isEdit, isReadOnly, onClose, children }:
const { checkPermissions } = usePermissionsContext();
const [canCreateRS] = checkPermissions([{ kind: RESOURCE.RESOURCE_SYNC, verb: VERB.CREATE }]);
- const showResourceSyncs = values.canUseResourceSyncs && values.repoType === RepoSpecType.GIT;
+ const showResourceSyncs = values.canUseResourceSyncs && values.repoType === RepoSpecType.RepoSpecTypeGit;
return (