v5.0.1 Release with Fleet Types (#358)

* extract resource type

* fleet details

* new release with fleet

* format

* type params

* format

* promote input

* format

* fleet type

* format pls
This commit is contained in:
David Gamero
2024-12-09 17:14:44 -05:00
committed by GitHub
parent d1acc1a47b
commit 3d107b044d
7 changed files with 74 additions and 18 deletions
+28 -3
View File
@@ -1,5 +1,8 @@
import * as manifestStabilityUtils from './manifestStabilityUtils'
import {Kubectl} from '../types/kubectl'
import {ResourceTypeFleet, ResourceTypeManagedCluster} from '../actions/deploy'
import {ExecOutput} from '@actions/exec'
import {exitCode, stdout} from 'process'
describe('manifestStabilityUtils', () => {
const kc = new Kubectl('')
@@ -10,18 +13,40 @@ describe('manifestStabilityUtils', () => {
namespace: 'default'
}
]
const resourceType = 'microsoft.containerservice/fleets'
it('should return immediately if the resource type is microsoft.containerservice/fleets', async () => {
it('should return immediately if the resource type is fleet', async () => {
const spy = jest.spyOn(manifestStabilityUtils, 'checkManifestStability')
const checkRolloutStatusSpy = jest.spyOn(kc, 'checkRolloutStatus')
await manifestStabilityUtils.checkManifestStability(
kc,
resources,
resourceType
ResourceTypeFleet
)
expect(checkRolloutStatusSpy).not.toHaveBeenCalled()
expect(spy).toHaveReturned()
})
it('should run fully if the resource type is managedCluster', async () => {
const spy = jest.spyOn(manifestStabilityUtils, 'checkManifestStability')
const checkRolloutStatusSpy = jest
.spyOn(kc, 'checkRolloutStatus')
.mockImplementation(() => {
return new Promise<ExecOutput>((resolve, reject) => {
resolve({
exitCode: 0,
stderr: '',
stdout: ''
})
})
})
await manifestStabilityUtils.checkManifestStability(
kc,
resources,
ResourceTypeManagedCluster
)
expect(checkRolloutStatusSpy).toHaveBeenCalled()
expect(spy).toHaveReturned()
})
})
+4 -5
View File
@@ -3,6 +3,7 @@ import * as KubernetesConstants from '../types/kubernetesTypes'
import {Kubectl, Resource} from '../types/kubectl'
import {checkForErrors} from './kubectlUtils'
import {sleep} from './timeUtils'
import {ClusterType, ResourceTypeFleet} from '../actions/deploy'
const IS_SILENT = false
const POD = 'pod'
@@ -10,13 +11,11 @@ const POD = 'pod'
export async function checkManifestStability(
kubectl: Kubectl,
resources: Resource[],
resourceType: string
clusterTyper: ClusterType
): Promise<void> {
// Skip if resource type is microsoft.containerservice/fleets
if (resourceType === 'microsoft.containerservice/fleets') {
core.info(
'Skipping checkManifestStability for microsoft.containerservice/fleets'
)
if (clusterTyper === ResourceTypeFleet) {
core.info(`Skipping checkManifestStability for ${ResourceTypeFleet}`)
return
}
let rolloutStatusHasErrors = false