Skip to content

Commit 585ef7a

Browse files
authored
ci: [1/?] Automated version update pipeline (#3667)
* test: view variable group * ci: all k8s version * chore: cleanup debug output
1 parent 6292cc7 commit 585ef7a

File tree

3 files changed

+200
-0
lines changed

3 files changed

+200
-0
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
pr: none
2+
trigger: none
3+
4+
variables:
5+
- group: ACN-CNI-Pipeline
6+
7+
parameters:
8+
- name: versions
9+
displayName: K8s Versions
10+
type: object
11+
default:
12+
- ver: '27'
13+
LTS: true
14+
- ver: '28'
15+
LTS: true
16+
- ver: '29'
17+
LTS: true
18+
- ver: '30'
19+
LTS: false
20+
- ver: '31'
21+
LTS: false
22+
- ver: '32'
23+
LTS: false
24+
# - ver: '33'
25+
# LTS: 'false'
26+
27+
stages:
28+
- stage: setup
29+
displayName: Variable Group Init
30+
jobs:
31+
- job: env
32+
displayName: Setup
33+
pool:
34+
name: "$(BUILD_POOL_NAME_DEFAULT)"
35+
steps:
36+
- script: |
37+
# To use the variables below, you must make the respective stage's dependsOn have - setup or it will not retain context of this stage
38+
39+
echo "##vso[task.setvariable variable=commitID;isOutput=true]$(echo $(make revision)-$(date "+%d%H%M"))"
40+
name: "EnvironmentalVariables"
41+
displayName: "Set environmental variables"
42+
condition: always()
43+
- job: vgroup
44+
displayName: View Variable Group
45+
pool:
46+
name: "$(BUILD_POOL_NAME_DEFAULT)"
47+
steps:
48+
- task: AzureCLI@2
49+
inputs:
50+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
51+
scriptLocation: "inlineScript"
52+
scriptType: "bash"
53+
addSpnToEnvironment: true
54+
inlineScript: |
55+
az pipelines variable-group show --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --debug
56+
57+
displayName: "Configure Defaults and List"
58+
condition: always()
59+
env:
60+
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
61+
62+
- bash: |
63+
az pipelines variable-group variable update --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --name CILIUM_IMAGE_REGISTRY --value "Changed it was"
64+
displayName: "Change Variable"
65+
env:
66+
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
67+
68+
- bash: |
69+
az pipelines variable-group show --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --debug
70+
displayName: "List Variable Group"
71+
env:
72+
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
73+
74+
75+
- stage: cluster
76+
displayName: "Cluster Create"
77+
dependsOn:
78+
- setup
79+
variables:
80+
commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ]
81+
jobs:
82+
- ${{ each version in parameters.versions }}:
83+
- job: cluster${{ version.ver }}
84+
displayName: 1.${{ version.ver }} Cluster Creation
85+
pool:
86+
name: "$(BUILD_POOL_NAME_DEFAULT)"
87+
strategy:
88+
matrix:
89+
cniv1:
90+
clusterType: cniv1-up
91+
clusterName: cniv1
92+
cilium:
93+
clusterType: overlay-cilium-up
94+
clusterName: cilium
95+
overlay:
96+
clusterType: overlay-up
97+
clusterName: overlay
98+
steps:
99+
- template: ../../templates/create-cluster-steps.yaml
100+
parameters:
101+
clusterType: $(clusterType)
102+
clusterName: $(clusterName)-${{ version.ver }}-$(commitID)
103+
k8sVersion: 1.${{ version.ver }}
104+
vmSize: Standard_B2ms
105+
vmSizeWin: Standard_B2ms
106+
os: windows
107+
region: $(REGION_AKS_CLUSTER_TEST)
108+
LTS: ${{ version.LTS }}
109+
110+
111+
- stage: clusterDelete
112+
displayName: "Cluster Delete"
113+
condition: always()
114+
dependsOn:
115+
- setup
116+
- cluster
117+
variables:
118+
commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ]
119+
jobs:
120+
- ${{ each version in parameters.versions }}:
121+
- job: cluster${{ version.ver }}
122+
displayName: 1.${{ version.ver }} Cluster Delete
123+
pool:
124+
name: "$(BUILD_POOL_NAME_DEFAULT)"
125+
strategy:
126+
matrix:
127+
cniv1:
128+
clusterName: cniv1
129+
cilium:
130+
clusterName: cilium
131+
overlay:
132+
clusterName: overlay
133+
steps:
134+
- template: ../../templates/delete-cluster.yaml
135+
parameters:
136+
name: $(clusterName)-${{ version.ver }}-$(commitID)
137+
clusterName: $(clusterName)-${{ version.ver }}-$(commitID)
138+
region: $(REGION_AKS_CLUSTER_TEST)
139+
sub: $(SUB_AZURE_NETWORK_AGENT_BUILD_VALIDATIONS)
140+
svcConn: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
141+
142+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
parameters:
2+
name: ""
3+
displayName: ""
4+
clusterType: ""
5+
clusterName: "" # Recommended to pass in unique identifier
6+
vmSize: ""
7+
vmSizeWin: ""
8+
k8sVersion: ""
9+
osSkuWin: "Windows2022" # Currently we only support Windows2022
10+
dependsOn: ""
11+
region: ""
12+
os: linux
13+
14+
15+
steps:
16+
- task: AzureCLI@2
17+
inputs:
18+
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
19+
scriptLocation: "inlineScript"
20+
scriptType: "bash"
21+
addSpnToEnvironment: true
22+
inlineScript: |
23+
set -e
24+
echo "Check az version"
25+
az version
26+
if ${{ lower(contains(parameters.clusterType, 'dualstack')) }}
27+
then
28+
echo "Install az cli extension preview"
29+
az extension add --name aks-preview
30+
az extension update --name aks-preview
31+
fi
32+
33+
if ! [ -z ${{ parameters.k8sVersion }} ]; then
34+
echo "Set K8S_VER with ${{ parameters.k8sVersion }}"
35+
export K8S_VER=${{ parameters.k8sVersion }}
36+
fi
37+
38+
if ! [ -z ${K8S_VERSION} ]; then
39+
echo "Default k8s version, $(make -C ./hack/aks vars | grep K8S | cut -d'=' -f 2), is manually set to ${K8S_VERSION}"
40+
export K8S_VER=${K8S_VERSION}
41+
fi
42+
43+
mkdir -p ~/.kube/
44+
make -C ./hack/aks azcfg AZCLI=az REGION=${{ parameters.region }}
45+
46+
make -C ./hack/aks ${{ parameters.clusterType }} \
47+
AZCLI=az REGION=${{ parameters.region }} SUB=$(SUB_AZURE_NETWORK_AGENT_BUILD_VALIDATIONS) \
48+
CLUSTER=${{ parameters.clusterName }} \
49+
VM_SIZE=${{ parameters.vmSize }} VM_SIZE_WIN=${{ parameters.vmSizeWin }} \
50+
OS_SKU_WIN=${{ parameters.osSkuWin }} OS=${{ parameters.os }} \
51+
LTS=${{ lower(parameters.LTS) }}
52+
53+
echo "Cluster successfully created"
54+
displayName: Cluster - ${{ parameters.clusterType }}
55+
continueOnError: ${{ contains(parameters.clusterType, 'dualstack') }}

hack/aks/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ overlay-up: rg-up ipv4 overlay-net-up ## Brings up an Overlay AzCNI cluster
219219
$(LTS_ARGS) \
220220
--yes
221221
@$(MAKE) set-kubeconf
222+
ifeq ($(OS),windows)
223+
$(MAKE) windows-nodepool-up
224+
endif
222225

223226
swift-byocni-up: rg-up ipv4 swift-net-up ## Bring up a SWIFT BYO CNI cluster
224227
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \

0 commit comments

Comments
 (0)