Skip to content

Commit

Permalink
pipeline testing for azure-ipam/cni-dropgz submodules (#1636)
Browse files Browse the repository at this point in the history
* add new ipam/dropgz e2e test stage

* set test image

* set paths in pipeline.yaml

* set path trigger in ipam-dropgz-job template

* set path as param for ipam-dropgze2e

* testing path trigger with branch

* create submodule pipeline

* add log in /azure-ipam to test piepline trigger

* remove build for cni-dropgz image in submodule pipeline

* create separate swift + cilium ipam/dropgz test stages

* remove commented test bits

* remove commented lines from setup_test.go

* update paths/triggers and set template parameters

* change cleanup dependsOn

* test parameter call

* export parameter

* skip setting testDropgz instead of setting false

* removing ipam-dropgz templates and focus submod UT on azure-ipam

* remove parsing gatewayIP from azure-ipam unit tests

* update make target test-azure-ipam

* update make target

* only publish test results

* omit npm build

* keep npm build and simplify unit testing stage

* adjust cluster naming to avoid resource overlap in pipelines
  • Loading branch information
camrynl authored Oct 17, 2022
1 parent 48e5238 commit 96c113a
Show file tree
Hide file tree
Showing 11 changed files with 322 additions and 24 deletions.
7 changes: 6 additions & 1 deletion .pipelines/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,22 @@ stages:
parameters:
name: $(name)
platforms: $(platforms)

- template: singletenancy/cilium/cilium-e2e-job-template.yaml
parameters:
name: "cilium_e2e"
displayName: Cilium
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: ""
clusterName: "ciliume2e"

- template: singletenancy/aks-swift/e2e-job-template.yaml
parameters:
name: "aks_swift_e2e"
displayName: AKS Swift
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: ""
clusterName: "swifte2e"

- template: singletenancy/aks-engine/e2e-job-template.yaml
parameters:
Expand Down Expand Up @@ -331,6 +335,7 @@ stages:
displayName: Cleanup
dependsOn:
- "aks_swift_e2e"
- "cilium_e2e"
- "ubuntu_18_04_linux_e2e"
- "windows_19_03_e2e"
- "windows_20_04_e2e"
Expand Down
4 changes: 4 additions & 0 deletions .pipelines/singletenancy/aks-swift/e2e-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ parameters:
name: ""
displayName: ""
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: ""
clusterName: ""

stages:
- stage: ${{ parameters.name }}
Expand All @@ -26,3 +28,5 @@ stages:
- template: e2e-step-template.yaml
parameters:
name: ${{ parameters.name }}
testDropgz: ${{ parameters.testDropgz }}
clusterName: ${{ parameters.clusterName }}
6 changes: 4 additions & 2 deletions .pipelines/singletenancy/aks-swift/e2e-step-template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
parameters:
name: ""
testDropgz: ""
clusterName: ""

steps:
- bash: |
Expand Down Expand Up @@ -30,7 +32,7 @@ steps:
mkdir -p ~/.kube/
echo "Create AKS cluster"
make -C ./hack/swift azcfg AZCLI=az
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=swifte2e-$(make revision)
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
echo "Cluster successfully created"
displayName: Create test cluster
condition: succeeded()
Expand All @@ -57,7 +59,7 @@ steps:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl cluster-info
kubectl get po -owide -A
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(make cni-dropgz-version) INSTALL_CNS=true INSTALL_AZURE_VNET=true
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(make cni-dropgz-version) INSTALL_CNS=true INSTALL_AZURE_VNET=true TEST_DROPGZ=${{ parameters.testDropgz }}
retryCountOnTaskFailure: 3
name: "aksswifte2e"
displayName: "Run AKS Swift E2E"
Expand Down
4 changes: 4 additions & 0 deletions .pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ parameters:
name: ""
displayName: ""
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: ""
clusterName: ""

stages:
- stage: ${{ parameters.name }}
Expand All @@ -26,3 +28,5 @@ stages:
- template: cilium-e2e-step-template.yaml
parameters:
name: ${{ parameters.name }}
testDropgz: ${{ parameters.testDropgz }}
clusterName: ${{ parameters.clusterName }}
6 changes: 4 additions & 2 deletions .pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
parameters:
name: ""
testDropgz: ""
clusterName: ""

steps:
- bash: |
Expand Down Expand Up @@ -30,7 +32,7 @@ steps:
mkdir -p ~/.kube/
echo "Create AKS cluster"
make -C ./hack/swift azcfg AZCLI=az
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=ciliume2e-$(make revision)
make -C ./hack/swift byocni-up SUB=$(SUB_AZURE_NETWORK_AGENT_TEST) AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(make revision)
echo "Cluster successfully created"
displayName: Create test cluster
condition: succeeded()
Expand Down Expand Up @@ -84,7 +86,7 @@ steps:
- script: |
echo "Start Azilium E2E Tests"
kubectl get po -owide -A
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(make cni-dropgz-version) INSTALL_CNS=true INSTALL_AZILIUM=true
sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(make cni-dropgz-version) INSTALL_CNS=true INSTALL_AZILIUM=true TEST_DROPGZ=${{ parameters.testDropgz }}
retryCountOnTaskFailure: 3
name: "aziliumTest"
displayName: "Run Azilium E2E"
Expand Down
279 changes: 279 additions & 0 deletions .pipelines/submodules-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
pr:
branches:
include:
- master
paths:
include:
- "zapai/*"
- "azure-ipam/*"
- "dropgz/*"
exclude:
- "*"

trigger:
paths:
include:
- "zapai/*"
- "azure-ipam/*"
- "dropgz/*"
exclude:
- "*"
tags:
include:
- "zapai/*"
- "azure-ipam/*"
- "dropgz/*"
exclude:
- "*"

stages:
- stage: setup
displayName: ACN
jobs:
- job: env
displayName: Setup
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
BUILD_NUMBER=$(Build.BuildNumber)
echo "##vso[task.setvariable variable=StorageID;isOutput=true]$(echo ${BUILD_NUMBER//./-})"
echo "##vso[task.setvariable variable=Tag;isOutput=true]$(make version)"
echo "##vso[task.setvariable variable=cniVersion;isOutput=true]$(make cni-version)"
echo "##vso[task.setvariable variable=npmVersion;isOutput=true]$(make npm-version)"
cat /etc/os-release
uname -a
sudo chown -R $(whoami):$(whoami) .
go version
go env
which go
echo $PATH
name: "EnvironmentalVariables"
displayName: "Set environmental variables"
condition: always()
- stage: test
displayName: Test ACN
dependsOn:
- setup
jobs:
- job: test
displayName: Run Tests
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
make tools
sudo -E env "PATH=$PATH" make test-azure-ipam;
retryCountOnTaskFailure: 3
name: "Test"
displayName: "Run Tests"
- stage: binaries
displayName: Build Binaries
dependsOn:
- setup
- test
jobs:
- job: build
displayName: Build Binaries
variables:
STORAGE_ID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.StorageID'] ]
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
make all-binaries-platforms
name: "BuildAllPlatformBinaries"
displayName: "Build all platform binaries"
- script: |
mkdir -p ./output/bins
cd ./output
find . -name '*.tgz' -print -exec mv -t ./bins/ {} +
find . -name '*.zip' -print -exec mv -t ./bins/ {} +
shopt -s extglob
rm -rf !("bins")
name: "PrepareArtifacts"
displayName: "Prepare Artifacts"
- task: CopyFiles@2
inputs:
sourceFolder: "output"
targetFolder: $(Build.ArtifactStagingDirectory)
condition: succeeded()

- task: PublishBuildArtifacts@1
inputs:
artifactName: "output"
pathtoPublish: "$(Build.ArtifactStagingDirectory)"
condition: succeeded()

- task: AzureCLI@1
inputs:
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
inlineScript: |
echo Creating storage container with name acn-$(STORAGE_ID) and account name $(STORAGE_ACCOUNT_NAME)
az storage container create -n acn-$(STORAGE_ID) --account-name $(STORAGE_ACCOUNT_NAME) --public-access container
az storage blob upload-batch -d acn-$(STORAGE_ID) -s ./output/bins/ --account-name $(STORAGE_ACCOUNT_NAME)
displayName: Create artifact storage container
condition: succeeded()

- publish: ./test/apimodels/
artifact: clusterdefinitions

- stage: containerize
displayName: Build Images
dependsOn:
- setup
- test
jobs:
- job: containerize_linux_amd64
displayName: Build Images
pool:
name: "$(BUILD_POOL_NAME_LINUX_AMD64)"
strategy:
matrix:
acncli_linux_amd64:
arch: amd64
os: linux
name: acncli
cni_dropgz_test_linux_amd64:
arch: amd64
os: linux
name: cni-dropgz-test
cns_linux_amd64:
arch: amd64
os: linux
name: cns
npm_linux_amd64:
arch: amd64
os: linux
name: npm
steps:
- template: containers/container-template.yaml
parameters:
name: $(name)
os: $(os)
arch: $(arch)
- job: containerize_linux_arm64
displayName: Build Images
variables:
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
pool:
name: "$(BUILD_POOL_NAME_LINUX_ARM64)"
strategy:
matrix:
acncli_linux_arm64:
arch: arm64
os: linux
name: acncli
cni_dropgz_test_linux_arm64:
arch: arm64
os: linux
name: cni-dropgz-test
cns_linux_arm64:
arch: arm64
os: linux
name: cns
npm_linux_arm64:
arch: arm64
os: linux
name: npm
steps:
- template: containers/container-template.yaml
parameters:
name: $(name)
os: $(os)
arch: $(arch)
- job: containerize_windows_amd64
timeoutInMinutes: 120
displayName: Build Images
variables:
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
pool:
name: "$(BUILD_POOL_NAME_WINDOWS_AMD64)"
strategy:
matrix:
cns_windows_amd64:
arch: amd64
name: cns
npm_windows_amd64:
arch: amd64
name: npm
steps:
- template: containers/container-template-windows.yaml
parameters:
name: $(name)
arch: $(arch)
tag: $(TAG)

- stage: publish
displayName: Publish Multiarch Manifests
dependsOn:
- containerize
jobs:
- job: manifest
displayName: Compile Manifests
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
strategy:
matrix:
acncli:
name: acncli
platforms: linux/amd64 linux/arm64
cni_dropgz_test:
name: cni-dropgz-test
platforms: linux/amd64 linux/arm64
cns:
name: cns
platforms: linux/amd64 linux/arm64 windows/amd64
npm:
name: npm
platforms: linux/amd64 linux/arm64 windows/amd64
steps:
- template: containers/manifest-template.yaml
parameters:
name: $(name)
platforms: $(platforms)

- template: singletenancy/cilium/cilium-e2e-job-template.yaml
parameters:
name: "cilium_e2e"
displayName: Cilium
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: true
clusterName: "submodules-ciliume2e"

- template: singletenancy/aks-swift/e2e-job-template.yaml
parameters:
name: "aks_swift_e2e"
displayName: AKS Swift
pipelineBuildImage: "$(BUILD_IMAGE)"
testDropgz: true
clusterName: "submodules-swifte2e"

- stage: cleanup
displayName: Cleanup
dependsOn:
- cilium_e2e
- aks_swift_e2e
jobs:
- job: delete_remote_artifacts
displayName: Delete remote artifacts
pool:
name: $(BUILD_POOL_NAME_DEFAULT)
demands: agent.os -equals Linux
steps:
- checkout: none
- task: AzureCLI@1
inputs:
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
inlineScript: |
BUILD_NUMBER=$(Build.BuildNumber)
BUILD_NUMBER=${BUILD_NUMBER//./-}
echo Deleting storage container with name acn-$BUILD_NUMBER and account name $(STORAGE_ACCOUNT_NAME)
az storage container delete -n acn-$BUILD_NUMBER --account-name $(STORAGE_ACCOUNT_NAME)
displayName: Cleanup remote Azure storage container
Loading

0 comments on commit 96c113a

Please sign in to comment.