Skip to content

Commit

Permalink
Stage Public Version of k8s-extension 0.2.0 for official release (Azu…
Browse files Browse the repository at this point in the history
…re#15)

* Create pull.yml

* Update pull.yml

* Update azure-pipelines.yml

* Initial commit of k8s-extension

* Update pipelines file

* Update CODEOWNERS

* Update private preview pipelines

* Remove open service mesh from public release

* Update pipeline files

* Update public extension pipeline

* Change condition variable

* Add version to public preview/private preview

* Update pipelines

* Add different testing based on private branch

* Add annotations to extension model

* Update k8s-custom-pipelines.yml

* Update SDKs with Updated Swagger Spec for 2020-07-01-preview (Azure#13)

* Update sdks with updated swagger spec

* Update version and history rst

* Reorder release history timeline

* Fix ExtensionInstanceForCreate for import

* remove py2 bdist support

* Add custom table formatting

* Remove unnecessary files

* Fix style issues

* Fix branch based on comments

* Update identity piece manually

* Don't handle defaults at the CLI level

* Remove defaults from CLI client

* Check null target namespace with namespace scope

* Update style

* Add cassandra operator and location to model

Co-authored-by: action@github.com <Action - Fork Sync>
  • Loading branch information
jonathan-innis authored Mar 18, 2021
1 parent 483202c commit 9aade9f
Show file tree
Hide file tree
Showing 39 changed files with 4,781 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@

/src/ssh/ @rlrossiter @danybeam @arrownj

/src/k8sconfiguration/ @NarayanThiru
/src/k8sconfiguration/ @NarayanThiru @jonathan-innis

/src/k8s-configuration/ @NarayanThiru
/src/k8s-configuration/ @NarayanThiru @jonathan-innis

/src/k8s-extension/ @NarayanThiru @jonathan-innis

/src/log-analytics-solution/ @zhoxing-ms

Expand Down
356 changes: 356 additions & 0 deletions k8s-custom-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,356 @@
resources:
repositories:
- repository: K8sPartnerExtensionTest
type: git
endpoint: AzureReposConnection
name: One/compute-HybridMgmt-K8sPartnerExtensionTest

trigger:
batch: true
branches:
include:
- k8s-extension/public
- k8s-extension/private
pr:
branches:
include:
- k8s-extension/public
- k8s-extension/private

stages:
- stage: BuildTestPublishExtension
displayName: "Build, Test, and Publish Extension"
variables:
K8S_EXTENSION_REPO_PATH: $(Agent.BuildDirectory)/s/compute-HybridMgmt-K8sPartnerExtensionTest
CLI_REPO_PATH: $(Agent.BuildDirectory)/s/azure-cli-extensions
SUBSCRIPTION_ID: "15c06b1b-01d6-407b-bb21-740b8617dea3"
RESOURCE_GROUP: "K8sPartnerExtensionTest"
BASE_CLUSTER_NAME: "k8s-extension-cluster"
IS_PRIVATE_BRANCH: $[or(eq(variables['Build.SourceBranch'], 'refs/heads/k8s-extension/private'), eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/k8s-extension/private'))]

EXTENSION_NAME: "k8s-extension"
EXTENSION_FILE_NAME: "k8s_extension"
jobs:
- job: K8sExtensionTestSuite
displayName: "Run the Test Suite"
pool:
vmImage: 'ubuntu-16.04'
steps:
- checkout: self
- checkout: K8sPartnerExtensionTest
- 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
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
pip install azdev
ls $(CLI_REPO_PATH)
azdev --version
azdev setup -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 * $(K8S_EXTENSION_REPO_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: $(K8S_EXTENSION_REPO_PATH)
displayName: "Generate a settings.json file"
- bash : |
echo "Downloading the kind script"
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.9.0/kind-linux-amd64
chmod +x ./kind
./kind create cluster
displayName: "Create and Start the Kind cluster"
- task: AzureCLI@2
displayName: Bootstrap
inputs:
azureSubscription: AzureResourceConnection
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\Bootstrap.ps1 -CI
workingDirectory: $(K8S_EXTENSION_REPO_PATH)

- task: AzureCLI@2
displayName: Run the Test Suite Public Extensions Only
inputs:
azureSubscription: AzureResourceConnection
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\Test.ps1 -CI -ExtensionType Public -OnlyPublicTests
workingDirectory: $(K8S_EXTENSION_REPO_PATH)
continueOnError: true
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'False'))

- task: AzureCLI@2
displayName: Run the Test Suite on Private + Public Extensions
inputs:
azureSubscription: AzureResourceConnection
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\Test.ps1 -CI -ExtensionType Public
workingDirectory: $(K8S_EXTENSION_REPO_PATH)
continueOnError: true
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'True'))

- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TestResults.xml'
failTaskOnFailedTests: true
condition: succeededOrFailed()

- task: AzureCLI@2
displayName: Cleanup
inputs:
azureSubscription: AzureResourceConnection
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\Cleanup.ps1 -CI
workingDirectory: $(K8S_EXTENSION_REPO_PATH)
condition: succeededOrFailed()

- job: BuildPublishExtension
pool:
vmImage: 'ubuntu-16.04'
displayName: "Build and Publish the Extension Artifact"
variables:
CLI_REPO_PATH: $(Agent.BuildDirectory)/s
steps:
- bash: |
echo "Using the private preview of k8s-extension to build..."
cp $(CLI_REPO_PATH)/src/k8s-extension $(CLI_REPO_PATH)/src/k8s-extension-private -r
cp $(CLI_REPO_PATH)/src/k8s-extension-private/azext_k8s_extension/_consts_private.py $(CLI_REPO_PATH)/src/k8s-extension-private/azext_k8s_extension/_consts.py
EXTENSION_NAME="k8s-extension-private"
EXTENSION_FILE_NAME="k8s_extension_private"
echo "##vso[task.setvariable variable=EXTENSION_NAME]$EXTENSION_NAME"
echo "##vso[task.setvariable variable=EXTENSION_FILE_NAME]$EXTENSION_FILE_NAME"
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'True'))
displayName: "Copy Files, Set Variables for k8s-extension-private"
- bash: |
echo "Using the public version of k8s-extension to build..."
EXTENSION_NAME="k8s-extension"
EXTENSION_FILE_NAME="k8s_extension"
echo "##vso[task.setvariable variable=EXTENSION_NAME]$EXTENSION_NAME"
echo "##vso[task.setvariable variable=EXTENSION_FILE_NAME]$EXTENSION_FILE_NAME"
condition: and(succeeded(), eq(variables['IS_PRIVATE_BRANCH'], 'False'))
displayName: "Copy Files, Set Variables for k8s-extension"
- 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
pip install azdev
ls $(CLI_REPO_PATH)
azdev --version
azdev setup -r $(CLI_REPO_PATH) -e $(EXTENSION_NAME)
azdev extension build $(EXTENSION_NAME)
workingDirectory: $(CLI_REPO_PATH)
displayName: "Setup and Build Extension with azdev"
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(CLI_REPO_PATH)/dist

- stage: AzureCLIOfficial
displayName: "Azure Official CLI Code Checks"
dependsOn: []
jobs:
- job: CheckLicenseHeader
displayName: "Check License"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
versionSpec: 3.6
- bash: |
set -ev
# prepare and activate virtualenv
python -m venv env/
chmod +x ./env/bin/activate
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 -q azdev
azdev setup -c ../azure-cli -r ./
azdev --version
az --version
azdev verify license
- job: StaticAnalysis
displayName: "Static Analysis"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
versionSpec: 3.6
- bash: pip install wheel==0.30.0 pylint==1.9.5 flake8==3.5.0 requests
displayName: 'Install wheel, pylint, flake8, requests'
- bash: python scripts/ci/source_code_static_analysis.py
displayName: "Static Analysis"

- job: IndexVerify
displayName: "Verify Extensions Index"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- bash: |
#!/usr/bin/env bash
set -ev
pip install wheel==0.30.0 requests packaging
export CI="ADO"
python ./scripts/ci/test_index.py -v
displayName: "Verify Extensions Index"
- job: SourceTests
displayName: "Integration Tests, Build Tests"
pool:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
Python36:
python.version: '3.6'
Python38:
python.version: '3.8'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'
- bash: pip install wheel==0.30.0
displayName: 'Install wheel==0.30.0'
- bash: ./scripts/ci/test_source.sh
displayName: 'Run integration test and build test'
env:
ADO_PULL_REQUEST_LATEST_COMMIT: $(System.PullRequest.SourceCommitId)
ADO_PULL_REQUEST_TARGET_BRANCH: $(System.PullRequest.TargetBranch)

- job: LintModifiedExtensions
displayName: "CLI Linter on Modified Extensions"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.6'
inputs:
versionSpec: 3.6
- bash: |
set -ev
# prepare and activate virtualenv
pip install virtualenv
python -m virtualenv venv/
source ./venv/bin/activate
# clone azure-cli
git clone --single-branch -b dev https://github.com/Azure/azure-cli.git ../azure-cli
pip install azdev
azdev --version
azdev setup -c ../azure-cli -r ./ -e k8s-extension
# overwrite the default AZURE_EXTENSION_DIR set by ADO
AZURE_EXTENSION_DIR=~/.azure/cliextensions az --version
AZURE_EXTENSION_DIR=~/.azure/cliextensions azdev linter --include-whl-extensions k8s-extension
displayName: "CLI Linter on Modified Extension"
env:
ADO_PULL_REQUEST_LATEST_COMMIT: $(System.PullRequest.SourceCommitId)
ADO_PULL_REQUEST_TARGET_BRANCH: $(System.PullRequest.TargetBranch)
- job: IndexRefDocVerify
displayName: "Verify Ref Docs"
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.7'
inputs:
versionSpec: 3.7
- bash: pip install wheel==0.30.0
displayName: 'Install wheel==0.30.0'
- task: Bash@3
displayName: "Verify Extension Ref Docs"
inputs:
targetType: 'filePath'
filePath: scripts/ci/test_index_ref_doc.sh
Loading

0 comments on commit 9aade9f

Please sign in to comment.