From a44f84e14d074e8f19668759204798fccfca6929 Mon Sep 17 00:00:00 2001 From: vakr Date: Thu, 8 Sep 2022 17:01:20 -0700 Subject: [PATCH 1/3] fix: pipelines exit early on error --- .../npm-conformance-tests-latest-release.yaml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.pipelines/npm/npm-conformance-tests-latest-release.yaml b/.pipelines/npm/npm-conformance-tests-latest-release.yaml index 8b05e49c2b..73965cd8d0 100644 --- a/.pipelines/npm/npm-conformance-tests-latest-release.yaml +++ b/.pipelines/npm/npm-conformance-tests-latest-release.yaml @@ -141,6 +141,12 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 1 + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + # don't schedule anything on the linux system pool echo "Updating $(AZURE_CLUSTER) to not schedule anything on linux pool..." az aks nodepool update \ @@ -149,6 +155,12 @@ jobs: -n nodepool1 \ --node-taints CriticalAddonsOnly=true:NoSchedule + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + echo "Adding Windows nodepool to $(AZURE_CLUSTER) to group $(RESOURCE_GROUP)" az aks nodepool add \ --resource-group $(RESOURCE_GROUP) \ @@ -159,6 +171,12 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 2 + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + az aks get-credentials -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --file ./kubeconfig ./kubectl --kubeconfig=./kubeconfig apply -f https://raw.githubusercontent.com/Azure/azure-container-networking/master/npm/examples/windows/azure-npm.yaml ./kubectl --kubeconfig=./kubeconfig set image daemonset/azure-npm-win -n kube-system azure-npm=$IMAGE_REGISTRY/azure-npm:windows-amd64-$(TAG) @@ -170,6 +188,12 @@ jobs: --name $(AZURE_CLUSTER) \ --network-plugin azure + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + az aks get-credentials -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --file ./kubeconfig # deploy azure-npm @@ -185,6 +209,12 @@ jobs: ./kubectl --kubeconfig=./kubeconfig describe daemonset azure-npm -n kube-system + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + FQDN=`az aks show -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --query fqdn -o tsv` echo "##vso[task.setvariable variable=FQDN]$FQDN" - bash: | From 4d420be5969f1b8f6d82b21e5f7581e8dac937e3 Mon Sep 17 00:00:00 2001 From: vakr Date: Thu, 8 Sep 2022 17:02:42 -0700 Subject: [PATCH 2/3] fix: pipelines exit early on error --- .../npm-conformance-tests-latest-release.yaml | 10 +++--- .pipelines/npm/npm-conformance-tests.yaml | 33 +++++++++++++++++-- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/.pipelines/npm/npm-conformance-tests-latest-release.yaml b/.pipelines/npm/npm-conformance-tests-latest-release.yaml index 73965cd8d0..590e5d15f6 100644 --- a/.pipelines/npm/npm-conformance-tests-latest-release.yaml +++ b/.pipelines/npm/npm-conformance-tests-latest-release.yaml @@ -209,11 +209,11 @@ jobs: ./kubectl --kubeconfig=./kubeconfig describe daemonset azure-npm -n kube-system - if [ $? == 0 ] - then - echo "Failing fast since previous command failed" - exit 1 - fi + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi FQDN=`az aks show -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --query fqdn -o tsv` echo "##vso[task.setvariable variable=FQDN]$FQDN" diff --git a/.pipelines/npm/npm-conformance-tests.yaml b/.pipelines/npm/npm-conformance-tests.yaml index 9f5808727e..f0ec2590ef 100644 --- a/.pipelines/npm/npm-conformance-tests.yaml +++ b/.pipelines/npm/npm-conformance-tests.yaml @@ -186,6 +186,12 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 1 + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + # don't schedule anything on the linux system pool echo "Updating $(AZURE_CLUSTER) to not schedule anything on linux pool..." az aks nodepool update \ @@ -194,6 +200,12 @@ jobs: -n nodepool1 \ --node-taints CriticalAddonsOnly=true:NoSchedule + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + echo "Adding Windows nodepool to $(AZURE_CLUSTER) to group $(RESOURCE_GROUP)" az aks nodepool add \ --resource-group $(RESOURCE_GROUP) \ @@ -204,6 +216,12 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 2 + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + az aks get-credentials -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --file ./kubeconfig ./kubectl --kubeconfig=./kubeconfig apply -f https://raw.githubusercontent.com/Azure/azure-container-networking/master/npm/examples/windows/azure-npm.yaml ./kubectl --kubeconfig=./kubeconfig set image daemonset/azure-npm-win -n kube-system azure-npm=$IMAGE_REGISTRY/azure-npm:windows-amd64-$(TAG) @@ -215,6 +233,12 @@ jobs: --name $(AZURE_CLUSTER) \ --network-plugin azure + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + az aks get-credentials -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --file ./kubeconfig # deploy azure-npm @@ -230,6 +254,12 @@ jobs: ./kubectl --kubeconfig=./kubeconfig describe daemonset azure-npm -n kube-system + if [ $? == 0 ] + then + echo "Failing fast since previous command failed" + exit 1 + fi + FQDN=`az aks show -n $(AZURE_CLUSTER) -g $(RESOURCE_GROUP) --query fqdn -o tsv` echo "##vso[task.setvariable variable=FQDN]$FQDN" - bash: | @@ -439,8 +469,6 @@ jobs: FQDN=`az aks show -n $CLUSTER_NAME -g $CLUSTER_NAME --query fqdn -o tsv` echo "##vso[task.setvariable variable=FQDN]$FQDN" - - - script: | cat ~/.kube/config curl -fsSL github.com/mattfenwick/cyclonus/releases/latest/download/cyclonus_linux_amd64.tar.gz | tar -zxv @@ -449,7 +477,6 @@ jobs: failOnStderr: false condition: always() - - script: | ./test/cyclonus/test-cyclonus-windows.sh name: cyclonus From 6aae312ce8778bcef0977d35b7e5f904f4f4db8d Mon Sep 17 00:00:00 2001 From: vakr Date: Fri, 9 Sep 2022 10:24:41 -0700 Subject: [PATCH 3/3] adding fail check --- .../npm/npm-conformance-tests-latest-release.yaml | 10 +++++----- .pipelines/npm/npm-conformance-tests.yaml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pipelines/npm/npm-conformance-tests-latest-release.yaml b/.pipelines/npm/npm-conformance-tests-latest-release.yaml index 590e5d15f6..3ff85460aa 100644 --- a/.pipelines/npm/npm-conformance-tests-latest-release.yaml +++ b/.pipelines/npm/npm-conformance-tests-latest-release.yaml @@ -141,7 +141,7 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 1 - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -155,7 +155,7 @@ jobs: -n nodepool1 \ --node-taints CriticalAddonsOnly=true:NoSchedule - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -171,7 +171,7 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 2 - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -188,7 +188,7 @@ jobs: --name $(AZURE_CLUSTER) \ --network-plugin azure - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -209,7 +209,7 @@ jobs: ./kubectl --kubeconfig=./kubeconfig describe daemonset azure-npm -n kube-system - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 diff --git a/.pipelines/npm/npm-conformance-tests.yaml b/.pipelines/npm/npm-conformance-tests.yaml index f0ec2590ef..ef412321cc 100644 --- a/.pipelines/npm/npm-conformance-tests.yaml +++ b/.pipelines/npm/npm-conformance-tests.yaml @@ -186,7 +186,7 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 1 - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -200,7 +200,7 @@ jobs: -n nodepool1 \ --node-taints CriticalAddonsOnly=true:NoSchedule - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -216,7 +216,7 @@ jobs: --node-vm-size Standard_D4s_v3 \ --node-count 2 - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -233,7 +233,7 @@ jobs: --name $(AZURE_CLUSTER) \ --network-plugin azure - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1 @@ -254,7 +254,7 @@ jobs: ./kubectl --kubeconfig=./kubeconfig describe daemonset azure-npm -n kube-system - if [ $? == 0 ] + if [ $? != 0 ] then echo "Failing fast since previous command failed" exit 1