diff --git a/src/schemas/_index.yaml b/src/schemas/_index.yaml index 9f8fbf1d..be32e91e 100644 --- a/src/schemas/_index.yaml +++ b/src/schemas/_index.yaml @@ -755,4 +755,6 @@ ServiceTypeForVariableEnum: LifecycleJobResponse: $ref: ./job/LifecycleJobResponse.yaml CronJobResponse: - $ref: ./job/CronJobResponse.yaml \ No newline at end of file + $ref: ./job/CronJobResponse.yaml +BaseJobResponse: + $ref: ./job/BaseJobResponse.yaml diff --git a/src/schemas/job/BaseJobResponse.yaml b/src/schemas/job/BaseJobResponse.yaml new file mode 100644 index 00000000..c3177763 --- /dev/null +++ b/src/schemas/job/BaseJobResponse.yaml @@ -0,0 +1,88 @@ +allOf: + - $ref: '../BaseResponse.yaml' + - type: object + required: + - environment + - name + - tag + - auto_preview + - cpu + - memory + - min_running_instances + - max_running_instances + - maximum_cpu + - maximum_memory + - healthchecks + - source + properties: + environment: + $ref: '../ReferenceObject.yaml' + maximum_cpu: + type: integer + description: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu + example: 16000 + maximum_memory: + type: integer + description: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB + example: 16384 + name: + type: string + description: name is case insensitive + description: + type: string + cpu: + type: integer + description: unit is millicores (m). 1000m = 1 cpu + example: 1250 + memory: + type: integer + description: unit is MB. 1024 MB = 1GB + example: 1024 + max_nb_restart: + type: integer + minimum: 0 + description: | + Maximum number of restart allowed before the job is considered as failed + 0 means that no restart/crash of the job is allowed + max_duration_seconds: + type: integer + minimum: 0 + description: | + Maximum number of seconds allowed for the job to run before killing it and mark it as failed + auto_preview: + type: boolean + description: | + Indicates if the 'environment preview option' is enabled for this container. + If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. + If not specified, it takes the value of the `auto_preview` property from the associated environment. + port: + type: integer + nullable: true + minimum: 1 + description: Port where to run readiness and liveliness probes checks. The port will not be exposed externally + default: null + source: + nullable: false + oneOf: + - type: object + properties: + image: + $ref: '../ContainerSource.yaml' + - type: object + properties: + docker: + type: object + properties: + dockerfile_path: + type: string + description: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER + nullable: true + git_repository: + $ref: '../ApplicationGitRepositoryResponse.yaml' + healthchecks: + $ref: '../Healthcheck.yaml' + auto_deploy: + type: boolean + description: | + Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. + The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments diff --git a/src/schemas/job/CronJobResponse.yaml b/src/schemas/job/CronJobResponse.yaml index c8b97a2e..24707172 100644 --- a/src/schemas/job/CronJobResponse.yaml +++ b/src/schemas/job/CronJobResponse.yaml @@ -1,95 +1,15 @@ allOf: - - $ref: '../BaseResponse.yaml' + - $ref: './BaseJobResponse.yaml' - type: object required: - - environment - - name - - tag - - auto_preview - - cpu - - memory - - min_running_instances - - max_running_instances - - maximum_cpu - - maximum_memory - - healthchecks - - source - job_type properties: - environment: - $ref: '../ReferenceObject.yaml' - maximum_cpu: - type: integer - description: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu - example: 16000 - maximum_memory: - type: integer - description: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB - example: 16384 - name: - type: string - description: name is case insensitive - description: - type: string - cpu: - type: integer - description: unit is millicores (m). 1000m = 1 cpu - example: 1250 - memory: - type: integer - description: unit is MB. 1024 MB = 1GB - example: 1024 - max_nb_restart: - type: integer - minimum: 0 - description: | - Maximum number of restart allowed before the job is considered as failed - 0 means that no restart/crash of the job is allowed - max_duration_seconds: - type: integer - minimum: 0 - description: | - Maximum number of seconds allowed for the job to run before killing it and mark it as failed - auto_preview: - type: boolean - description: | - Indicates if the 'environment preview option' is enabled for this container. - If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. - If not specified, it takes the value of the `auto_preview` property from the associated environment. - port: - type: integer - nullable: true - minimum: 1 - description: Port where to run readiness and liveliness probes checks. The port will not be exposed externally - default: null - source: - nullable: false - oneOf: - - type: object - properties: - image: - $ref: '../ContainerSource.yaml' - - type: object - properties: - docker: - type: object - properties: - dockerfile_path: - type: string - description: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER - nullable: true - git_repository: - $ref: '../ApplicationGitRepositoryResponse.yaml' - healthchecks: - $ref: '../Healthcheck.yaml' job_type: type: string enum: - CRON schedule: type: object - description: | - A Lifecycle job should contain at least one property `on_XXX` among the 3 properties: `on_start`, `on_stop`, `on_delete` properties: cronjob: type: object @@ -112,8 +32,3 @@ allOf: For example: `* * * * *` represent the cron to launch the job every minute. See https://crontab.guru/ to WISIWIG interface. Timezone is UT - auto_deploy: - type: boolean - description: | - Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. - The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments diff --git a/src/schemas/job/JobResponse.yaml b/src/schemas/job/JobResponse.yaml index 8f76126a..3609b784 100644 --- a/src/schemas/job/JobResponse.yaml +++ b/src/schemas/job/JobResponse.yaml @@ -1,145 +1,8 @@ -allOf: - - $ref: '../BaseResponse.yaml' - - type: object - required: - - environment - - name - - tag - - auto_preview - - cpu - - memory - - min_running_instances - - max_running_instances - - maximum_cpu - - maximum_memory - - healthchecks - - source - properties: - environment: - $ref: '../ReferenceObject.yaml' - maximum_cpu: - type: integer - description: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu - example: 16000 - maximum_memory: - type: integer - description: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB - example: 16384 - name: - type: string - description: name is case insensitive - description: - type: string - cpu: - type: integer - description: unit is millicores (m). 1000m = 1 cpu - example: 1250 - memory: - type: integer - description: unit is MB. 1024 MB = 1GB - example: 1024 - max_nb_restart: - type: integer - minimum: 0 - description: | - Maximum number of restart allowed before the job is considered as failed - 0 means that no restart/crash of the job is allowed - max_duration_seconds: - type: integer - minimum: 0 - description: | - Maximum number of seconds allowed for the job to run before killing it and mark it as failed - auto_preview: - type: boolean - description: | - Indicates if the 'environment preview option' is enabled for this container. - If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. - If not specified, it takes the value of the `auto_preview` property from the associated environment. - port: - type: integer - nullable: true - minimum: 1 - description: Port where to run readiness and liveliness probes checks. The port will not be exposed externally - default: null - source: - nullable: false - oneOf: - - type: object - properties: - image: - $ref: '../ContainerSource.yaml' - - type: object - properties: - docker: - type: object - properties: - dockerfile_path: - type: string - description: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER - nullable: true - git_repository: - $ref: '../ApplicationGitRepositoryResponse.yaml' - healthchecks: - $ref: '../Healthcheck.yaml' - schedule: - type: object - description: | - If you want to define a Cron job, only the `cronjob` property must be filled - A Lifecycle job should contain at least one property `on_XXX` among the 3 properties: `on_start`, `on_stop`, `on_delete` - properties: - on_start: - type: object - properties: - arguments: - type: array - items: - type: string - entrypoint: - type: string - description: optional entrypoint when launching container - on_stop: - type: object - properties: - arguments: - type: array - items: - type: string - entrypoint: - type: string - description: optional entrypoint when launching container - on_delete: - type: object - properties: - arguments: - type: array - items: - type: string - entrypoint: - type: string - description: optional entrypoint when launching container - cronjob: - type: object - required: - - scheduled_at - properties: - arguments: - type: array - items: - type: string - entrypoint: - type: string - description: optional entrypoint when launching container - scheduled_at: - type: string - format: cron - description: | - Can only be set if the event is CRON. - Represent the cron format for the job schedule without seconds. - For example: `* * * * *` represent the cron to launch the job every minute. - See https://crontab.guru/ to WISIWIG interface. - Timezone is UT - auto_deploy: - type: boolean - description: | - Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. - The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments +oneOf: + - $ref: './LifecycleJobResponse.yaml' + - $ref: './CronJobResponse.yaml' +discriminator: + propertyName: job_type + mapping: + LIFECYCLE: '#/components/schemas/LifecycleJobResponse' + CRON: '#/components/schemas/CronJobResponse' diff --git a/src/schemas/job/JobResponseList.yaml b/src/schemas/job/JobResponseList.yaml index 18c04257..440945a7 100644 --- a/src/schemas/job/JobResponseList.yaml +++ b/src/schemas/job/JobResponseList.yaml @@ -3,11 +3,4 @@ properties: results: type: array items: - oneOf: - - $ref: './LifecycleJobResponse.yaml' - - $ref: './CronJobResponse.yaml' - discriminator: - propertyName: job_type - mapping: - LIFECYCLE: '#/components/schemas/LifecycleJobResponse' - CRON: '#/components/schemas/CronJobResponse' + $ref: './JobResponse.yaml' diff --git a/src/schemas/job/LifecycleJobResponse.yaml b/src/schemas/job/LifecycleJobResponse.yaml index e2049269..57ec7428 100644 --- a/src/schemas/job/LifecycleJobResponse.yaml +++ b/src/schemas/job/LifecycleJobResponse.yaml @@ -1,87 +1,9 @@ allOf: - - $ref: '../BaseResponse.yaml' + - $ref: './BaseJobResponse.yaml' - type: object required: - - environment - - name - - tag - - auto_preview - - cpu - - memory - - min_running_instances - - max_running_instances - - maximum_cpu - - maximum_memory - - healthchecks - - source - job_type properties: - environment: - $ref: '../ReferenceObject.yaml' - maximum_cpu: - type: integer - description: Maximum cpu that can be allocated to the job based on organization cluster configuration. unit is millicores (m). 1000m = 1 cpu - example: 16000 - maximum_memory: - type: integer - description: Maximum memory that can be allocated to the job based on organization cluster configuration. unit is MB. 1024 MB = 1GB - example: 16384 - name: - type: string - description: name is case insensitive - description: - type: string - cpu: - type: integer - description: unit is millicores (m). 1000m = 1 cpu - example: 1250 - memory: - type: integer - description: unit is MB. 1024 MB = 1GB - example: 1024 - max_nb_restart: - type: integer - minimum: 0 - description: | - Maximum number of restart allowed before the job is considered as failed - 0 means that no restart/crash of the job is allowed - max_duration_seconds: - type: integer - minimum: 0 - description: | - Maximum number of seconds allowed for the job to run before killing it and mark it as failed - auto_preview: - type: boolean - description: | - Indicates if the 'environment preview option' is enabled for this container. - If enabled, a preview environment will be automatically cloned when `/preview` endpoint is called. - If not specified, it takes the value of the `auto_preview` property from the associated environment. - port: - type: integer - nullable: true - minimum: 1 - description: Port where to run readiness and liveliness probes checks. The port will not be exposed externally - default: null - source: - nullable: false - oneOf: - - type: object - properties: - image: - $ref: '../ContainerSource.yaml' - - type: object - properties: - docker: - type: object - properties: - dockerfile_path: - type: string - description: The path of the associated Dockerfile. Only if you are using build_mode = DOCKER - nullable: true - git_repository: - $ref: '../ApplicationGitRepositoryResponse.yaml' - healthchecks: - $ref: '../Healthcheck.yaml' job_type: type: string enum: @@ -119,8 +41,3 @@ allOf: entrypoint: type: string description: optional entrypoint when launching container - auto_deploy: - type: boolean - description: | - Specify if the job will be automatically updated after receiving a new image tag or a new commit according to the source type. - The new image tag shall be communicated via the "Auto Deploy job" endpoint https://api-doc.qovery.com/#tag/Jobs/operation/autoDeployJobEnvironments