mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-27 07:09:26 +08:00
Add timeout to the rollout status (#425)
* Added timeout to the rollout status and tests for it * Fixed integration test errors * Fix for blue green integration test * Probable fix for integration errors * No jobs run error fixed * Changed timeout to file level constant * Added parsing logic for timeout * Made tests more concise * implemented timeout validation check in an extracted utils mod * Changed function name to parseDuration * Removed timeout parameter from getResource --------- Co-authored-by: David Gamero <david340804@gmail.com> Co-authored-by: Suneha Bose <123775811+bosesuneha@users.noreply.github.com>
This commit is contained in:
+27
-3
@@ -13,6 +13,7 @@ import {parseDeploymentStrategy} from './types/deploymentStrategy'
|
||||
import {getFilesFromDirectoriesAndURLs} from './utilities/fileUtils'
|
||||
import {PrivateKubectl} from './types/privatekubectl'
|
||||
import {parseResourceTypeInput} from './inputUtils'
|
||||
import {parseDuration} from './utilities/durationUtils'
|
||||
|
||||
export async function run() {
|
||||
// verify kubeconfig is set
|
||||
@@ -52,6 +53,17 @@ export async function run() {
|
||||
return
|
||||
}
|
||||
|
||||
// Parse and validate timeout using extracted utility
|
||||
let timeout: string
|
||||
try {
|
||||
const timeoutInput = core.getInput('timeout') || '10m'
|
||||
timeout = parseDuration(timeoutInput)
|
||||
core.debug(`Using timeout: ${timeout}`)
|
||||
} catch (e) {
|
||||
core.setFailed(`Invalid timeout parameter: ${e.message}`)
|
||||
return
|
||||
}
|
||||
|
||||
const kubectl = isPrivateCluster
|
||||
? new PrivateKubectl(
|
||||
kubectlPath,
|
||||
@@ -65,15 +77,27 @@ export async function run() {
|
||||
// run action
|
||||
switch (action) {
|
||||
case Action.DEPLOY: {
|
||||
await deploy(kubectl, fullManifestFilePaths, strategy, resourceType)
|
||||
await deploy(
|
||||
kubectl,
|
||||
fullManifestFilePaths,
|
||||
strategy,
|
||||
resourceType,
|
||||
timeout
|
||||
)
|
||||
break
|
||||
}
|
||||
case Action.PROMOTE: {
|
||||
await promote(kubectl, fullManifestFilePaths, strategy, resourceType)
|
||||
await promote(
|
||||
kubectl,
|
||||
fullManifestFilePaths,
|
||||
strategy,
|
||||
resourceType,
|
||||
timeout
|
||||
)
|
||||
break
|
||||
}
|
||||
case Action.REJECT: {
|
||||
await reject(kubectl, fullManifestFilePaths, strategy)
|
||||
await reject(kubectl, fullManifestFilePaths, strategy, timeout)
|
||||
break
|
||||
}
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user