api: remove pull command

The api config supports pulling in the openapi schema's via a url, so there isn't a
need to pull this in manually and just run the code generation.

We also need to remove the `openshift-virt` target since this was removed from
image-builder-crc.
This commit is contained in:
Gianluca Zuccarelli 2025-07-23 10:06:10 +01:00 committed by Klara Simickova
parent 690b71636a
commit f86f81d6d5
22 changed files with 102 additions and 37553 deletions

View file

@ -71,7 +71,7 @@ jobs:
run: npm ci run: npm ci
- name: Check for manual changes to API - name: Check for manual changes to API
run: | run: |
npm run api:generate npm run api
if [ -n "$(git status --porcelain)" ]; then if [ -n "$(git status --porcelain)" ]; then
echo echo
echo "✗ API manually changed, please refer to the README for the procedure to follow for programmatically generated API endpoints." echo "✗ API manually changed, please refer to the README for the procedure to follow for programmatically generated API endpoints."

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/compliance.json', schemaFile: 'https://console.redhat.com/api/compliance/v2/openapi.json',
apiFile: '../../src/store/service/emptyComplianceApi.ts', apiFile: '../../src/store/service/emptyComplianceApi.ts',
apiImport: 'emptyComplianceApi', apiImport: 'emptyComplianceApi',
outputFile: '../../src/store/service/complianceApi.ts', outputFile: '../../src/store/service/complianceApi.ts',

View file

@ -1,17 +1,15 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/composerCloudApi.v2.yaml', schemaFile:
'https://raw.githubusercontent.com/osbuild/osbuild-composer/main/internal/cloudapi/v2/openapi.v2.yml',
apiFile: '../../src/store/cockpit/emptyComposerCloudApi.ts', apiFile: '../../src/store/cockpit/emptyComposerCloudApi.ts',
apiImport: 'emptyComposerCloudApi', apiImport: 'emptyComposerCloudApi',
outputFile: '../../src/store/cockpit/composerCloudApi.ts', outputFile: '../../src/store/cockpit/composerCloudApi.ts',
exportName: 'composerCloudApi', exportName: 'composerCloudApi',
hooks: false, hooks: false,
unionUndefined: true, unionUndefined: true,
filterEndpoints: [ filterEndpoints: ['postCompose', 'getComposeStatus'],
'postCompose',
'getComposeStatus',
],
}; };
export default config; export default config;

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/contentSources.json', schemaFile: 'https://console.redhat.com/api/content-sources/v1/openapi.json',
apiFile: '../../src/store/service/emptyContentSourcesApi.ts', apiFile: '../../src/store/service/emptyContentSourcesApi.ts',
apiImport: 'emptyContentSourcesApi', apiImport: 'emptyContentSourcesApi',
outputFile: '../../src/store/service/contentSourcesApi.ts', outputFile: '../../src/store/service/contentSourcesApi.ts',

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/edge.json', schemaFile: 'https://console.redhat.com/api/edge/v1/openapi.json',
apiFile: '../../src/store/service/emptyEdgeApi.ts', apiFile: '../../src/store/service/emptyEdgeApi.ts',
apiImport: 'emptyEdgeApi', apiImport: 'emptyEdgeApi',
outputFile: '../../src/store/service/edgeApi.ts', outputFile: '../../src/store/service/edgeApi.ts',

View file

@ -1,7 +1,8 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/imageBuilder.yaml', schemaFile:
'https://raw.githubusercontent.com/osbuild/image-builder/main/internal/v1/api.yaml',
apiFile: '../../src/store/service/emptyImageBuilderApi.ts', apiFile: '../../src/store/service/emptyImageBuilderApi.ts',
apiImport: 'emptyImageBuilderApi', apiImport: 'emptyImageBuilderApi',
outputFile: '../../src/store/service/imageBuilderApi.ts', outputFile: '../../src/store/service/imageBuilderApi.ts',

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/provisioning.json', schemaFile: 'https://console.redhat.com/api/provisioning/v1/openapi.json',
apiFile: '../../src/store/service/emptyProvisioningApi.ts', apiFile: '../../src/store/service/emptyProvisioningApi.ts',
apiImport: 'emptyProvisioningApi', apiImport: 'emptyProvisioningApi',
outputFile: '../../src/store/service/provisioningApi.ts', outputFile: '../../src/store/service/provisioningApi.ts',

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi'; import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = { const config: ConfigFile = {
schemaFile: '../schema/rhsm.json', schemaFile: 'https://console.redhat.com/api/rhsm/v2/openapi.json',
apiFile: '../../src/store/service/emptyRhsmApi.ts', apiFile: '../../src/store/service/emptyRhsmApi.ts',
apiImport: 'emptyRhsmApi', apiImport: 'emptyRhsmApi',
outputFile: '../../src/store/service/rhsmApi.ts', outputFile: '../../src/store/service/rhsmApi.ts',

View file

@ -1,10 +0,0 @@
#!/bin/bash
# Download the most up-to-date schema files and overwrite the existing ones
curl https://raw.githubusercontent.com/osbuild/image-builder/main/internal/v1/api.yaml -o ./api/schema/imageBuilder.yaml
curl https://console.redhat.com/api/rhsm/v2/openapi.json -o ./api/schema/rhsm.json
curl https://console.redhat.com/api/content-sources/v1/openapi.json -o ./api/schema/contentSources.json
curl https://console.redhat.com/api/provisioning/v1/openapi.json -o ./api/schema/provisioning.json
curl https://console.redhat.com/api/edge/v1/openapi.json -o ./api/schema/edge.json
curl https://console.redhat.com/api/compliance/v2/openapi.json -o ./api/schema/compliance.json
curl https://raw.githubusercontent.com/osbuild/osbuild-composer/main/internal/cloudapi/v2/openapi.v2.yml -o ./api/schema/composerCloudApi.v2.yaml

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -115,9 +115,7 @@
"test:cockpit": "src/test/cockpit-tests.sh", "test:cockpit": "src/test/cockpit-tests.sh",
"build": "fec build", "build": "fec build",
"build:cockpit": "webpack --config cockpit/webpack.config.ts", "build:cockpit": "webpack --config cockpit/webpack.config.ts",
"api": "npm-run-all api:pull api:generate", "api": "bash api/codegen.sh",
"api:generate": "bash api/codegen.sh",
"api:pull": "bash api/pull.sh",
"verify": "npm-run-all build lint test", "verify": "npm-run-all build lint test",
"postinstall": "ts-patch install", "postinstall": "ts-patch install",
"circular": "madge --circular ./src --extensions js,ts,tsx", "circular": "madge --circular ./src --extensions js,ts,tsx",

View file

@ -31,7 +31,10 @@ import {
MODAL_ANCHOR, MODAL_ANCHOR,
SEARCH_INPUT, SEARCH_INPUT,
} from '../../constants'; } from '../../constants';
import { useGetBlueprintsQuery, useGetComposeStatusQuery } from '../../store/backendApi'; import {
useGetBlueprintsQuery,
useGetComposeStatusQuery,
} from '../../store/backendApi';
import { import {
selectBlueprintSearchInput, selectBlueprintSearchInput,
selectSelectedBlueprintId, selectSelectedBlueprintId,
@ -109,7 +112,7 @@ const ProvisioningLink = ({
scope: 'provisioning', scope: 'provisioning',
module: './ProvisioningWizard', module: './ProvisioningWizard',
}, },
{} {},
); );
const { permissions, isLoading: isLoadingPermission } = const { permissions, isLoading: isLoadingPermission } =
@ -118,7 +121,7 @@ const ProvisioningLink = ({
// Recomputing this value on every render made the modal crash. Using a state // Recomputing this value on every render made the modal crash. Using a state
// helps avoiding this situation as the value is only set the first time. // helps avoiding this situation as the value is only set the first time.
const [appendTo] = useState( const [appendTo] = useState(
document.querySelector(MODAL_ANCHOR) as HTMLElement document.querySelector(MODAL_ANCHOR) as HTMLElement,
); );
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId); const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
@ -129,10 +132,10 @@ const ProvisioningLink = ({
{ {
selectFromResult: ({ data }) => ({ selectFromResult: ({ data }) => ({
selectedBlueprintVersion: data?.data.find( selectedBlueprintVersion: data?.data.find(
(blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId (blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId,
)?.version, )?.version,
}), }),
} },
); );
if ( if (
@ -262,7 +265,7 @@ export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => {
if (options && !isOciUploadStatus(options)) { if (options && !isOciUploadStatus(options)) {
throw TypeError( throw TypeError(
`Error: options must be of type OciUploadStatus, not ${typeof options}.` `Error: options must be of type OciUploadStatus, not ${typeof options}.`,
); );
} }
@ -389,7 +392,6 @@ export const AwsS3Instance = ({
'rhel-edge-installer': '', 'rhel-edge-installer': '',
vhd: '', vhd: '',
oci: '', oci: '',
'openshift-virt': '.tar',
}; };
const status = composeStatus?.image_status.status; const status = composeStatus?.image_status.status;
@ -397,7 +399,7 @@ export const AwsS3Instance = ({
if (options && !isAwss3UploadStatus(options)) { if (options && !isAwss3UploadStatus(options)) {
throw TypeError( throw TypeError(
`Error: options must be of type Awss3UploadStatus, not ${typeof options}.` `Error: options must be of type Awss3UploadStatus, not ${typeof options}.`,
); );
} }

View file

@ -77,7 +77,6 @@ export const targetOptions: { [key in ImageTypes]: string } = {
'rhel-edge-installer': 'RHEL Edge Installer', 'rhel-edge-installer': 'RHEL Edge Installer',
vhd: '', vhd: '',
oci: 'Oracle Cloud Infrastructure', oci: 'Oracle Cloud Infrastructure',
'openshift-virt': 'OpenShift Virtualization',
}; };
export const UNIT_KIB = 1024 ** 1; export const UNIT_KIB = 1024 ** 1;

View file

@ -370,6 +370,9 @@ export type Subscription = {
/** Optional value to register with a template when using rhc to register the system with Insights. /** Optional value to register with a template when using rhc to register the system with Insights.
*/ */
template_name?: string | undefined; template_name?: string | undefined;
/** Optional value used to specify the patch host when registering the system with Insights.
*/
patch_url?: string | undefined;
}; };
export type Module = { export type Module = {
/** Name of the module to enable. /** Name of the module to enable.

View file

@ -82,7 +82,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images`, url: `/images`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
checkImageName: build.mutation< checkImageName: build.mutation<
@ -92,7 +92,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images/checkImageName`, url: `/images/checkImageName`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
createInstallerForImage: build.mutation< createInstallerForImage: build.mutation<
@ -102,7 +102,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images/${queryArg.imageId}/installer`, url: `/images/${queryArg.imageId}/installer`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
createKickStartForImage: build.mutation< createKickStartForImage: build.mutation<
@ -112,7 +112,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images/${queryArg.imageId}/kickstart`, url: `/images/${queryArg.imageId}/kickstart`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
getMetadataForImage: build.query< getMetadataForImage: build.query<
@ -134,7 +134,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images/${queryArg.imageId}/retry`, url: `/images/${queryArg.imageId}/retry`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
createImageUpdate: build.mutation< createImageUpdate: build.mutation<
@ -144,7 +144,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ query: (queryArg) => ({
url: `/images/${queryArg.imageId}/update`, url: `/images/${queryArg.imageId}/update`,
method: "POST", method: "POST",
body: queryArg.modelsCreateImageApi, body: queryArg.createImage,
}), }),
}), }),
getImageByOstree: build.query< getImageByOstree: build.query<
@ -239,13 +239,13 @@ export type GetAllImagesApiArg = {
export type CreateImageApiResponse = /** status 200 OK */ ImageResponse; export type CreateImageApiResponse = /** status 200 OK */ ImageResponse;
export type CreateImageApiArg = { export type CreateImageApiArg = {
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type CheckImageNameApiResponse = export type CheckImageNameApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
export type CheckImageNameApiArg = { export type CheckImageNameApiArg = {
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type CreateInstallerForImageApiResponse = export type CreateInstallerForImageApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
@ -253,7 +253,7 @@ export type CreateInstallerForImageApiArg = {
/** Image ID */ /** Image ID */
imageId: number; imageId: number;
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type CreateKickStartForImageApiResponse = export type CreateKickStartForImageApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
@ -261,7 +261,7 @@ export type CreateKickStartForImageApiArg = {
/** Image ID */ /** Image ID */
imageId: number; imageId: number;
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type GetMetadataForImageApiResponse = export type GetMetadataForImageApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
@ -281,7 +281,7 @@ export type RetryCreateImageApiArg = {
/** Image ID */ /** Image ID */
imageId: number; imageId: number;
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type CreateImageUpdateApiResponse = export type CreateImageUpdateApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
@ -289,7 +289,7 @@ export type CreateImageUpdateApiArg = {
/** Image ID */ /** Image ID */
imageId: number; imageId: number;
/** request body */ /** request body */
modelsCreateImageApi: ModelsCreateImageApi; createImage: CreateImage;
}; };
export type GetImageByOstreeApiResponse = export type GetImageByOstreeApiResponse =
/** status 200 OK */ ModelsSuccessPlaceholderResponse; /** status 200 OK */ ModelsSuccessPlaceholderResponse;
@ -558,7 +558,7 @@ export type ImageResponse = {
/** storing for logging reference on resume */ /** storing for logging reference on resume */
request_id?: string | undefined; request_id?: string | undefined;
}; };
export type ModelsCreateImageApi = object; export type CreateImage = object;
export const { export const {
useListAllImageSetsQuery, useListAllImageSetsQuery,
useGetImageSetsViewQuery, useGetImageSetsViewQuery,

View file

@ -462,7 +462,6 @@ export type ImageTypes =
| "guest-image" | "guest-image"
| "image-installer" | "image-installer"
| "oci" | "oci"
| "openshift-virt"
| "vsphere" | "vsphere"
| "vsphere-ova" | "vsphere-ova"
| "wsl" | "wsl"
@ -552,10 +551,11 @@ export type OsTree = {
rhsm?: boolean | undefined; rhsm?: boolean | undefined;
}; };
export type AapRegistration = { export type AapRegistration = {
ansible_controller_url: string; ansible_callback_url: string;
job_template_id: number;
host_config_key: string; host_config_key: string;
tls_certificate_authority?: string | undefined; tls_certificate_authority?: string | undefined;
/** When true, indicates the user has confirmed that HTTPS callback URL does not require a CA certificate for verification */
skip_tls_verification?: boolean | undefined;
}; };
export type ImageRequest = { export type ImageRequest = {
/** CPU architecture of the image, x86_64 and aarch64 are currently supported. /** CPU architecture of the image, x86_64 and aarch64 are currently supported.
@ -679,6 +679,65 @@ export type Filesystem = {
/** size of the filesystem in bytes */ /** size of the filesystem in bytes */
min_size: any; min_size: any;
}; };
export type Minsize = string;
export type FilesystemTyped = {
type?: "plain" | undefined;
/** The partition type GUID for GPT partitions. For DOS partitions, this field can be used to set the (2 hex digit) partition type. If not set, the type will be automatically set based on the mountpoint or the payload type.
*/
part_type?: string | undefined;
minsize?: Minsize | undefined;
mountpoint?: string | undefined;
label?: string | undefined;
/** The filesystem type. Swap partitions must have an empty mountpoint.
*/
fs_type: "ext4" | "xfs" | "vfat" | "swap";
};
export type BtrfsSubvolume = {
/** The name of the subvolume, which defines the location (path) on the root volume
*/
name: string;
/** Mountpoint for the subvolume
*/
mountpoint: string;
};
export type BtrfsVolume = {
type: "btrfs";
/** The partition type GUID for GPT partitions. For DOS partitions, this field can be used to set the (2 hex digit) partition type. If not set, the type will be automatically set based on the mountpoint or the payload type.
*/
part_type?: string | undefined;
minsize?: Minsize | undefined;
subvolumes: BtrfsSubvolume[];
};
export type LogicalVolume = {
name?: string | undefined;
minsize?: Minsize | undefined;
/** Mountpoint for the logical volume
*/
mountpoint?: string | undefined;
label?: string | undefined;
/** The filesystem type for the logical volume. Swap LVs must have an empty mountpoint.
*/
fs_type: "ext4" | "xfs" | "vfat" | "swap";
};
export type VolumeGroup = {
type: "lvm";
/** The partition type GUID for GPT partitions. For DOS partitions, this field can be used to set the (2 hex digit) partition type. If not set, the type will be automatically set based on the mountpoint or the payload type.
*/
part_type?: string | undefined;
/** Volume group name (will be automatically generated if omitted)
*/
name?: string | undefined;
minsize?: Minsize | undefined;
logical_volumes: LogicalVolume[];
};
export type Partition = FilesystemTyped | BtrfsVolume | VolumeGroup;
export type Disk = {
/** Type of the partition table
*/
type?: ("gpt" | "dos") | undefined;
minsize?: Minsize | undefined;
partitions: Partition[];
};
export type User = { export type User = {
name: string; name: string;
/** List of groups to add the user to. The 'wheel' group should be added explicitly, as the /** List of groups to add the user to. The 'wheel' group should be added explicitly, as the
@ -785,6 +844,7 @@ export type Customizations = {
custom_repositories?: CustomRepository[] | undefined; custom_repositories?: CustomRepository[] | undefined;
openscap?: OpenScap | undefined; openscap?: OpenScap | undefined;
filesystem?: Filesystem[] | undefined; filesystem?: Filesystem[] | undefined;
disk?: Disk | undefined;
/** List of users that a customer can add, /** List of users that a customer can add,
also specifying their respective groups and SSH keys and/or password also specifying their respective groups and SSH keys and/or password
*/ */
@ -864,7 +924,7 @@ export type BlueprintExportResponse = {
export type ComposeResponse = { export type ComposeResponse = {
id: string; id: string;
}; };
export type ClientId = "api" | "ui"; export type ClientId = "api" | "ui" | "mcp";
export type ComposeRequest = { export type ComposeRequest = {
distribution: Distributions; distribution: Distributions;
image_name?: string | undefined; image_name?: string | undefined;