Skip to content

Commit d0a9343

Browse files
authored
Persist cluster configs in AZP (#426)
* update cluster configs for more version testing
1 parent ea079b0 commit d0a9343

File tree

11 files changed

+266
-157
lines changed

11 files changed

+266
-157
lines changed

.pipelines/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM ubuntu:16.04
2-
RUN apt-get update && apt-get install -y software-properties-common sudo wget apt-transport-https curl lsb-release gnupg
2+
RUN apt-get update && apt-get install -y software-properties-common sudo wget apt-transport-https curl lsb-release gnupg jq
33
RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
44
RUN sudo dpkg -i packages-microsoft-prod.deb
55
RUN add-apt-repository ppa:longsleep/golang-backports

.pipelines/e2e-job-template.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
name: ""
33
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.4"
4-
clusterDefinitionUrl: "https://raw.githubusercontent.com/Azure/azure-container-networking/master/test/e2e/kubernetes/cniLinux.json"
4+
clusterDefinition: ""
55
clusterDefinitionCniTypeKey: ""
66
clusterDefinitionCniBuildOS: ""
77
clusterDefinitionCniBuildExt: ""
@@ -18,13 +18,15 @@ jobs:
1818
GOPATH: "$(System.DefaultWorkingDirectory)/gopath"
1919
GOBIN: "$(GOPATH)/bin" # Go binaries path
2020
modulePath: "$(GOPATH)/src/github.com/Azure/aks-engine"
21+
acnPath: "$(GOPATH)/src/github.com/Azure/azure-container-networking"
2122
Tag: $[ dependencies.unit_tests.outputs['EnvironmentalVariables.Tag'] ]
2223
CommitHash: $[ dependencies.unit_tests.outputs['EnvironmentalVariables.CommitHash'] ]
2324

2425
steps:
2526
- template: e2e-step-template.yaml
2627
parameters:
27-
clusterDefinitionUrl: ${{ parameters.clusterDefinitionUrl }}
28+
name: ${{ parameters.name }}
29+
clusterDefinition: ${{ parameters.clusterDefinition }}
2830
clusterDefinitionCniTypeKey: ${{ parameters.clusterDefinitionCniTypeKey }}
2931
clusterDefinitionCniBuildOS: ${{ parameters.clusterDefinitionCniBuildOS }}
3032
clusterDefinitionCniBuildExt: ${{ parameters.clusterDefinitionCniBuildExt }}

.pipelines/e2e-step-template.yaml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22
name: ""
3-
clusterDefinitionUrl: ""
3+
clusterDefinition: ""
44
clusterDefinitionCniTypeKey: ""
55
clusterDefinitionCniBuildOS: ""
66
clusterDefinitionCniBuildExt: ""
@@ -19,16 +19,24 @@ steps:
1919
name: "GoEnv"
2020
displayName: "Set up the Go environment"
2121
22+
- task: DownloadPipelineArtifact@2
23+
inputs:
24+
buildType: current
25+
artifactName: clusterdefinitions
26+
targetPath: "$(modulePath)"
27+
#buildType: 'current' # Options: current, specific
28+
#project: # Required when buildType == Specific
29+
2230
- bash: |
23-
rm -f clusterDefinition.json*
24-
wget '${{ parameters.clusterDefinitionUrl }}' -O clusterDefinition.json
31+
ls -lah
2532
export CNI_URL='"'https://$(ARTIFACT_STORAGE).blob.core.windows.net/acn-$(CommitHash)/azure-vnet-cni-${{ parameters.clusterDefinitionCniBuildOS }}-amd64-$(Tag)${{ parameters.clusterDefinitionCniBuildExt }}'"'
2633
export CNI_TYPE=${{ parameters.clusterDefinitionCniTypeKey }}
2734
echo CNI type is $CNI_TYPE
28-
sed -i "s|\"$CNI_TYPE\":\".*\"|\"$CNI_TYPE\":$CNI_URL|g" clusterDefinition.json
29-
sed -i "s|\"azureCNIVersion\":\".*\"|\"azureCNIVersion\":\"$(Tag)\"|g" clusterDefinition.json
35+
sed -i "s|\"$CNI_TYPE\":\".*\"|\"$CNI_TYPE\":$CNI_URL|g" '${{ parameters.clusterDefinition }}'
36+
sed -i "s|\"azureCNIVersion\":\".*\"|\"azureCNIVersion\":\"$(Tag)\"|g" '${{ parameters.clusterDefinition }}'
3037
echo "Running E2E tests against a cluster built with the following API model:"
31-
cat ./clusterDefinition.json
38+
cat '${{ parameters.clusterDefinition }}'
39+
cp ${{ parameters.clusterDefinition }} clusterDefinition.json
3240
curl -L https://dl.k8s.io/v1.16.0/kubernetes-client-linux-amd64.tar.gz | tar xvzf -
3341
sudo cp kubernetes/client/bin/kubectl /usr/local/bin/kubectl
3442
sudo cp kubernetes/client/bin/kubectl /usr/local/bin/k
@@ -38,7 +46,7 @@ steps:
3846
workingDirectory: "$(modulePath)"
3947
4048
- bash: |
41-
export CLUSTER_DEFINITION=./clusterDefinition.json
49+
export CLUSTER_DEFINITION=./'${{ parameters.clusterDefinition }}'
4250
export ORCHESTRATOR=kubernetes
4351
export CREATE_VNET=false
4452
export TIMEOUT=10m
@@ -50,6 +58,16 @@ steps:
5058
export REGIONS=$(AKS_ENGINE_REGION)
5159
export IS_JENKINS=false
5260
make test-kubernetes
61+
mkdir -p $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
62+
cp -r _output/k*/kubeconfig/kubeconfig.$REGIONS.json $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
63+
cp -r _output/kubernetes-*-ssh $(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}
5364
name: DeployAKSEngine
5465
displayName: Deploy AKS-Engine
5566
workingDirectory: "$(modulePath)"
67+
68+
- task: PublishBuildArtifacts@1
69+
inputs:
70+
artifactName: "kube-${{ parameters.name }}"
71+
pathtoPublish: "$(Build.ArtifactStagingDirectory)/kube-${{ parameters.name }}"
72+
displayName: "Save cluster configs"
73+
condition: always()

.pipelines/pipeline.yaml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ stages:
8080
displayName: "Install Go dependencies"
8181
8282
- script: |
83+
echo Building in $(pwd)
8384
echo Build tag is $(EnvironmentalVariables.Tag)
8485
export GOOS=linux
8586
make all-binaries VERSION=$(EnvironmentalVariables.Tag)
@@ -103,14 +104,15 @@ stages:
103104
} | { read xs; exit $xs; }
104105
} 4>&1
105106
workingDirectory: "$(modulePath)"
106-
failOnStderr: true
107107
name: "Test"
108108
displayName: "Run Tests"
109109
110110
- bash: |
111111
bash <(curl -s https://codecov.io/bash)
112112
gocov convert coverage.out > coverage.json
113113
gocov-xml < coverage.json > coverage.xml
114+
echo listing cluster definitions
115+
ls $(modulePath)/test/e2e/kubernetes/*
114116
workingDirectory: "$(modulePath)"
115117
name: "Coverage"
116118
displayName: "Generate Coverage Reports"
@@ -140,6 +142,9 @@ stages:
140142
pathtoPublish: "$(Build.ArtifactStagingDirectory)"
141143
condition: succeeded()
142144

145+
- publish: $(modulePath)/test/e2e/kubernetes/
146+
artifact: clusterdefinitions
147+
143148
- task: AzureCLI@1
144149
inputs:
145150
azureSubscription: $(ARTIFACT_SUBSCRIPTION)
@@ -153,22 +158,41 @@ stages:
153158
- template: e2e-job-template.yaml
154159
parameters:
155160
name: "ubuntu_16_04_linux_e2e"
156-
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.4"
157-
clusterDefinitionUrl: "https://raw.githubusercontent.com/Azure/azure-container-networking/master/test/e2e/kubernetes/cniLinux.json"
161+
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.5"
162+
clusterDefinition: "cniLinux1604.json"
163+
clusterDefinitionCniTypeKey: "azureCNIURLLinux"
164+
clusterDefinitionCniBuildOS: "linux"
165+
clusterDefinitionCniBuildExt: ".tgz"
166+
167+
- template: e2e-job-template.yaml
168+
parameters:
169+
name: "ubuntu_18_04_linux_e2e"
170+
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.5"
171+
clusterDefinition: "cniLinux1804.json"
158172
clusterDefinitionCniTypeKey: "azureCNIURLLinux"
159173
clusterDefinitionCniBuildOS: "linux"
160174
clusterDefinitionCniBuildExt: ".tgz"
161175

162176
- template: e2e-job-template.yaml
163177
parameters:
164-
name: "windows_e2e"
165-
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.4"
166-
clusterDefinitionUrl: "https://raw.githubusercontent.com/Azure/azure-container-networking/master/test/e2e/kubernetes/cniWindows.json"
178+
name: "windows_18_09_e2e"
179+
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.5"
180+
clusterDefinition: "cniWindows1809.json"
181+
clusterDefinitionCniTypeKey: "azureCNIURLWindows"
182+
clusterDefinitionCniBuildOS: "windows"
183+
clusterDefinitionCniBuildExt: ".zip"
184+
185+
- template: e2e-job-template.yaml
186+
parameters:
187+
name: "windows_19_03_e2e"
188+
pipelineBuildImage: "containernetworking/pipeline-ci:1.0.5"
189+
clusterDefinition: "cniWindows1903.json"
167190
clusterDefinitionCniTypeKey: "azureCNIURLWindows"
168191
clusterDefinitionCniBuildOS: "windows"
169192
clusterDefinitionCniBuildExt: ".zip"
170193

171194
- stage: cleanup
195+
condition: always()
172196
jobs:
173197
- job: delete_remote_artifacts
174198
pool:
@@ -178,7 +202,7 @@ stages:
178202
image: containernetworking/pipeline-ci:1.0.4
179203
variables:
180204
Tag: $[ dependencies.unit_tests.outputs['EnvironmentalVariables.Tag'] ]
181-
205+
condition: always()
182206
steps:
183207
- checkout: none
184208
- task: AzureCLI@1
@@ -190,3 +214,4 @@ stages:
190214
az storage container delete -n acn-$CommitHash --account-name $(STORAGE_ACCOUNT_NAME)
191215
workingDirectory: "$(modulePath)"
192216
displayName: Cleanup remote Azure storage container
217+
condition: always()

test/e2e/kubernetes/cniLinux.json

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"apiVersion": "vlabs",
3+
"properties": {
4+
"orchestratorProfile": {
5+
"orchestratorType": "Kubernetes",
6+
"orchestratorRelease": "1.14",
7+
"kubernetesConfig": {
8+
"networkPlugin": "azure",
9+
"networkPolicy": "azure",
10+
"azureCNIVersion": "",
11+
"azureCNIURLLinux": ""
12+
}
13+
},
14+
"masterProfile": {
15+
"count": 1,
16+
"dnsPrefix": "cniLinux",
17+
"vmSize": "Standard_D2_v2"
18+
},
19+
"agentPoolProfiles": [
20+
{
21+
"name": "agentpool1",
22+
"count": 3,
23+
"vmSize": "Standard_D2_v2",
24+
"availabilityProfile": "AvailabilitySet",
25+
"osType": "Linux",
26+
"distro": "aks-ubuntu-16.04"
27+
}
28+
],
29+
"linuxProfile": {
30+
"adminUsername": "azureuser",
31+
"ssh": {
32+
"publicKeys": [
33+
{
34+
"keyData": ""
35+
}
36+
]
37+
}
38+
},
39+
"servicePrincipalProfile": {
40+
"clientId": "",
41+
"secret": ""
42+
}
43+
}
44+
}

test/e2e/kubernetes/cniLinux18.json

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"apiVersion": "vlabs",
3+
"properties": {
4+
"orchestratorProfile": {
5+
"orchestratorType": "Kubernetes",
6+
"orchestratorRelease": "1.14",
7+
"kubernetesConfig": {
8+
"networkPlugin": "azure",
9+
"networkPolicy": "azure",
10+
"azureCNIVersion": "",
11+
"azureCNIURLLinux": ""
12+
}
13+
},
14+
"masterProfile": {
15+
"count": 1,
16+
"dnsPrefix": "cniLinux",
17+
"vmSize": "Standard_D2_v2"
18+
},
19+
"agentPoolProfiles": [
20+
{
21+
"name": "agentpool1",
22+
"count": 3,
23+
"vmSize": "Standard_D2_v2",
24+
"availabilityProfile": "AvailabilitySet",
25+
"osType": "Linux",
26+
"distro": "aks-ubuntu-18.04"
27+
}
28+
],
29+
"linuxProfile": {
30+
"adminUsername": "azureuser",
31+
"ssh": {
32+
"publicKeys": [
33+
{
34+
"keyData": ""
35+
}
36+
]
37+
}
38+
},
39+
"servicePrincipalProfile": {
40+
"clientId": "",
41+
"secret": ""
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)