forked from Azure/azure-cli-extensions
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d507bf2
commit 2970374
Showing
3 changed files
with
151 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
parameters: | ||
jobName: '' | ||
path: '' | ||
|
||
jobs: | ||
- job: ${{ parameters.jobName}} | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- bash: | | ||
echo "Installing helm3" | ||
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | ||
chmod 700 get_helm.sh | ||
./get_helm.sh --version v3.6.3 | ||
echo "Installing kubectl" | ||
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" | ||
chmod +x ./kubectl | ||
sudo mv ./kubectl /usr/local/bin/kubectl | ||
kubectl version --client | ||
displayName: "Setup the VM with helm3 and kubectl" | ||
- task: UsePythonVersion@0 | ||
displayName: 'Use Python 3.6' | ||
inputs: | ||
versionSpec: 3.6 | ||
- bash: | | ||
set -ev | ||
echo "Building extension ${EXTENSION_NAME}..." | ||
# prepare and activate virtualenv | ||
pip install virtualenv | ||
python3 -m venv env/ | ||
source env/bin/activate | ||
# clone azure-cli | ||
git clone -q --single-branch -b dev https://github.com/Azure/azure-cli.git ../azure-cli | ||
pip install --upgrade pip | ||
pip install -q azdev | ||
ls $(CLI_REPO_PATH) | ||
azdev --version | ||
azdev setup -c ../azure-cli -r $(CLI_REPO_PATH) -e $(EXTENSION_NAME) | ||
azdev extension build $(EXTENSION_NAME) | ||
workingDirectory: $(CLI_REPO_PATH) | ||
displayName: "Setup and Build Extension with azdev" | ||
- bash: | | ||
K8S_EXTENSION_VERSION=$(ls ${EXTENSION_FILE_NAME}* | cut -d "-" -f2) | ||
echo "##vso[task.setvariable variable=K8S_EXTENSION_VERSION]$K8S_EXTENSION_VERSION" | ||
cp * $(TEST_PATH)/bin | ||
workingDirectory: $(CLI_REPO_PATH)/dist | ||
displayName: "Copy the Built .whl to Extension Test Path" | ||
- bash: | | ||
RAND_STR=$RANDOM | ||
AKS_CLUSTER_NAME="${BASE_CLUSTER_NAME}-${RAND_STR}-aks" | ||
ARC_CLUSTER_NAME="${BASE_CLUSTER_NAME}-${RAND_STR}-arc" | ||
JSON_STRING=$(jq -n \ | ||
--arg SUB_ID "$SUBSCRIPTION_ID" \ | ||
--arg RG "$RESOURCE_GROUP" \ | ||
--arg AKS_CLUSTER_NAME "$AKS_CLUSTER_NAME" \ | ||
--arg ARC_CLUSTER_NAME "$ARC_CLUSTER_NAME" \ | ||
--arg K8S_EXTENSION_VERSION "$K8S_EXTENSION_VERSION" \ | ||
'{subscriptionId: $SUB_ID, resourceGroup: $RG, aksClusterName: $AKS_CLUSTER_NAME, arcClusterName: $ARC_CLUSTER_NAME, extensionVersion: {"k8s-extension": $K8S_EXTENSION_VERSION, connectedk8s: "1.0.0"}}') | ||
echo $JSON_STRING > settings.json | ||
cat settings.json | ||
workingDirectory: $(TEST_PATH) | ||
displayName: "Generate a settings.json file" | ||
- bash : | | ||
echo "Downloading the kind script" | ||
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 | ||
chmod +x ./kind | ||
./kind create cluster | ||
displayName: "Create and Start the Kind cluster" | ||
- bash: | | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
displayName: "Upgrade az to latest version" | ||
- task: AzureCLI@2 | ||
displayName: Bootstrap | ||
inputs: | ||
azureSubscription: AzureResourceConnection | ||
scriptType: pscore | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
.\Bootstrap.ps1 -CI | ||
workingDirectory: $(TEST_PATH) | ||
|
||
- task: AzureCLI@2 | ||
displayName: Run the Test Suite for ${{ parameters.path }} | ||
inputs: | ||
azureSubscription: AzureResourceConnection | ||
scriptType: pscore | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
.\Test.ps1 -CI -Path ${{ parameters.path }} -Type k8s-extension | ||
workingDirectory: $(TEST_PATH) | ||
continueOnError: true | ||
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'False')) | ||
|
||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFormat: 'JUnit' | ||
testResultsFiles: '**/testing/results/*.xml' | ||
failTaskOnFailedTests: true | ||
condition: succeededOrFailed() | ||
|
||
- task: AzureCLI@2 | ||
displayName: Cleanup | ||
inputs: | ||
azureSubscription: AzureResourceConnection | ||
scriptType: pscore | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
.\Cleanup.ps1 -CI | ||
workingDirectory: $(TEST_PATH) | ||
condition: succeededOrFailed() |