Skip to content

Commit

Permalink
chore: simplify used variable groups for windows (#3566)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjiezhang1997 authored Aug 29, 2023
1 parent 07215a3 commit 7a78eb1
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 125 deletions.
4 changes: 2 additions & 2 deletions .pipelines/.vsts-vhd-builder-release-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: $(Date:yyyyMMdd)$(Rev:.r)_$(Build.SourceBranchName)_$(BuildID)
trigger: none

pool:
name: $(POOL_NAME)
name: $(AZURE_POOL_NAME)

parameters:
- name: build2019containerd
Expand All @@ -26,7 +26,7 @@ parameters:
type: boolean
default: True

# Use variable group "ab-vhd-windows-prod" and link it to the pipeline "AKS Windows VHD Build"
# Use variable group "ab-windows-ame-tenant" and link it to the pipeline "AKS Windows VHD Build"

stages:
- stage: build_vhd_2019_containerd
Expand Down
6 changes: 3 additions & 3 deletions .pipelines/.vsts-vhd-builder-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: $(Date:yyyyMMdd)$(Rev:.r)_$(Build.SourceBranchName)_$(BuildID)
trigger: none

pool:
name: $(POOL_NAME)
name: $(AZURE_POOL_NAME)

parameters:
- name: build2019containerd
Expand All @@ -26,8 +26,8 @@ parameters:
type: boolean
default: False

# Use variable group "ab-vhd-windows-prod" and link it to the pipeline "AKS Windows VHD Build - PR check-in gate"
# Use variable group "ab-vhd-windows-test" and link it to the pipeline "[TEST All VHDs] AKS Windows VHD Build - Msft Tenant"
# Use variable group "ab-windows-ame-tenant" and link it to the pipeline "AKS Windows VHD Build - PR check-in gate"
# Use variable group "ab-windows-ms-tenant" and link it to the pipeline "[TEST All VHDs] AKS Windows VHD Build - Msft Tenant"

stages:
- stage: build_vhd_2019_containerd
Expand Down
3 changes: 1 addition & 2 deletions .pipelines/e2e-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pr:
- 'parts/windows/*'
- 'staging/cse/windows/*'

variables:
- group: ab-e2e-windows
# Use variable group "ab-windows-ms-tenant" and link it to the pipeline "Agentbaker Windows E2E"

pool:
# uncomment this if the auto teardown pool is down.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ steps:
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/AgentBaker \
-w /go/src/github.com/Azure/AgentBaker \
-e CLIENT_ID=${BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${BUILD_AZURE_RESOURCE_GROUP_NAME} \
-e CLIENT_ID=${AZURE_BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(AZURE_BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${AZURE_BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${AZURE_BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${AZURE_BUILD_RESOURCE_GROUP_NAME} \
-e MODE=$m \
-e DRY_RUN=${DRY_RUN} \
-e SIG_GALLERY_NAME=${SIG_GALLERY_NAME} \
-e BACKFILL_RESOURCE_DELETION=${BACKFILL_RESOURCE_DELETION} \
-e OS_TYPE="Windows" \
${CONTAINER_IMAGE} make -f packer.mk backfill-cleanup
${AZURE_CONTAINER_IMAGE} make -f packer.mk backfill-cleanup
displayName: Backfill Clean Up Older Resources
condition: always()
58 changes: 29 additions & 29 deletions .pipelines/templates/.builder-release-template-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ steps:
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/AgentBaker \
-w /go/src/github.com/Azure/AgentBaker \
-e POOL_NAME=$(POOL_NAME) \
-e CLIENT_ID=${BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${BUILD_AZURE_RESOURCE_GROUP_NAME} \
-e AZURE_LOCATION=${BUILD_AZURE_LOCATION} \
-e POOL_NAME=$(AZURE_POOL_NAME) \
-e CLIENT_ID=${AZURE_BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(AZURE_BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${AZURE_BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${AZURE_BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${AZURE_BUILD_RESOURCE_GROUP_NAME} \
-e AZURE_LOCATION=${AZURE_BUILD_LOCATION} \
-e AZURE_VM_SIZE=${AZURE_VM_SIZE} \
-e GIT_BRANCH=$(Build.SourceBranchName) \
-e GIT_REPO=$(Build.Repository.Uri) \
Expand All @@ -74,7 +74,7 @@ steps:
-e WINDOWS_NANO_IMAGE_URL=${WINDOWS_NANO_IMAGE_URL} \
-e WINDOWS_CORE_IMAGE_URL=${WINDOWS_CORE_IMAGE_URL} \
-e WINDOWS_PRIVATE_PACKAGES_URL=${WINDOWS_PRIVATE_PACKAGES_URL} \
${CONTAINER_IMAGE} make -f packer.mk run-packer-windows
${AZURE_CONTAINER_IMAGE} make -f packer.mk run-packer-windows
displayName: Building windows VHD
# Note: use -a to grep MANAGED_SIG_ID (packer-output should be read as a binary file in Linux)
Expand All @@ -85,14 +85,14 @@ steps:
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/AgentBaker \
-w /go/src/github.com/Azure/AgentBaker \
-e CLIENT_ID=${BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${BUILD_AZURE_RESOURCE_GROUP_NAME} \
-e CLIENT_ID=${AZURE_BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(AZURE_BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${AZURE_BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${AZURE_BUILD_SUBSCRIPTION_ID}" \
-e AZURE_RESOURCE_GROUP_NAME=${AZURE_BUILD_RESOURCE_GROUP_NAME} \
-e OS_DISK_URI=${OS_DISK_URI} \
-e MANAGED_SIG_ID=${MANAGED_SIG_ID} \
-e AZURE_LOCATION=${BUILD_AZURE_LOCATION} \
-e AZURE_LOCATION=${AZURE_BUILD_LOCATION} \
-e CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) \
-e WINDOWS_SKU=$(WINDOWS_SKU) \
-e OS_TYPE="Windows" \
Expand All @@ -103,7 +103,7 @@ steps:
-e SIG_IMAGE_NAME=${SIG_IMAGE_NAME} \
-e SIG_IMAGE_VERSION=${SIG_IMAGE_VERSION} \
-e ARCHITECTURE=${ARCHITECTURE} \
${CONTAINER_IMAGE} make -f packer.mk test-building-vhd
${AZURE_CONTAINER_IMAGE} make -f packer.mk test-building-vhd
displayName: Run VHD cache test
# We can upload release notes for check-in pr and sig mode to validate whether it is expected.
Expand All @@ -128,12 +128,12 @@ steps:
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/AgentBaker \
-w /go/src/github.com/Azure/AgentBaker \
-e CLIENT_ID=${BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${BUILD_SUBSCRIPTION_ID}" \
-e RESOURCE_GROUP_NAME="${BUILD_AZURE_RESOURCE_GROUP_NAME}" \
-e LOCATION="${BUILD_AZURE_LOCATION}" \
-e CLIENT_ID=${AZURE_BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(AZURE_BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${AZURE_BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${AZURE_BUILD_SUBSCRIPTION_ID}" \
-e RESOURCE_GROUP_NAME="${AZURE_BUILD_RESOURCE_GROUP_NAME}" \
-e LOCATION="${AZURE_BUILD_LOCATION}" \
-e OS_TYPE="Windows" \
-e CLASSIC_SA_CONNECTION_STRING="$(CLASSIC_SA_CONNECTION_STRING)" \
-e OUTPUT_STORAGE_ACCOUNT_NAME=${OUTPUT_STORAGE_ACCOUNT_NAME} \
Expand All @@ -143,7 +143,7 @@ steps:
-e SIG_GALLERY_NAME=${SIG_GALLERY_NAME} \
-e SIG_IMAGE_VERSION=${SIG_IMAGE_VERSION} \
-e CAPTURED_SIG_VERSION=${captured_sig_version} \
${CONTAINER_IMAGE} make -f packer.mk convert-sig-to-classic-storage-account-blob
${AZURE_CONTAINER_IMAGE} make -f packer.mk convert-sig-to-classic-storage-account-blob
displayName: Convert Shared Image Gallery To VHD Blob In Classic Storage Account
condition: and(eq(variables.DRY_RUN, 'False'), eq(variables.SIG_FOR_PRODUCTION, 'True'))
Expand All @@ -166,12 +166,12 @@ steps:
docker run --rm \
-v ${PWD}:/go/src/github.com/Azure/AgentBaker \
-w /go/src/github.com/Azure/AgentBaker \
-e CLIENT_ID=${BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${BUILD_SUBSCRIPTION_ID}" \
-e CLIENT_ID=${AZURE_BUILD_CLIENT_ID} \
-e CLIENT_SECRET="$(AZURE_BUILD_CLIENT_SECRET)" \
-e TENANT_ID=${AZURE_BUILD_TENANT_ID} \
-e SUBSCRIPTION_ID="${AZURE_BUILD_SUBSCRIPTION_ID}" \
-e SA_NAME=${SA_NAME} \
-e AZURE_RESOURCE_GROUP_NAME=${BUILD_AZURE_RESOURCE_GROUP_NAME} \
-e AZURE_RESOURCE_GROUP_NAME=${AZURE_BUILD_RESOURCE_GROUP_NAME} \
-e PKR_RG_NAME=${PKR_RG_NAME} \
-e MODE=$(MODE) \
-e DRY_RUN=${DRY_RUN} \
Expand All @@ -184,7 +184,7 @@ steps:
-e SIG_IMAGE_VERSION=${SIG_IMAGE_VERSION} \
-e SIG_FOR_PRODUCTION=${SIG_FOR_PRODUCTION} \
-e OS_TYPE="Windows" \
${CONTAINER_IMAGE} make -f packer.mk cleanup
${AZURE_CONTAINER_IMAGE} make -f packer.mk cleanup
displayName: Clean Up Packer Generated Resources
condition: always()
Expand Down Expand Up @@ -218,7 +218,7 @@ steps:
-e IMAGE_VERSION=${IMAGE_VERSION} \
-e HYPERV_GENERATION=${HYPERV_GENERATION} \
-e OS_TYPE="Windows" \
${CONTAINER_IMAGE} make -f packer.mk generate-sas
${AZURE_CONTAINER_IMAGE} make -f packer.mk generate-sas
displayName: Getting Shared Access Signature URI
condition: and(succeeded(), eq(variables.DRY_RUN, 'False'),
eq(variables.SIG_FOR_PRODUCTION, 'True'))
Expand Down
16 changes: 8 additions & 8 deletions .pipelines/templates/e2e-windows-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
- bash: pip install -Iv azure-cli==2.45.0 --extra-index-url https://azurecliprod.blob.core.windows.net/edge
displayName: use specified version of az cli
- bash: |
az login --service-principal -u $(AZURE_CLIENT_ID) -p $(AZURE_CLIENT_SECRET) --tenant $(AZURE_TENANT_ID)
az account set -s $(AZURE_SUBSCRIPTION_ID)
az login --service-principal -u $(AZURE_BUILD_CLIENT_ID) -p $(AZURE_BUILD_CLIENT_SECRET) --tenant $(AZURE_BUILD_TENANT_ID)
az account set -s $(AZURE_E2E_SUBSCRIPTION_ID)
displayName: az login
- bash: bash .pipelines/scripts/setup_go.sh
displayName: setup go
Expand All @@ -46,7 +46,7 @@ jobs:
fi
else
if [[ -z "${KUBERNETES_VERSION}" ]]; then
KUBERNETES_VERSION=$(az aks get-versions -l $LOCATION --query "orchestrators[?default==\`true\`].orchestratorVersion" -otsv)
KUBERNETES_VERSION=$(az aks get-versions -l $AZURE_BUILD_LOCATION --query "orchestrators[?default==\`true\`].orchestratorVersion" -otsv)
echo "Using default kubernetes version ${KUBERNETES_VERSION} for the windows package"
fi
export windowsPackageURL="https://acs-mirror.azureedge.net/kubernetes/v${KUBERNETES_VERSION}/windowszip/v${KUBERNETES_VERSION}-1int.zip"
Expand All @@ -61,7 +61,7 @@ jobs:
bash ./e2e-starter.sh
bash e2e-create-windows-nodepool.sh
env:
MAPPED_ACCOUNT_KEY: $(STORAGE_ACCOUNT_KEY)
MAPPED_ACCOUNT_KEY: $(AZURE_E2E_STORAGE_ACCOUNT_KEY)
displayName: Setup Test Cluster
- publish: $(System.DefaultWorkingDirectory)/${{ parameters.windowsImage }}
artifact: ${{ parameters.windowsImage }}-clusterConfig
Expand All @@ -87,8 +87,8 @@ jobs:
- bash: pip install -Iv azure-cli==2.45.0 --extra-index-url https://azurecliprod.blob.core.windows.net/edge
displayName: use specified version of az cli
- bash: |
az login --service-principal -u $(AZURE_CLIENT_ID) -p $(AZURE_CLIENT_SECRET) --tenant $(AZURE_TENANT_ID)
az account set -s $(AZURE_SUBSCRIPTION_ID)
az login --service-principal -u $(AZURE_BUILD_CLIENT_ID) -p $(AZURE_BUILD_CLIENT_SECRET) --tenant $(AZURE_BUILD_TENANT_ID)
az account set -s $(AZURE_E2E_SUBSCRIPTION_ID)
displayName: az login
- bash: |
export SCENARIO_NAME
Expand All @@ -100,7 +100,7 @@ jobs:
export WINDOWS_PACKAGE_VERSION=$(echo $windowsPackageURL | grep -oP '(?<=/v)\d+\.\d+\.\d+' | head -1)
else
if [[ -z "${KUBERNETES_VERSION}" ]]; then
KUBERNETES_VERSION=$(az aks get-versions -l $LOCATION --query "orchestrators[?default==\`true\`].orchestratorVersion" -otsv)
KUBERNETES_VERSION=$(az aks get-versions -l $AZURE_BUILD_LOCATION --query "orchestrators[?default==\`true\`].orchestratorVersion" -otsv)
echo "Using default kubernetes version ${KUBERNETES_VERSION} for the windows package"
fi
export windowsPackageURL="https://acs-mirror.azureedge.net/kubernetes/v${KUBERNETES_VERSION}/windowszip/v${KUBERNETES_VERSION}-1int.zip"
Expand All @@ -112,7 +112,7 @@ jobs:
cd $WINDOWS_E2E_IMAGE
bash e2e-scenario.sh
env:
MAPPED_ACCOUNT_KEY: $(STORAGE_ACCOUNT_KEY)
MAPPED_ACCOUNT_KEY: $(AZURE_E2E_STORAGE_ACCOUNT_KEY)
- publish: $(System.DefaultWorkingDirectory)/${{ parameters.windowsImage }}/$(SCENARIO_NAME)-logs
artifact: ${{ parameters.windowsImage }}-$(SCENARIO_NAME)-logs
condition: always()
12 changes: 6 additions & 6 deletions e2e/windows/e2e-create-windows-nodepool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ source e2e-helper.sh

log "Starting to create windows nodepool"

RESOURCE_GROUP_NAME="$RESOURCE_GROUP_NAME-$WINDOWS_E2E_IMAGE-$K8S_VERSION"
E2E_RESOURCE_GROUP_NAME="$AZURE_E2E_RESOURCE_GROUP_NAME-$WINDOWS_E2E_IMAGE-$K8S_VERSION"

out=$(az aks nodepool list --cluster-name $CLUSTER_NAME -g $RESOURCE_GROUP_NAME | jq '.[].name')
out=$(az aks nodepool list --cluster-name $AZURE_E2E_CLUSTER_NAME -g $E2E_RESOURCE_GROUP_NAME | jq '.[].name')

if [[ "$out" != *"winnp"* ]]; then
log "Creating windows nodepool"
retval=0
az aks nodepool add --resource-group $RESOURCE_GROUP_NAME --cluster-name $CLUSTER_NAME --name "winnp" --os-type Windows --os-sku $WINDOWS_E2E_OSSKU --node-vm-size $WINDOWS_E2E_VMSIZE --node-count 1 || retval=$?
az aks nodepool add --resource-group $E2E_RESOURCE_GROUP_NAME --cluster-name $AZURE_E2E_CLUSTER_NAME --name "winnp" --os-type Windows --os-sku $WINDOWS_E2E_OSSKU --node-vm-size $WINDOWS_E2E_VMSIZE --node-count 1 || retval=$?
if [ "$retval" -ne 0 ]; then
log "Other pipeline may be creating the same nodepool, waiting for ready"
else
Expand All @@ -23,13 +23,13 @@ else
log "Already create windows nodepool"
fi

provisioning_state=$(az aks nodepool show --cluster-name $CLUSTER_NAME -g $RESOURCE_GROUP_NAME -n "winnp" -ojson | jq '.provisioningState' | tr -d "\"")
provisioning_state=$(az aks nodepool show --cluster-name $AZURE_E2E_CLUSTER_NAME -g $E2E_RESOURCE_GROUP_NAME -n "winnp" -ojson | jq '.provisioningState' | tr -d "\"")
if [ "$provisioning_state" == "Creating" ]; then
log "Other pipeline may be creating the same nodepool, waiting for ready"
az aks nodepool wait --nodepool-name "winnp" --cluster-name $CLUSTER_NAME --resource-group $RESOURCE_GROUP_NAME --created --interval 60 --timeout 1800
az aks nodepool wait --nodepool-name "winnp" --cluster-name $AZURE_E2E_CLUSTER_NAME --resource-group $E2E_RESOURCE_GROUP_NAME --created --interval 60 --timeout 1800
fi

provisioning_state=$(az aks nodepool show --cluster-name $CLUSTER_NAME -g $RESOURCE_GROUP_NAME -n "winnp" -ojson | jq '.provisioningState' | tr -d "\"")
provisioning_state=$(az aks nodepool show --cluster-name $AZURE_E2E_CLUSTER_NAME -g $E2E_RESOURCE_GROUP_NAME -n "winnp" -ojson | jq '.provisioningState' | tr -d "\"")
if [ "$provisioning_state" == "Succeeded" ]; then
log "Windows nodepool is in succeed state"
else
Expand Down
Loading

0 comments on commit 7a78eb1

Please sign in to comment.