diff --git a/.azure-pipelines/azure-pipelines.yml b/.azure-pipelines/azure-pipelines.yml new file mode 100644 index 0000000..7093439 --- /dev/null +++ b/.azure-pipelines/azure-pipelines.yml @@ -0,0 +1,51 @@ +# Python package +# Create and test a Python package on multiple Python versions. +# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/python + +trigger: +- master + +pr: none + +jobs: + + +- job: 'Build_Publish_AKS_Deploy_CLI_Extension' + pool: + vmImage: 'Ubuntu-16.04' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.x' + architecture: 'x64' + + - template: templates/setup-ci-machine.yml + + - template: templates/build-publish-aks-deploy-cli-extension.yml + +- job: 'Run_Style_Check' + pool: + vmImage: 'macOS-10.13' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.x' + architecture: 'x64' + + - template: templates/install-azure-cli-edge.yml + + - template: templates/download-install-local-azure-test-sdk.yml + + - template: templates/setup-ci-machine.yml + + - template: templates/download-install-local-aks-deploy-cli-extension-with-pip.yml + + - task: PowerShell@2 + displayName: 'Run Style Check' + inputs: + targetType: 'filePath' + filePath: 'scripts/runStyleCheck.ps1' + diff --git a/.azure-pipelines/templates/build-publish-aks-deploy-cli-extension.yml b/.azure-pipelines/templates/build-publish-aks-deploy-cli-extension.yml new file mode 100644 index 0000000..d275bda --- /dev/null +++ b/.azure-pipelines/templates/build-publish-aks-deploy-cli-extension.yml @@ -0,0 +1,15 @@ +steps: + - script: 'pip install --upgrade .' + displayName: 'Install AKS Deploy CLI extension' + workingDirectory: 'deploy-aks/' + + - script: 'python setup.py sdist bdist_wheel' + displayName: 'Build wheel for AKS Deploy CLI extension' + workingDirectory: 'deply-aks/' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish AKS Deploy CLI extension as artifact' + inputs: + pathtoPublish: 'deploy-aks/dist' + artifactName: 'aks-deploy-cli-extension' + publishLocation: 'Container' \ No newline at end of file diff --git a/.azure-pipelines/templates/build-publish-azure-cli-test-sdk.yml b/.azure-pipelines/templates/build-publish-azure-cli-test-sdk.yml new file mode 100644 index 0000000..f33d70d --- /dev/null +++ b/.azure-pipelines/templates/build-publish-azure-cli-test-sdk.yml @@ -0,0 +1,21 @@ +steps: + - script: 'rm -rf azure-cli' + displayName: 'delete azure cli directory' + + - script: 'git clone https://github.com/Azure/azure-cli.git' + displayName: 'Clone Azure CLI repository' + + - script: 'pip install --upgrade .' + displayName: 'Install Azure CLI test SDK' + workingDirectory: 'azure-cli/src/azure-cli-testsdk/' + + - script: 'python setup.py sdist bdist_wheel' + displayName: 'Build wheel for Azure CLI test SDK' + workingDirectory: 'azure-cli/src/azure-cli-testsdk/' + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Azure CLI test SDK as artifact' + inputs: + pathtoPublish: 'azure-cli/src/azure-cli-testsdk/dist' + artifactName: 'azure-cli-test-sdk' + publishLocation: 'Container' \ No newline at end of file diff --git a/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension-with-pip.yml b/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension-with-pip.yml new file mode 100644 index 0000000..0ec4085 --- /dev/null +++ b/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension-with-pip.yml @@ -0,0 +1,22 @@ +steps: + - task: DownloadBuildArtifacts@0 + displayName : 'Download Extension wheel from Build Artifacts' + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'azure-devops-cli-extension' + downloadPath: '$(System.ArtifactsDirectory)/extension' + + - task: PowerShell@2 + displayName: 'Install Downloaded Extension' + inputs: + targetType: 'inline' + script: | + $extensions = Get-ChildItem -Filter "*.whl" -Recurse | Select-Object FullName + Foreach ($extension in $extensions) + { + Write-Host "installing " $extension.FullName + pip install $extension.FullName + } + Write-Host "done" + workingDirectory: '$(System.ArtifactsDirectory)/extension' \ No newline at end of file diff --git a/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension.yml b/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension.yml new file mode 100644 index 0000000..da3876a --- /dev/null +++ b/.azure-pipelines/templates/download-install-local-aks-deploy-cli-extension.yml @@ -0,0 +1,22 @@ +steps: + - task: DownloadBuildArtifacts@0 + displayName : 'Download Extension wheel from Build Artifacts' + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'ak-deploy-cli-extension' + downloadPath: '$(System.ArtifactsDirectory)/extension' + + - task: PowerShell@2 + displayName: 'Install Downloaded Extension' + inputs: + targetType: 'inline' + script: | + $extensions = Get-ChildItem -Filter "*.whl" -Recurse | Select-Object FullName + Foreach ($extension in $extensions) + { + Write-Host "installing " $extension.FullName + az extension add --source $extension.FullName -y --debug + } + Write-Host "done" + workingDirectory: '$(System.ArtifactsDirectory)/extension' \ No newline at end of file diff --git a/.azure-pipelines/templates/download-install-local-azure-test-sdk.yml b/.azure-pipelines/templates/download-install-local-azure-test-sdk.yml new file mode 100644 index 0000000..63fb801 --- /dev/null +++ b/.azure-pipelines/templates/download-install-local-azure-test-sdk.yml @@ -0,0 +1,22 @@ +steps: + - task: DownloadBuildArtifacts@0 + displayName : 'Download Azure CLI test SDK wheel from Build Artifacts' + inputs: + buildType: 'current' + downloadType: 'single' + artifactName: 'azure-cli-test-sdk' + downloadPath: '$(System.ArtifactsDirectory)/wheels' + + - task: PowerShell@2 + displayName: 'Install Downloaded Wheels' + inputs: + targetType: 'inline' + script: | + $wheels = Get-ChildItem -Filter "*.whl" -Recurse | Select-Object FullName + Foreach ($wheel in $wheels) + { + Write-Host "installing" $wheel.FullName + pip install $wheel.FullName + } + Write-Host "done" + workingDirectory: '$(System.ArtifactsDirectory)/wheels' \ No newline at end of file diff --git a/.azure-pipelines/templates/install-azure-cli-edge.yml b/.azure-pipelines/templates/install-azure-cli-edge.yml new file mode 100644 index 0000000..f437951 --- /dev/null +++ b/.azure-pipelines/templates/install-azure-cli-edge.yml @@ -0,0 +1,21 @@ +steps: + - script: 'python -m pip install --upgrade pip' + displayName: 'Upgrade pip' + + - script: 'python --version' + displayName: 'Display Python version' + + - script: 'az --version' + displayName: 'Display az version before update' + + - script: 'pip uninstall azure-cli -y' + displayName: 'Remove Azure CLI' + + - script: 'pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge --upgrade-strategy eager' + displayName: 'Install Azure CLI Edge' + + - script: 'python --version' + displayName: 'Display Python version' + + - script: 'az --version' + displayName: 'Display az version after update' diff --git a/.azure-pipelines/templates/install-azure-cli-released.yml b/.azure-pipelines/templates/install-azure-cli-released.yml new file mode 100644 index 0000000..418e789 --- /dev/null +++ b/.azure-pipelines/templates/install-azure-cli-released.yml @@ -0,0 +1,3 @@ +steps: + - script: pip install azure-cli + displayName: 'Install Azure CLI released version' \ No newline at end of file diff --git a/.azure-pipelines/templates/setup-ci-machine.yml b/.azure-pipelines/templates/setup-ci-machine.yml new file mode 100644 index 0000000..f7ad6d3 --- /dev/null +++ b/.azure-pipelines/templates/setup-ci-machine.yml @@ -0,0 +1,11 @@ +steps: +- script: python -m pip install --upgrade pip + displayName: 'Upgrade pip' +- script: pip install wheel==0.30.0 + displayName: 'Install Wheel' +- script: pip install pytest==4.6.6 + displayName: 'Install pytest' +- script: pip install coverage + displayName: 'Install coverage' +- script: pip install pytest-cov + displayName: 'Install pytest-cov' \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index bbcb905..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,42 +0,0 @@ -# Python package -# Create and test a Python package on multiple Python versions. -# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: -# https://docs.microsoft.com/azure/devops/pipelines/languages/python - -trigger: -- master - -pool: - vmImage: 'ubuntu-latest' -strategy: - matrix: - Python36: - python.version: '3.6' - -steps: - - script: python -m pip install --upgrade pip - displayName: 'Upgrade Pip' - - - script: python -m pip install --user wheel==0.30.0 - displayName: 'Install Wheel' - - - script: 'python -m pip install --user --upgrade .' - displayName: 'Pip Upgrade' - workingDirectory: 'deploy-aks/' - - - script: 'python ./setup.py bdist_wheel' - displayName: 'Build wheel for CLI Extension' - workingDirectory: 'deploy-aks/' - - - task: PowerShell@2 - displayName: 'Style Check' - inputs: - filePath: 'scripts/runStyleCheck.ps1' - errorActionPreference: 'continue' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Azure AKS deploy CLI Extension as Artifact' - inputs: - pathtoPublish: 'deploy-aks/dist' - artifactName: 'deploy-aks-cli-extension' - publishLocation: Container