0

Deploy services

by
Published Oct 17, 2025

Update and deploy the selected services

Script qovery Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Deploy services
4
 * Update and deploy the selected services
5
 */
6
export async function main(auth: RT.Qovery, environmentId: string, body: Body) {
7
	const url = new URL(`https://api.qovery.com/environment/${environmentId}/service/deploy`)
8

9
	const response = await fetch(url, {
10
		method: 'POST',
11
		headers: {
12
			'Content-Type': 'application/json',
13
			Authorization: 'Token ' + auth.apiKey
14
		},
15
		body: JSON.stringify(body)
16
	})
17
	if (!response.ok) {
18
		const text = await response.text()
19
		throw new Error(`${response.status} ${text}`)
20
	}
21
	return await response.json()
22
}
23

24
/* eslint-disable */
25
/**
26
 * This file was automatically generated by json-schema-to-typescript.
27
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
28
 * and run json-schema-to-typescript to regenerate this file.
29
 */
30

31
export interface Body {
32
	applications?: {
33
		/**
34
		 * id of the application to be deployed.
35
		 */
36
		application_id: string
37
		/**
38
		 * Commit ID to deploy. Can be empty only if the service has been already deployed (in this case the service version won't be changed)
39
		 */
40
		git_commit_id?: string
41
		[k: string]: unknown
42
	}[]
43
	databases?: string[]
44
	containers?: {
45
		/**
46
		 * id of the container to be updated.
47
		 */
48
		id: string
49
		/**
50
		 * new tag for the container. Can be empty only if the service has been already deployed (in this case the service version won't be changed)
51
		 */
52
		image_tag?: string
53
		[k: string]: unknown
54
	}[]
55
	jobs?: {
56
		/**
57
		 * id of the job to be updated.
58
		 */
59
		id?: string
60
		/**
61
		 * new tag for the job image. Use only if job is an image source. Can be empty only if the service has been already deployed (in this case the service version won't be changed)
62
		 */
63
		image_tag?: string
64
		/**
65
		 * Commit ID to deploy. Use only if job is a repository source. Can be empty only if the service has been already deployed (in this case the service version won't be changed)
66
		 */
67
		git_commit_id?: string
68
		[k: string]: unknown
69
	}[]
70
	helms?: {
71
		/**
72
		 * id of the helm to be updated.
73
		 */
74
		id?: string
75
		/**
76
		 * The new chart version for the Helm source. Use this only if the helm has a Helm repository source.
77
		 */
78
		chart_version?: string
79
		/**
80
		 * The commit Id to deploy. Use this only if the helm has a Git repository source.
81
		 */
82
		git_commit_id?: string
83
		/**
84
		 * The commit Id of the override values to deploy. Use only if the helm has a Git override values repository.
85
		 */
86
		values_override_git_commit_id?: string
87
		[k: string]: unknown
88
	}[]
89
	terraforms?: {
90
		/**
91
		 * Terraform service identifier
92
		 */
93
		id?: string
94
		/**
95
		 * Commit to deploy for chart source.
96
		 */
97
		git_commit_id?: string
98
		/**
99
		 * Deprecated: use action=PLAN instead.
100
		 */
101
		dry_run?: boolean
102
		/**
103
		 * Deprecated: use action=FORCE_UNLOCK instead.
104
		 */
105
		force_unlock_state?: boolean
106
		/**
107
		 * Terraform action to execute.
108
		 */
109
		action?: 'PLAN' | 'FORCE_UNLOCK' | 'MIGRATE_STATE'
110
		[k: string]: unknown
111
	}[]
112
	[k: string]: unknown
113
}
114