@@ -38,19 +38,20 @@ import {
3838 TrafficSplitMethod
3939} from '../types/trafficSplitMethod'
4040import { parseRouteStrategy , RouteStrategy } from '../types/routeStrategy'
41- import { ResourceTypeFleet , ResourceTypeManagedCluster } from './deploy '
41+ import { ClusterType } from '../inputUtils '
4242
4343export async function promote (
4444 kubectl : Kubectl ,
4545 manifests : string [ ] ,
46- deploymentStrategy : DeploymentStrategy
46+ deploymentStrategy : DeploymentStrategy ,
47+ resourceType : ClusterType
4748) {
4849 switch ( deploymentStrategy ) {
4950 case DeploymentStrategy . CANARY :
5051 await promoteCanary ( kubectl , manifests )
5152 break
5253 case DeploymentStrategy . BLUE_GREEN :
53- await promoteBlueGreen ( kubectl , manifests )
54+ await promoteBlueGreen ( kubectl , manifests , resourceType )
5455 break
5556 default :
5657 throw Error ( 'Invalid promote deployment strategy' )
@@ -140,7 +141,11 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
140141 core . endGroup ( )
141142}
142143
143- async function promoteBlueGreen ( kubectl : Kubectl , manifests : string [ ] ) {
144+ async function promoteBlueGreen (
145+ kubectl : Kubectl ,
146+ manifests : string [ ] ,
147+ resourceType : ClusterType
148+ ) {
144149 // update container images and pull secrets
145150 const inputManifestFiles : string [ ] = updateManifestFiles ( manifests )
146151 const manifestObjects : BlueGreenManifests =
@@ -167,23 +172,13 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
167172
168173 // checking stability of newly created deployments
169174 core . startGroup ( 'Checking manifest stability' )
170- const resourceType =
171- core . getInput ( 'resource-type' ) || ResourceTypeManagedCluster
172175 const deployedManifestFiles = deployResult . manifestFiles
173176 const resources : Resource [ ] = getResources (
174177 deployedManifestFiles ,
175178 models . DEPLOYMENT_TYPES . concat ( [
176179 models . DiscoveryAndLoadBalancerResource . SERVICE
177180 ] )
178181 )
179- if (
180- resourceType !== ResourceTypeManagedCluster &&
181- resourceType !== ResourceTypeFleet
182- ) {
183- const errMsg = `Invalid resource type: ${ resourceType } . Supported resource types are: ${ ResourceTypeManagedCluster } (default), fleet`
184- core . setFailed ( errMsg )
185- throw new Error ( errMsg )
186- }
187182 await KubernetesManifestUtility . checkManifestStability (
188183 kubectl ,
189184 resources ,
0 commit comments