mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-28 15:59:27 +08:00
added try catch logic to prevent future failures if annotations fail since failing annotations shouldn't affect users
This commit is contained in:
@@ -70,3 +70,4 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment containerName=nginx:1.14.2 labels=app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_basic selectorLabels=app:nginx
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Deployment name=nginx-deployment containerName=nginx:1.14.2 labels=app:nginx,workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_basic selectorLabels=app:nginx
|
||||||
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_basic selectorLabels=app:nginx
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_basic selectorLabels=app:nginx
|
||||||
|
python test/integration/k8s-deploy-test.py namespace=${{ env.NAMESPACE }} kind=Service name=nginx-service labels=workflow:actions.github.com-k8s-deploy,workflowFriendlyName:Minikube_Integration_Tests_-_basic selectorLabels=app:nginx
|
||||||
|
|||||||
@@ -155,17 +155,25 @@ export async function annotateAndLabelResources(
|
|||||||
|
|
||||||
const deploymentConfig = await getDeploymentConfig()
|
const deploymentConfig = await getDeploymentConfig()
|
||||||
const annotationKeyLabel = getWorkflowAnnotationKeyLabel()
|
const annotationKeyLabel = getWorkflowAnnotationKeyLabel()
|
||||||
|
try {
|
||||||
|
await annotateResources(
|
||||||
|
files,
|
||||||
|
kubectl,
|
||||||
|
resourceTypes,
|
||||||
|
allPods,
|
||||||
|
annotationKeyLabel,
|
||||||
|
workflowFilePath,
|
||||||
|
deploymentConfig
|
||||||
|
)
|
||||||
|
} catch (ex) {
|
||||||
|
core.warning(`Failed to annotate resources: ${ex} `)
|
||||||
|
}
|
||||||
|
|
||||||
await annotateResources(
|
try {
|
||||||
files,
|
await labelResources(files, kubectl, annotationKeyLabel)
|
||||||
kubectl,
|
} catch (ex) {
|
||||||
resourceTypes,
|
core.warning(`Failed to label resources: ${ex}`)
|
||||||
allPods,
|
}
|
||||||
annotationKeyLabel,
|
|
||||||
workflowFilePath,
|
|
||||||
deploymentConfig
|
|
||||||
)
|
|
||||||
await labelResources(files, kubectl, annotationKeyLabel)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function annotateResources(
|
async function annotateResources(
|
||||||
|
|||||||
@@ -241,6 +241,8 @@ def main():
|
|||||||
RESULT, msg = verifyIngress(k8_object, parsedArgs)
|
RESULT, msg = verifyIngress(k8_object, parsedArgs)
|
||||||
if kind == "TrafficSplit":
|
if kind == "TrafficSplit":
|
||||||
RESULT, msg = verifyTSObject(k8_object, parsedArgs)
|
RESULT, msg = verifyTSObject(k8_object, parsedArgs)
|
||||||
|
if kind == "Pod":
|
||||||
|
RESULT, msg = verifyPod(k8_object, parsedArgs)
|
||||||
|
|
||||||
if not RESULT:
|
if not RESULT:
|
||||||
sys.exit(f"{kind} {name} failed check: {msg}")
|
sys.exit(f"{kind} {name} failed check: {msg}")
|
||||||
|
|||||||
Reference in New Issue
Block a user