@@ -44,21 +44,26 @@ export async function promote(
4444 kubectl : Kubectl ,
4545 manifests : string [ ] ,
4646 deploymentStrategy : DeploymentStrategy ,
47- resourceType : ClusterType
47+ resourceType : ClusterType ,
48+ timeout ?: string
4849) {
4950 switch ( deploymentStrategy ) {
5051 case DeploymentStrategy . CANARY :
51- await promoteCanary ( kubectl , manifests )
52+ await promoteCanary ( kubectl , manifests , timeout )
5253 break
5354 case DeploymentStrategy . BLUE_GREEN :
54- await promoteBlueGreen ( kubectl , manifests , resourceType )
55+ await promoteBlueGreen ( kubectl , manifests , resourceType , timeout )
5556 break
5657 default :
5758 throw Error ( 'Invalid promote deployment strategy' )
5859 }
5960}
6061
61- async function promoteCanary ( kubectl : Kubectl , manifests : string [ ] ) {
62+ async function promoteCanary (
63+ kubectl : Kubectl ,
64+ manifests : string [ ] ,
65+ timeout ?: string
66+ ) {
6267 let includeServices = false
6368
6469 const manifestFilesForDeployment : string [ ] = updateManifestFiles ( manifests )
@@ -76,7 +81,8 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
7681 core . startGroup ( 'Redirecting traffic to canary deployment' )
7782 await SMICanaryDeploymentHelper . redirectTrafficToCanaryDeployment (
7883 kubectl ,
79- manifests
84+ manifests ,
85+ timeout
8086 )
8187 core . endGroup ( )
8288
@@ -87,7 +93,8 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
8793 promoteResult = await SMICanaryDeploymentHelper . deploySMICanary (
8894 manifestFilesForDeployment ,
8995 kubectl ,
90- true
96+ true ,
97+ timeout
9198 )
9299
93100 core . endGroup ( )
@@ -96,7 +103,8 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
96103 const stableRedirectManifests =
97104 await SMICanaryDeploymentHelper . redirectTrafficToStableDeployment (
98105 kubectl ,
99- manifests
106+ manifests ,
107+ timeout
100108 )
101109
102110 filesToAnnotate = promoteResult . manifestFiles . concat (
@@ -109,7 +117,8 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
109117 promoteResult = await PodCanaryHelper . deployPodCanary (
110118 manifestFilesForDeployment ,
111119 kubectl ,
112- true
120+ true ,
121+ timeout
113122 )
114123 filesToAnnotate = promoteResult . manifestFiles
115124 core . endGroup ( )
@@ -144,7 +153,8 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
144153async function promoteBlueGreen (
145154 kubectl : Kubectl ,
146155 manifests : string [ ] ,
147- resourceType : ClusterType
156+ resourceType : ClusterType ,
157+ timeout ?: string
148158) {
149159 // update container images and pull secrets
150160 const inputManifestFiles : string [ ] = updateManifestFiles ( manifests )
@@ -160,11 +170,19 @@ async function promoteBlueGreen(
160170 const { deployResult} = await ( async ( ) => {
161171 switch ( routeStrategy ) {
162172 case RouteStrategy . INGRESS :
163- return await promoteBlueGreenIngress ( kubectl , manifestObjects )
173+ return await promoteBlueGreenIngress (
174+ kubectl ,
175+ manifestObjects ,
176+ timeout
177+ )
164178 case RouteStrategy . SMI :
165- return await promoteBlueGreenSMI ( kubectl , manifestObjects )
179+ return await promoteBlueGreenSMI ( kubectl , manifestObjects , timeout )
166180 default :
167- return await promoteBlueGreenService ( kubectl , manifestObjects )
181+ return await promoteBlueGreenService (
182+ kubectl ,
183+ manifestObjects ,
184+ timeout
185+ )
168186 }
169187 } ) ( )
170188
@@ -182,7 +200,8 @@ async function promoteBlueGreen(
182200 await KubernetesManifestUtility . checkManifestStability (
183201 kubectl ,
184202 resources ,
185- resourceType
203+ resourceType ,
204+ timeout
186205 )
187206 core . endGroup ( )
188207
@@ -201,23 +220,32 @@ async function promoteBlueGreen(
201220 [ ] . concat (
202221 manifestObjects . deploymentEntityList ,
203222 manifestObjects . serviceEntityList
204- )
223+ ) ,
224+ timeout
205225 )
206226 } else if ( routeStrategy == RouteStrategy . SMI ) {
207227 await routeBlueGreenSMI (
208228 kubectl ,
209229 NONE_LABEL_VALUE ,
210230 manifestObjects . serviceEntityList
211231 )
212- await deleteGreenObjects ( kubectl , manifestObjects . deploymentEntityList )
213- await cleanupSMI ( kubectl , manifestObjects . serviceEntityList )
232+ await deleteGreenObjects (
233+ kubectl ,
234+ manifestObjects . deploymentEntityList ,
235+ timeout
236+ )
237+ await cleanupSMI ( kubectl , manifestObjects . serviceEntityList , timeout )
214238 } else {
215239 await routeBlueGreenService (
216240 kubectl ,
217241 NONE_LABEL_VALUE ,
218242 manifestObjects . serviceEntityList
219243 )
220- await deleteGreenObjects ( kubectl , manifestObjects . deploymentEntityList )
244+ await deleteGreenObjects (
245+ kubectl ,
246+ manifestObjects . deploymentEntityList ,
247+ timeout
248+ )
221249 }
222250 core . endGroup ( )
223251
0 commit comments