Skip to content
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

Stage Public Version of k8s-extension 0.2.0 for official release #15

Merged
merged 34 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
828f9d3
Create pull.yml
jonathan-innis Mar 10, 2021
1436bfc
Update pull.yml
jonathan-innis Mar 10, 2021
6cffd96
Update azure-pipelines.yml
jonathan-innis Mar 10, 2021
db0f4bd
Initial commit of k8s-extension
jonathan-innis Mar 10, 2021
3e2ea64
Update pipelines file
jonathan-innis Mar 10, 2021
9bbc0e4
Update CODEOWNERS
jonathan-innis Mar 10, 2021
8d46cbc
Update private preview pipelines
jonathan-innis Mar 11, 2021
6c3ba41
Remove open service mesh from public release
jonathan-innis Mar 11, 2021
43c6796
Update pipeline files
jonathan-innis Mar 11, 2021
009a83e
Update public extension pipeline
jonathan-innis Mar 12, 2021
8e058c5
Change condition variable
jonathan-innis Mar 12, 2021
dea40c1
Add version to public preview/private preview
jonathan-innis Mar 12, 2021
69269e0
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
jonathan-innis Mar 12, 2021
e81e010
Update pipelines
jonathan-innis Mar 12, 2021
9621a48
Add different testing based on private branch
jonathan-innis Mar 12, 2021
862a035
Add annotations to extension model
jonathan-innis Mar 12, 2021
e1c3d12
Update k8s-custom-pipelines.yml
jonathan-innis Mar 15, 2021
3e309bf
Update SDKs with Updated Swagger Spec for 2020-07-01-preview (#13)
jonathan-innis Mar 16, 2021
1df2ef5
remove py2 bdist support
jonathan-innis Mar 16, 2021
054a903
Add custom table formatting
jonathan-innis Mar 16, 2021
b298252
Remove unnecessary files
jonathan-innis Mar 16, 2021
afb4046
Fix style issues
jonathan-innis Mar 16, 2021
a13304d
Merge branch 'master' of https://github.com/Azure/azure-cli-extension…
Mar 17, 2021
aa078b0
Merge branch 'release' into k8s-extension/public
jonathan-innis Mar 17, 2021
21dff06
Fix branch based on comments
jonathan-innis Mar 17, 2021
93919f2
Update identity piece manually
jonathan-innis Mar 17, 2021
a88127a
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Mar 17, 2021
7e40b3a
Don't handle defaults at the CLI level
jonathan-innis Mar 17, 2021
d1befa8
Remove defaults from CLI client
jonathan-innis Mar 17, 2021
c7bd93f
Merge branch 'release' into k8s-extension/public
jonathan-innis Mar 17, 2021
076827c
Check null target namespace with namespace scope
jonathan-innis Mar 17, 2021
550eea1
Update style
jonathan-innis Mar 17, 2021
1a17f1b
Merge branch 'k8s-extension/public' of github.com:AzureArcForKubernet…
jonathan-innis Mar 17, 2021
fbab3be
Add cassandra operator and location to model
jonathan-innis Mar 17, 2021
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
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:
NarayanThiru marked this conversation as resolved.
Show resolved Hide resolved
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