Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit acbd140

Browse files
Update build template in run test
1 parent a504a33 commit acbd140

File tree

2 files changed

+13
-34
lines changed

2 files changed

+13
-34
lines changed

testing/pipeline/k8s-custom-pipelines.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ stages:
2020
RESOURCE_GROUP: "K8sPartnerExtensionTest"
2121
BASE_CLUSTER_NAME: "k8s-extension-cluster"
2222
IS_PRIVATE_BRANCH: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/k8s-extension/private'), eq(variables['System.PullRequest.TargetBranch'], 'k8s-extension/private'))]
23-
24-
EXTENSION_NAME: "k8s-extension"
25-
EXTENSION_FILE_NAME: "k8s_extension"
2623
jobs:
2724
- template: ./templates/run-test.yml
2825
parameters:

testing/pipeline/templates/run-test.yml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ jobs:
66
- job: ${{ parameters.jobName}}
77
pool:
88
vmImage: 'ubuntu-latest'
9+
variables:
10+
${{ if eq(variables['IS_PRIVATE_BRANCH'], 'False') }}:
11+
EXTENSION_NAME: "k8s-extension"
12+
EXTENSION_FILE_NAME: "k8s_extension"
13+
${{ if ne(variables['IS_PRIVATE_BRANCH'], 'False') }}:
14+
EXTENSION_NAME: "k8s-extension-private"
15+
EXTENSION_FILE_NAME: "k8s_extension_private"
916
steps:
1017
- bash: |
1118
echo "Installing helm3"
@@ -19,33 +26,9 @@ jobs:
1926
sudo mv ./kubectl /usr/local/bin/kubectl
2027
kubectl version --client
2128
displayName: "Setup the VM with helm3 and kubectl"
22-
- task: UsePythonVersion@0
23-
displayName: 'Use Python 3.6'
24-
inputs:
25-
versionSpec: 3.6
26-
- bash: |
27-
set -ev
28-
echo "Building extension ${EXTENSION_NAME}..."
29-
30-
# prepare and activate virtualenv
31-
pip install virtualenv
32-
python3 -m venv env/
33-
source env/bin/activate
34-
35-
# clone azure-cli
36-
git clone -q --single-branch -b dev https://github.com/Azure/azure-cli.git ../azure-cli
37-
38-
pip install --upgrade pip
39-
pip install -q azdev
40-
41-
ls $(CLI_REPO_PATH)
42-
43-
azdev --version
44-
azdev setup -c ../azure-cli -r $(CLI_REPO_PATH) -e $(EXTENSION_NAME)
45-
azdev extension build $(EXTENSION_NAME)
46-
workingDirectory: $(CLI_REPO_PATH)
47-
displayName: "Setup and Build Extension with azdev"
48-
29+
- template: ./build-extension.yml
30+
parameters:
31+
CLI_REPO_PATH: $(CLI_REPO_PATH)
4932
- bash: |
5033
K8S_EXTENSION_VERSION=$(ls ${EXTENSION_FILE_NAME}* | cut -d "-" -f2)
5134
echo "##vso[task.setvariable variable=K8S_EXTENSION_VERSION]$K8S_EXTENSION_VERSION"
@@ -64,11 +47,11 @@ jobs:
6447
--arg AKS_CLUSTER_NAME "$AKS_CLUSTER_NAME" \
6548
--arg ARC_CLUSTER_NAME "$ARC_CLUSTER_NAME" \
6649
--arg K8S_EXTENSION_VERSION "$K8S_EXTENSION_VERSION" \
67-
'{subscriptionId: $SUB_ID, resourceGroup: $RG, aksClusterName: $AKS_CLUSTER_NAME, arcClusterName: $ARC_CLUSTER_NAME, extensionVersion: {"k8s-extension": $K8S_EXTENSION_VERSION, connectedk8s: "1.0.0"}}')
50+
'{subscriptionId: $SUB_ID, resourceGroup: $RG, aksClusterName: $AKS_CLUSTER_NAME, arcClusterName: $ARC_CLUSTER_NAME, extensionVersion: {"k8s-extension": $K8S_EXTENSION_VERSION, "k8s-extension-private": $K8S_EXTENSION_VERSION, connectedk8s: "1.0.0"}}')
6851
echo $JSON_STRING > settings.json
6952
cat settings.json
7053
workingDirectory: $(TEST_PATH)
71-
displayName: "Generate a settings.json file"
54+
displayName: "Generate a settings.json file"
7255
7356
- bash : |
7457
echo "Downloading the kind script"
@@ -98,10 +81,9 @@ jobs:
9881
scriptType: pscore
9982
scriptLocation: inlineScript
10083
inlineScript: |
101-
.\Test.ps1 -CI -Path ${{ parameters.path }} -Type k8s-extension
84+
.\Test.ps1 -CI -Path ${{ parameters.path }} -Type $(EXTENSION_NAME)
10285
workingDirectory: $(TEST_PATH)
10386
continueOnError: true
104-
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'False'))
10587

10688
- task: PublishTestResults@2
10789
inputs:

0 commit comments

Comments
 (0)