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
- name: Check for manual changes to API
run: |
npm run api:generate
npm run api
if [ -n "$(git status --porcelain)" ]; then
echo
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';
const config: ConfigFile = {
schemaFile: '../schema/compliance.json',
schemaFile: 'https://console.redhat.com/api/compliance/v2/openapi.json',
apiFile: '../../src/store/service/emptyComplianceApi.ts',
apiImport: 'emptyComplianceApi',
outputFile: '../../src/store/service/complianceApi.ts',

View file

@ -1,17 +1,15 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi';
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',
apiImport: 'emptyComposerCloudApi',
outputFile: '../../src/store/cockpit/composerCloudApi.ts',
exportName: 'composerCloudApi',
hooks: false,
unionUndefined: true,
filterEndpoints: [
'postCompose',
'getComposeStatus',
],
filterEndpoints: ['postCompose', 'getComposeStatus'],
};
export default config;

View file

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

View file

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

View file

@ -1,7 +1,8 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi';
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',
apiImport: 'emptyImageBuilderApi',
outputFile: '../../src/store/service/imageBuilderApi.ts',

View file

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

View file

@ -1,7 +1,7 @@
import type { ConfigFile } from '@rtk-query/codegen-openapi';
const config: ConfigFile = {
schemaFile: '../schema/rhsm.json',
schemaFile: 'https://console.redhat.com/api/rhsm/v2/openapi.json',
apiFile: '../../src/store/service/emptyRhsmApi.ts',
apiImport: 'emptyRhsmApi',
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",
"build": "fec build",
"build:cockpit": "webpack --config cockpit/webpack.config.ts",
"api": "npm-run-all api:pull api:generate",
"api:generate": "bash api/codegen.sh",
"api:pull": "bash api/pull.sh",
"api": "bash api/codegen.sh",
"verify": "npm-run-all build lint test",
"postinstall": "ts-patch install",
"circular": "madge --circular ./src --extensions js,ts,tsx",

View file

@ -31,7 +31,10 @@ import {
MODAL_ANCHOR,
SEARCH_INPUT,
} from '../../constants';
import { useGetBlueprintsQuery, useGetComposeStatusQuery } from '../../store/backendApi';
import {
useGetBlueprintsQuery,
useGetComposeStatusQuery,
} from '../../store/backendApi';
import {
selectBlueprintSearchInput,
selectSelectedBlueprintId,
@ -109,7 +112,7 @@ const ProvisioningLink = ({
scope: 'provisioning',
module: './ProvisioningWizard',
},
{}
{},
);
const { permissions, isLoading: isLoadingPermission } =
@ -118,7 +121,7 @@ const ProvisioningLink = ({
// 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.
const [appendTo] = useState(
document.querySelector(MODAL_ANCHOR) as HTMLElement
document.querySelector(MODAL_ANCHOR) as HTMLElement,
);
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
@ -129,10 +132,10 @@ const ProvisioningLink = ({
{
selectFromResult: ({ data }) => ({
selectedBlueprintVersion: data?.data.find(
(blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId
(blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId,
)?.version,
}),
}
},
);
if (
@ -262,7 +265,7 @@ export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => {
if (options && !isOciUploadStatus(options)) {
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': '',
vhd: '',
oci: '',
'openshift-virt': '.tar',
};
const status = composeStatus?.image_status.status;
@ -397,7 +399,7 @@ export const AwsS3Instance = ({
if (options && !isAwss3UploadStatus(options)) {
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',
vhd: '',
oci: 'Oracle Cloud Infrastructure',
'openshift-virt': 'OpenShift Virtualization',
};
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.
*/
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 = {
/** Name of the module to enable.

View file

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

View file

@ -462,7 +462,6 @@ export type ImageTypes =
| "guest-image"
| "image-installer"
| "oci"
| "openshift-virt"
| "vsphere"
| "vsphere-ova"
| "wsl"
@ -552,10 +551,11 @@ export type OsTree = {
rhsm?: boolean | undefined;
};
export type AapRegistration = {
ansible_controller_url: string;
job_template_id: number;
ansible_callback_url: string;
host_config_key: string;
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 = {
/** 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 */
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 = {
name: string;
/** 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;
openscap?: OpenScap | undefined;
filesystem?: Filesystem[] | undefined;
disk?: Disk | undefined;
/** List of users that a customer can add,
also specifying their respective groups and SSH keys and/or password
*/
@ -864,7 +924,7 @@ export type BlueprintExportResponse = {
export type ComposeResponse = {
id: string;
};
export type ClientId = "api" | "ui";
export type ClientId = "api" | "ui" | "mcp";
export type ComposeRequest = {
distribution: Distributions;
image_name?: string | undefined;