Skip to content

ci: [1/?] Automated version update pipeline #3667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions .pipelines/cni/ado-automation/var-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
pr: none
trigger: none

variables:
- group: ACN-CNI-Pipeline

parameters:
- name: versions
displayName: K8s Versions
type: object
default:
- ver: '27'
LTS: true
- ver: '28'
LTS: true
- ver: '29'
LTS: true
- ver: '30'
LTS: false
- ver: '31'
LTS: false
- ver: '32'
LTS: false
# - ver: '33'
# LTS: 'false'

stages:
- stage: setup
displayName: Variable Group Init
jobs:
- job: env
displayName: Setup
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- script: |
# To use the variables below, you must make the respective stage's dependsOn have - setup or it will not retain context of this stage

echo "##vso[task.setvariable variable=commitID;isOutput=true]$(echo $(make revision)-$(date "+%d%H%M"))"
name: "EnvironmentalVariables"
displayName: "Set environmental variables"
condition: always()
- job: vgroup
displayName: View Variable Group
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
steps:
- task: AzureCLI@2
inputs:
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
az pipelines variable-group show --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --debug

displayName: "Configure Defaults and List"
condition: always()
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

- bash: |
az pipelines variable-group variable update --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --name CILIUM_IMAGE_REGISTRY --value "Changed it was"
displayName: "Change Variable"
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

- bash: |
az pipelines variable-group show --id $(CNI_VAR_GROUP) --org $(System.TeamFoundationCollectionUri) --project $(System.TeamProject) --debug
displayName: "List Variable Group"
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)


- stage: cluster
displayName: "Cluster Create"
dependsOn:
- setup
variables:
commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ]
jobs:
- ${{ each version in parameters.versions }}:
- job: cluster${{ version.ver }}
displayName: 1.${{ version.ver }} Cluster Creation
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
strategy:
matrix:
cniv1:
clusterType: cniv1-up
clusterName: cniv1
cilium:
clusterType: overlay-cilium-up
clusterName: cilium
overlay:
clusterType: overlay-up
clusterName: overlay
steps:
- template: ../../templates/create-cluster-steps.yaml
parameters:
clusterType: $(clusterType)
clusterName: $(clusterName)-${{ version.ver }}-$(commitID)
k8sVersion: 1.${{ version.ver }}
vmSize: Standard_B2ms
vmSizeWin: Standard_B2ms
os: windows
region: $(REGION_AKS_CLUSTER_TEST)
LTS: ${{ version.LTS }}


- stage: clusterDelete
displayName: "Cluster Delete"
condition: always()
dependsOn:
- setup
- cluster
variables:
commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ]
jobs:
- ${{ each version in parameters.versions }}:
- job: cluster${{ version.ver }}
displayName: 1.${{ version.ver }} Cluster Delete
pool:
name: "$(BUILD_POOL_NAME_DEFAULT)"
strategy:
matrix:
cniv1:
clusterName: cniv1
cilium:
clusterName: cilium
overlay:
clusterName: overlay
steps:
- template: ../../templates/delete-cluster.yaml
parameters:
name: $(clusterName)-${{ version.ver }}-$(commitID)
clusterName: $(clusterName)-${{ version.ver }}-$(commitID)
region: $(REGION_AKS_CLUSTER_TEST)
sub: $(SUB_AZURE_NETWORK_AGENT_BUILD_VALIDATIONS)
svcConn: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)


55 changes: 55 additions & 0 deletions .pipelines/templates/create-cluster-steps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
parameters:
name: ""
displayName: ""
clusterType: ""
clusterName: "" # Recommended to pass in unique identifier
vmSize: ""
vmSizeWin: ""
k8sVersion: ""
osSkuWin: "Windows2022" # Currently we only support Windows2022
dependsOn: ""
region: ""
os: linux


steps:
- task: AzureCLI@2
inputs:
azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION)
scriptLocation: "inlineScript"
scriptType: "bash"
addSpnToEnvironment: true
inlineScript: |
set -e
echo "Check az version"
az version
if ${{ lower(contains(parameters.clusterType, 'dualstack')) }}
then
echo "Install az cli extension preview"
az extension add --name aks-preview
az extension update --name aks-preview
fi

if ! [ -z ${{ parameters.k8sVersion }} ]; then
echo "Set K8S_VER with ${{ parameters.k8sVersion }}"
export K8S_VER=${{ parameters.k8sVersion }}
fi

if ! [ -z ${K8S_VERSION} ]; then
echo "Default k8s version, $(make -C ./hack/aks vars | grep K8S | cut -d'=' -f 2), is manually set to ${K8S_VERSION}"
export K8S_VER=${K8S_VERSION}
fi

mkdir -p ~/.kube/
make -C ./hack/aks azcfg AZCLI=az REGION=${{ parameters.region }}

make -C ./hack/aks ${{ parameters.clusterType }} \
AZCLI=az REGION=${{ parameters.region }} SUB=$(SUB_AZURE_NETWORK_AGENT_BUILD_VALIDATIONS) \
CLUSTER=${{ parameters.clusterName }} \
VM_SIZE=${{ parameters.vmSize }} VM_SIZE_WIN=${{ parameters.vmSizeWin }} \
OS_SKU_WIN=${{ parameters.osSkuWin }} OS=${{ parameters.os }} \
LTS=${{ lower(parameters.LTS) }}

echo "Cluster successfully created"
displayName: Cluster - ${{ parameters.clusterType }}
continueOnError: ${{ contains(parameters.clusterType, 'dualstack') }}
3 changes: 3 additions & 0 deletions hack/aks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ overlay-up: rg-up ipv4 overlay-net-up ## Brings up an Overlay AzCNI cluster
$(LTS_ARGS) \
--yes
@$(MAKE) set-kubeconf
ifeq ($(OS),windows)
$(MAKE) windows-nodepool-up
endif

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