mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-23 04:59:26 +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: |
|
||||
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
|
||||
|
||||
@@ -155,17 +155,25 @@ export async function annotateAndLabelResources(
|
||||
|
||||
const deploymentConfig = await getDeploymentConfig()
|
||||
const annotationKeyLabel = getWorkflowAnnotationKeyLabel()
|
||||
try {
|
||||
await annotateResources(
|
||||
files,
|
||||
kubectl,
|
||||
resourceTypes,
|
||||
allPods,
|
||||
annotationKeyLabel,
|
||||
workflowFilePath,
|
||||
deploymentConfig
|
||||
)
|
||||
} catch (ex) {
|
||||
core.warning(`Failed to annotate resources: ${ex} `)
|
||||
}
|
||||
|
||||
await annotateResources(
|
||||
files,
|
||||
kubectl,
|
||||
resourceTypes,
|
||||
allPods,
|
||||
annotationKeyLabel,
|
||||
workflowFilePath,
|
||||
deploymentConfig
|
||||
)
|
||||
await labelResources(files, kubectl, annotationKeyLabel)
|
||||
try {
|
||||
await labelResources(files, kubectl, annotationKeyLabel)
|
||||
} catch (ex) {
|
||||
core.warning(`Failed to label resources: ${ex}`)
|
||||
}
|
||||
}
|
||||
|
||||
async function annotateResources(
|
||||
|
||||
@@ -241,6 +241,8 @@ def main():
|
||||
RESULT, msg = verifyIngress(k8_object, parsedArgs)
|
||||
if kind == "TrafficSplit":
|
||||
RESULT, msg = verifyTSObject(k8_object, parsedArgs)
|
||||
if kind == "Pod":
|
||||
RESULT, msg = verifyPod(k8_object, parsedArgs)
|
||||
|
||||
if not RESULT:
|
||||
sys.exit(f"{kind} {name} failed check: {msg}")
|
||||
|
||||
Reference in New Issue
Block a user