diff --git a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml index e8a3498c0a..8d2b82931e 100644 --- a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml +++ b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml @@ -7,8 +7,12 @@ parameters: vmSize: "Standard_DS4_v2" os: "linux" +# Condition confirms that: +# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success. +# CONTROL_CNI either contains 'cniv1' or 'all'. It is not case sensitive stages: - stage: create_${{ parameters.name }} + condition: and( succeeded(), or( contains(variables.CONTROL_CNI, 'cilium') , contains(variables.CONTROL_CNI, 'all') ) ) variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] dependsOn: @@ -27,6 +31,10 @@ stages: vmSize: ${{ parameters.vmSize }} region: $(LOCATION) +# Conditions for below E2E test scenarios confirm that: +# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: +# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive +# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test. - stage: ${{ parameters.name }} variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] @@ -70,6 +78,7 @@ stages: sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) kubectl get po -owide -A - job: deploy_pods + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Scale Test" dependsOn: deploy_cilium_components steps: @@ -85,6 +94,7 @@ stages: parameters: clusterName: ${{ parameters.clusterName }}-$(commitID) - job: restart_nodes + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart Test" dependsOn: deploy_pods steps: @@ -101,6 +111,7 @@ stages: restartCase: "true" cnsManagedEndpoint: "true" - job: restart_cns + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartCNS') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart and Validate CNS" dependsOn: restart_nodes steps: diff --git a/.pipelines/cni/singletenancy/cniv1-template.yaml b/.pipelines/cni/singletenancy/cniv1-template.yaml index e489d364ea..5f3f90e4d2 100644 --- a/.pipelines/cni/singletenancy/cniv1-template.yaml +++ b/.pipelines/cni/singletenancy/cniv1-template.yaml @@ -22,29 +22,67 @@ parameters: # + The HNS state should be validated with that of CNI state. # + All CNI E2E is re-ran after HNS service is restarted +# If ensures that only linux template calls are compared against the below condition +# Condition confirms that: +# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success. +# CONTROL_OS either contains 'linux' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive stages: - - stage: create_${{ parameters.name }} - variables: - commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] - npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] - pool: - name: $(BUILD_POOL_NAME_DEFAULT) - dependsOn: - - setup - displayName: "Create Cluster - ${{ parameters.clusterName }}" - jobs: - - job: create_aks_cluster_with_${{ parameters.name }} - steps: - - template: ../load-test-templates/create-cluster-template.yaml - parameters: - clusterType: ${{ parameters.clusterType }} - clusterName: ${{ parameters.clusterName }}-$(commitID) - nodeCount: ${{ parameters.nodeCount }} - vmSize: ${{ parameters.vmSize }} - vmSizeWin: ${{ parameters.vmSizeWin }} - region: $(LOCATION) - osSKU: ${{ parameters.osSKU }} + - ${{ if eq(parameters.os, 'linux') }}: + - stage: create_${{ parameters.name }} + condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv1'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'linux'), contains(variables.CONTROL_OS, 'all') ) ) ) + variables: + commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] + npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] + pool: + name: $(BUILD_POOL_NAME_DEFAULT) + dependsOn: + - setup + displayName: "Create Cluster - ${{ parameters.clusterName }}" + jobs: + - job: create_aks_cluster_with_${{ parameters.name }} + steps: + - template: ../load-test-templates/create-cluster-template.yaml + parameters: + clusterType: ${{ parameters.clusterType }} + clusterName: ${{ parameters.clusterName }}-$(commitID) + nodeCount: ${{ parameters.nodeCount }} + vmSize: ${{ parameters.vmSize }} + vmSizeWin: ${{ parameters.vmSizeWin }} + region: $(LOCATION) + osSKU: ${{ parameters.osSKU }} + +# If ensures that only windows template calls are compared against the below condition +# Condition confirms that: +# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success. +# CONTROL_OS either contains 'windows' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive + - ${{ if eq(parameters.os, 'windows') }}: + - stage: create_${{ parameters.name }} + condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv1'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'windows'), contains(variables.CONTROL_OS, 'all') ) ) ) + variables: + commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] + npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] + pool: + name: $(BUILD_POOL_NAME_DEFAULT) + dependsOn: + - setup + displayName: "Create Cluster - ${{ parameters.clusterName }}" + jobs: + - job: create_aks_cluster_with_${{ parameters.name }} + steps: + - template: ../load-test-templates/create-cluster-template.yaml + parameters: + clusterType: ${{ parameters.clusterType }} + clusterName: ${{ parameters.clusterName }}-$(commitID) + nodeCount: ${{ parameters.nodeCount }} + vmSize: ${{ parameters.vmSize }} + vmSizeWin: ${{ parameters.vmSizeWin }} + region: $(LOCATION) + osSKU: ${{ parameters.osSKU }} +# Conditions for below E2E test scenarios confirm that: +# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: +# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive +# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test. - stage: ${{ parameters.name }} variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] @@ -95,6 +133,7 @@ stages: tag: $(npmVersion) dependsOn: update_cni - job: deploy_pods + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Scale Test" dependsOn: npm_k8se2e steps: @@ -112,6 +151,7 @@ stages: os: ${{ parameters.os }} cni: cniv1 - job: restart_nodes + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart Test" dependsOn: deploy_pods steps: @@ -176,6 +216,10 @@ stages: clusterName: ${{ parameters.clusterName }}-$(commitID) os: ${{ parameters.os }} +# Conditions for below E2E test scenarios confirm that: +# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: +# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive +# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test. - ${{ if eq(parameters.os, 'windows') }}: - stage: ${{ parameters.name }}_HNS variables: @@ -191,13 +235,14 @@ stages: jobs: - job: restart_hns displayName: "Restart and Validate HNS" - condition: and( succeeded(), ${{ eq(parameters.os, 'windows') }} ) + condition: and( and( not(canceled()), not(failed()) ), ${{ eq(parameters.os, 'windows') }} ) steps: - template: ../load-test-templates/restart-hns-template.yaml parameters: clusterName: ${{ parameters.clusterName }}-$(commitID) cni: cniv1 - job: deploy_podsHNS + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Scale Test" dependsOn: restart_hns steps: @@ -215,6 +260,7 @@ stages: os: ${{ parameters.os }} cni: cniv1 - job: restart_nodesHNS + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart Test" dependsOn: deploy_podsHNS steps: diff --git a/.pipelines/cni/singletenancy/linux-cniv2-template.yaml b/.pipelines/cni/singletenancy/linux-cniv2-template.yaml index 7f2dcca0c8..a496bf7d74 100644 --- a/.pipelines/cni/singletenancy/linux-cniv2-template.yaml +++ b/.pipelines/cni/singletenancy/linux-cniv2-template.yaml @@ -10,33 +10,73 @@ parameters: testDropgz: true osSKU: Ubuntu +# CNIv2 # + Should be able to scale up/down the pods successfully certain number of times. # + Node reboot scenarios should be covered. # + The CNS state should be validated with that of CNI state. # + Pods should have ips assigned and connectivity/datapath test should be present. # + CNS restart and validates the state +# Windows +# The HNS state should be validated with that of CNI state. +# + All CNI E2E is re-ran after HNS service is restarted +# If ensures that only linux template calls are compared against the below condition +# Condition confirms that: +# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success. +# CONTROL_OS either contains 'linux' or 'all' and CONTROL_CNI either contains 'cniv1' or 'all'. Both must be true and are not case sensitive stages: - - stage: create_${{ parameters.name }} - variables: - commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] - pool: - name: $(BUILD_POOL_NAME_DEFAULT) - dependsOn: - - setup - displayName: "Create Cluster - ${{ parameters.clusterName }}" - jobs: - - job: create_aks_cluster_with_${{ parameters.name }} - steps: - - template: ../load-test-templates/create-cluster-template.yaml - parameters: - clusterType: ${{ parameters.clusterType }} - clusterName: ${{ parameters.clusterName }}-$(commitID) - nodeCount: ${{ parameters.nodeCount }} - vmSize: ${{ parameters.vmSize }} - region: $(LOCATION) - osSKU: ${{ parameters.osSKU }} + - ${{ if eq(parameters.os, 'linux') }}: + - stage: create_${{ parameters.name }} + condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv2'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'linux'), contains(variables.CONTROL_OS, 'all') ) ) ) + variables: + commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] + pool: + name: $(BUILD_POOL_NAME_DEFAULT) + dependsOn: + - setup + displayName: "Create Cluster - ${{ parameters.clusterName }}" + jobs: + - job: create_aks_cluster_with_${{ parameters.name }} + steps: + - template: ../load-test-templates/create-cluster-template.yaml + parameters: + clusterType: ${{ parameters.clusterType }} + clusterName: ${{ parameters.clusterName }}-$(commitID) + nodeCount: ${{ parameters.nodeCount }} + vmSize: ${{ parameters.vmSize }} + region: $(LOCATION) + osSKU: ${{ parameters.osSKU }} + +# If ensures that only windows template calls are compared against the below condition +# Condition confirms that: +# Previous job has reported Succeeded. Previous job is currently setup which controls variable assignment and we are dependent on its success. +# CONTROL_OS either contains 'windows' or 'all' and CONTROL_CNI either contains 'cniv2' or 'all'. Both must be true and are not case sensitive + - ${{ if eq(parameters.os, 'windows') }}: + - stage: create_${{ parameters.name }} + condition: and( succeeded(), and( or( contains(variables.CONTROL_CNI, 'cniv2'), contains(variables.CONTROL_CNI, 'all') ), or( contains(variables.CONTROL_OS, 'windows'), contains(variables.CONTROL_OS, 'all') ) ) ) + variables: + commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] + pool: + name: $(BUILD_POOL_NAME_DEFAULT) + dependsOn: + - setup + displayName: "Create Cluster - ${{ parameters.clusterName }}" + jobs: + - job: create_aks_cluster_with_${{ parameters.name }} + steps: + - template: ../load-test-templates/create-cluster-template.yaml + parameters: + clusterType: ${{ parameters.clusterType }} + clusterName: ${{ parameters.clusterName }}-$(commitID) + nodeCount: ${{ parameters.nodeCount }} + vmSize: ${{ parameters.vmSize }} + region: $(LOCATION) + osSKU: ${{ parameters.osSKU }} +# Conditions for below E2E test scenarios confirm that: +# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: +# CONTROL_SCENARIO either contains 'all' or its respective scenario 'npm', 'scaleTest', 'restartNode', 'restartCNS'. It is not case sensitive +# Ex. CONTROL_SCENARIO = "restartnode SCALETEST" will only run Scale Test and Restart Test. - stage: ${{ parameters.name }} variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] @@ -93,6 +133,7 @@ stages: dependsOn: integration continueOnError: true - job: deploy_pods + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Scale Test" dependsOn: npm_k8se2e steps: @@ -110,6 +151,7 @@ stages: os: ${{ parameters.os }} cni: cniv2 - job: restart_nodes + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartNode') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart Test" dependsOn: deploy_pods steps: @@ -127,6 +169,7 @@ stages: cni: cniv2 restartCase: "true" - job: restart_cns + condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'restartCNS') , contains(variables.CONTROL_SCENARIO, 'all') ) ) displayName: "Restart and Validate CNS" dependsOn: restart_nodes steps: diff --git a/.pipelines/npm/npm-cni-integration-test.yaml b/.pipelines/npm/npm-cni-integration-test.yaml index 6aa49f92a3..b9449101d1 100644 --- a/.pipelines/npm/npm-cni-integration-test.yaml +++ b/.pipelines/npm/npm-cni-integration-test.yaml @@ -7,11 +7,15 @@ parameters: tag: "" continueOnError: false +# Condition confirms that: +# Pipeline has not been canceled and that the previous job has reports anything other than failure(Succeeded, SuccededWithIssues, Skipped). Previous job is declared by dependsOn: ${{ parameters.dependsOn }} +# Cluster is either Windows2022 or Linux +# CONTROL_SCENARIO either contains 'npm' or 'all'. It is not case sensitive jobs: - job: npm_k8se2e displayName: "NPM k8s E2E" dependsOn: ${{ parameters.dependsOn }} - condition: and(succeeded(), ${{ or(contains(parameters.os_version, '2022'), eq(parameters.os, 'linux')) }} ) + condition: and( and( not(canceled()), not(failed()) ), ${{ or(contains(parameters.os_version, '2022'), eq(parameters.os, 'linux') ) }} , or( contains(variables.CONTROL_SCENARIO, 'npm') , contains(variables.CONTROL_SCENARIO, 'all') ) ) pool: name: $(BUILD_POOL_NAME_DEFAULT) demands: