From 4b16b1757ee51085d19db21b18c709d456d92384 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 26 Apr 2021 14:41:58 -0700 Subject: [PATCH 001/126] extending documentation, initial tox_conda integration --- doc/dev/conda-builds.md | 9 +++++++++ eng/tox/tox_conda.ini | 0 2 files changed, 9 insertions(+) create mode 100644 eng/tox/tox_conda.ini diff --git a/doc/dev/conda-builds.md b/doc/dev/conda-builds.md index 152156bf67ad..05a1affeaf6a 100644 --- a/doc/dev/conda-builds.md +++ b/doc/dev/conda-builds.md @@ -15,9 +15,18 @@ A Conda Artifact defines: - Any other necessary details. ## How to Build an Azure SDK Conda Package Locally +#### If using powershell, you will need to prep your environment before proceeding to the next step +``` +powershell -ExecutionPolicy ByPass -NoExit -Command "& '\shell\condabin\conda-hook.ps1' ; conda activate '' " +``` + +Afterwards, invoke `conda init powershell` and re-create the pshell session. + +By default, your powershell environment will now load `conda`. If you want pure pip, you will need to use explicit invocations of your `python` locations to create virtual envs. ### Set up your conda environment + You will notice that all the azure-sdk conda distributions have the **same** version number and requirement set. This is due to the fact that the azure-sdk team pushes our conda packages out in waves. To support this, all versions are set via a common environment variable `AZURESDK_CONDA_VERSION`. We keep this environment variable set properly across all our builds by using a common `conda_env.yml` when creating our build environment. This environment definition ensures that: diff --git a/eng/tox/tox_conda.ini b/eng/tox/tox_conda.ini new file mode 100644 index 000000000000..e69de29bb2d1 From f646f31c04b65c504c2e6065ee2b1c73390b8dfe Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 26 Apr 2021 19:12:31 -0700 Subject: [PATCH 002/126] update to ensure that various build packages do not stomp on each other --- .../templates/steps/build-conda-artifacts.yml | 2 +- eng/tox/tox_conda.ini | 0 scripts/devops_tasks/test_conda_artifacts.py | 347 ++++++++++++++++++ 3 files changed, 348 insertions(+), 1 deletion(-) delete mode 100644 eng/tox/tox_conda.ini create mode 100644 scripts/devops_tasks/test_conda_artifacts.py diff --git a/eng/pipelines/templates/steps/build-conda-artifacts.yml b/eng/pipelines/templates/steps/build-conda-artifacts.yml index bcaec17a22e3..e7f9bd53d485 100644 --- a/eng/pipelines/templates/steps/build-conda-artifacts.yml +++ b/eng/pipelines/templates/steps/build-conda-artifacts.yml @@ -74,7 +74,7 @@ steps: - bash: | source activate ${{ artifact.name }} - conda-build . --output-folder "$(Agent.BuildDirectory)/conda/output" -c $(AzureSDKCondaChannel) + conda-build . --output-folder "$(Agent.BuildDirectory)/conda/output/${{ artifact.name }}" -c $(AzureSDKCondaChannel) displayName: 'Activate Conda Environment and Build ${{ artifact.name }}' workingDirectory: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }} diff --git a/eng/tox/tox_conda.ini b/eng/tox/tox_conda.ini deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/scripts/devops_tasks/test_conda_artifacts.py b/scripts/devops_tasks/test_conda_artifacts.py new file mode 100644 index 000000000000..cba0561be287 --- /dev/null +++ b/scripts/devops_tasks/test_conda_artifacts.py @@ -0,0 +1,347 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# Used to test conda artifacts generated by build_conda_artifacts + + +import argparse +import sys +import os +import shutil +import re +import yaml + +from common_tasks import process_glob_string, run_check_call, str_to_bool, parse_setup +from subprocess import check_call +from distutils.dir_util import copy_tree + +VERSION_REGEX = re.compile(r"\s*AZURESDK_CONDA_VERSION\s*:\s*[\'](.*)[\']\s*") + +SUMMARY_TEMPLATE = "- Generated from {}." + +NAMESPACE_EXTENSION_TEMPLATE = """__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str +""" + +MANIFEST_TEMPLATE = """include *.md +{namespace_includes} +recursive-include tests *.py +recursive-include samples *.py *.md +""" + +SETUP_CFG = """ +[bdist_wheel] +universal=1 +""" + +CONDA_PKG_SETUP_TEMPLATE = """from setuptools import find_packages, setup + +setup( + name=\"{conda_package_name}\", + version=\"{version}\", + description='Microsoft Azure SDK For Python {service} Combined Conda Library', + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/{service}/', + classifiers=[ + "Development Status :: 5 - Production/Stable", + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(), + install_requires=[] +) +""" + + +def create_package(pkg_directory, output_directory): + check_call( + [ + sys.executable, + "setup.py", + "sdist", + "--format", + "zip", + "-d", + output_directory, + ], + cwd=pkg_directory, + ) + + +def create_namespace_extension(target_directory): + with open(os.path.join(target_directory, "__init__.py"), "w") as f: + f.write(NAMESPACE_EXTENSION_TEMPLATE) + + +def get_pkgs_from_build_directory(build_directory, artifact_name): + return [ + os.path.join(build_directory, p) + for p in os.listdir(build_directory) + if p != artifact_name + ] + + +def create_sdist_skeleton(build_directory, artifact_name, common_root): + sdist_directory = os.path.join(build_directory, artifact_name) + + if os.path.exists(sdist_directory): + shutil.rmtree(sdist_directory) + os.makedirs(sdist_directory) + namespaces = common_root.split("/") + + # after the below function, ns_dir will be the target destination for copying from our pkgs_from_consumption + ns_dir = sdist_directory + + for ns in namespaces: + ns_dir = os.path.join(ns_dir, ns) + if not os.path.exists(ns_dir): + os.mkdir(ns_dir) + create_namespace_extension(ns_dir) + + # get all the directories in the build folder, we will pull in all of them + pkgs_for_consumption = get_pkgs_from_build_directory(build_directory, artifact_name) + + print("I see the following packages in the build directory") + print(pkgs_for_consumption) + + for pkg in pkgs_for_consumption: + pkg_till_common_root = os.path.join(pkg, common_root) + + if os.path.exists(pkg_till_common_root): + directories_for_copy = [ + file + for file in os.listdir(pkg_till_common_root) + if os.path.isdir(os.path.join(pkg_till_common_root, file)) + ] + + for directory in directories_for_copy: + src = os.path.join(pkg_till_common_root, directory) + dest = os.path.join(ns_dir, directory) + shutil.copytree(src, dest) + + +def get_version_from_config(environment_config): + with open(os.path.abspath((environment_config)), "r") as f: + lines = f.readlines() + for line in lines: + result = VERSION_REGEX.match(line) + if result: + return result.group(1) + return "0.0.0" + + +def get_manifest_includes(common_root): + levels = common_root.split("/") + breadcrumbs = [] + breadcrumb_string = "" + + for ns in levels: + breadcrumb_string += ns + "/" + breadcrumbs.append(breadcrumb_string + "__init__.py") + + return breadcrumbs + + +def create_setup_files( + build_directory, common_root, artifact_name, service, meta_yaml, environment_config +): + sdist_directory = os.path.join(build_directory, artifact_name) + setup_location = os.path.join(sdist_directory, "setup.py") + manifest_location = os.path.join(sdist_directory, "MANIFEST.in") + cfg_location = os.path.join(sdist_directory, "setup.cfg") + + setup_template = CONDA_PKG_SETUP_TEMPLATE.format( + conda_package_name=artifact_name, + version=get_version_from_config(environment_config), + service=service, + package_excludes="'azure', 'tests', '{}'".format(common_root.replace("/", ".")), + ) + + with open(setup_location, "w") as f: + f.write(setup_template) + + manifest_template = MANIFEST_TEMPLATE.format( + namespace_includes="\n".join( + ["include " + ns for ns in get_manifest_includes(common_root)] + ) + ) + + with open(manifest_location, "w") as f: + f.write(manifest_template) + + with open(cfg_location, "w") as f: + f.write(SETUP_CFG) + + +def create_combined_sdist( + output_directory, + build_directory, + artifact_name, + common_root, + service, + meta_yaml, + environment_config, +): + singular_dependency = ( + len(get_pkgs_from_build_directory(build_directory, artifact_name)) == 0 + ) + + if not singular_dependency: + create_sdist_skeleton(build_directory, artifact_name, common_root) + create_setup_files( + build_directory, + common_root, + artifact_name, + service, + meta_yaml, + environment_config, + ) + + sdist_location = os.path.join(build_directory, artifact_name) + + output_sdist_location = os.path.join(output_directory, "sdist", artifact_name) + + create_package(sdist_location, output_sdist_location) + output_location = os.path.join( + output_sdist_location, os.listdir(output_sdist_location)[0] + ) + + print( + "Generated Sdist for artifact {} is present at {}".format( + artifact_name, output_location + ) + ) + return output_location + + +def get_summary(ci_yml, artifact_name): + pkg_list = [] + with open(ci_yml, "r") as f: + data = f.read() + + config = yaml.safe_load(data) + + conda_artifact = [ + conda_artifact + for conda_artifact in config["extends"]["parameters"]["CondaArtifacts"] + if conda_artifact["name"] == artifact_name + ] + + if conda_artifact: + dependencies = conda_artifact[0]["checkout"] + + for dep in dependencies: + pkg_list.append("{}=={}".format(dep["package"], dep["version"])) + + return SUMMARY_TEMPLATE.format(", ".join(pkg_list)) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Build a Conda Package, given a properly formatted build directory, and input configuration. This script assumes that the build directory has been set up w/ the necessary sdists in each location." + ) + + parser.add_argument( + "-d", + "--distribution-directory", + dest="distribution_directory", + help="The output conda sdist will be dropped into this directory under a folder named the same as argument artifact_name.", + required=True, + ) + + parser.add_argument( + "-b", + "--build-directory", + dest="build_directory", + help="The 'working' directory. This top level path will contain all the necessary sdist code from the appropriate historical tag. EG: /azure-storage-blob, Date: Mon, 26 Apr 2021 20:47:54 -0700 Subject: [PATCH 003/126] add build and test --- eng/pipelines/templates/jobs/ci.tests.yml | 17 ++++ eng/pipelines/templates/jobs/ci.yml | 1 + .../stages/archetype-conda-release.yml | 25 ++++- eng/pipelines/templates/steps/test-conda.yml | 95 +++++++++++++++++++ 4 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 eng/pipelines/templates/steps/test-conda.yml diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 86ace67ed00d..02de9485f6a9 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -31,6 +31,9 @@ parameters: - name: CloudConfig type: object default: {} + - name: CondaArtifacts + type: object + default: [] jobs: - job: @@ -110,3 +113,17 @@ jobs: parameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} BuildTargetingString: ${{ parameters.BuildTargetingString }} + + - template: ../steps/test-conda.yml + parameters: + CondaArtifacts: ${{ parameters.CondaArtifacts }} + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + OSVmImage: $(OSVmImage) + PythonVersion: $(PythonVersion) + CondaArtifacts: ${{ parameters.CondaArtifacts }} + BeforeTestSteps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'conda' + targetPath: $(Build.ArtifactStagingDirectory) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 3bb4d7ede674..e8bd6656d291 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -123,6 +123,7 @@ jobs: TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} ToxEnvParallel: ${{ parameters.ToxEnvParallel }} InjectedPackages: ${{ parameters.InjectedPackages }} + CondaArtifacts: ${{ parameters.CondaArtifacts}} - job: 'RunRegression' condition: and(succeededOrFailed(), or(eq(variables['Run.Regression'], 'true'), and(eq(variables['Build.Reason'], 'Schedule'), eq(variables['System.TeamProject'],'internal')))) diff --git a/eng/pipelines/templates/stages/archetype-conda-release.yml b/eng/pipelines/templates/stages/archetype-conda-release.yml index ff9da7fda525..454cc36a7663 100644 --- a/eng/pipelines/templates/stages/archetype-conda-release.yml +++ b/eng/pipelines/templates/stages/archetype-conda-release.yml @@ -9,7 +9,7 @@ parameters: stages: - ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}: - ${{ each artifact in parameters.CondaArtifacts }}: - - stage: Release_${{ replace(artifact.name, '-', '_') }} + - stage: Release_${{ replace(artifact.name, '-', '_') }}_To_Blob displayName: 'Conda Release: ${{artifact.name}}' dependsOn: ${{parameters.DependsOn}} condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-python-pr')) @@ -32,3 +32,26 @@ stages: Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}} workingDirectory: $(Pipeline.Workspace) displayName: Output Visible Conda Artifacts + - stage: Test_${{ replace(artifact.name, '-', '_') }}_Distribution + displayName: 'Conda Release: ${{artifact.name}}' + dependsOn: Release_${{ replace(artifact.name, '-', '_') }}_To_Blob + condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-python-pr')) + jobs: + - deployment: CondaTest + displayName: "Test" + condition: ne(variables['Skip.TagRepository'], 'true') + environment: pypi + + pool: + name: azsdk-pool-mms-ubuntu-1804-general + vmImage: MMSUbuntu18.04 + + strategy: + runOnce: + deploy: + steps: + - checkout: self + - pwsh: | + Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}} + workingDirectory: $(Pipeline.Workspace) + displayName: Output Visible Conda Artifacts \ No newline at end of file diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml new file mode 100644 index 000000000000..044d1fbe1aba --- /dev/null +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -0,0 +1,95 @@ +parameters: + - name: TestPipeline + type: boolean + default: false + - name: ServiceDirectory + type: string + default: '' + - name: CondaArtifacts + type: object + default: [] + - name: TestMarkArgument + type: string + default: '' + - name: PythonVersion + type: string + default: '' + - name: OSVmImage + type: string + default: '' + +steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'conda' + targetPath: $(Build.ArtifactStagingDirectory) + + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "azure-template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} + + - task: UsePythonVersion@0 + displayName: 'Use Python $(PythonVersion)' + inputs: + versionSpec: $(PythonVersion) + + - ${{ each artifact in parameters.CondaArtifacts }}: + # there may be multiple CondaArtifacts. Be certain $(conda.build) is clean just in case! + - pwsh: + Write-Host "Clean up Conda Build Directory $(conda.build)" + Remove-Item $(conda.build)/* -Recurse -Force + displayName: 'Clean Up Before Building ${{ artifact.name }}' + + - ${{ each checkout in artifact.checkout }}: + - template: /eng/pipelines/templates/steps/get-tagged-code.yml + parameters: + DestinationDirectory: $(conda.build)/${{checkout.package}} + Package: ${{checkout.package}} + CheckoutPath: ${{checkout.checkout_path}} + Version: ${{checkout.version}} + + - task: PythonScript@0 + displayName: 'Build Source Distribution for ${{ artifact.name }}' + inputs: + scriptPath: 'scripts/devops_tasks/build_conda_artifacts.py' + arguments: >- + -d "$(conda.output)" + -b "$(conda.build)" + -m "$(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/${{ artifact.meta_source }}" + -r "${{ artifact.common_root }}" + -n "${{ artifact.name }}" + -s "${{ parameters.ServiceDirectory }}" + -e "$(Build.SourcesDirectory)/eng/conda_env.yml" + -c "$(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/ci.yml" + + - bash: | + echo "##vso[task.prependpath]$CONDA/bin" + displayName: 'Prepend PATH with Conda and INIT' + + - bash: | + conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} + conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml + displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' + + - bash: | + source activate ${{ artifact.name }} + pip install -r eng/ci_tools.txt + conda install {{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} + displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' + workingDirectory: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }} + + - ${{ each checkout in artifact.checkout }}: + - bash: | + source activate ${{ artifact.name }} + pip install -r dev_requirements.txt + pytest . + displayName: 'Run tests for ' + workingDirectory: $(Build.SourcesDirectory)/sdk/${{ checkout.path }}/${{ checkout.package }} + + - bash: | + source activate ${{ artifact.name }} + displayName: 'Activate Conda Environment and Build ${{ artifact.name }}' + workingDirectory: $(Build.SourcesDirectory) + From ab4bdc941fb6451f0785fb74ed021c1b07f1a487 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 16:22:21 -0700 Subject: [PATCH 004/126] removing beforeteststeps --- eng/pipelines/templates/jobs/ci.tests.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 02de9485f6a9..6372325324cc 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -122,8 +122,4 @@ jobs: OSVmImage: $(OSVmImage) PythonVersion: $(PythonVersion) CondaArtifacts: ${{ parameters.CondaArtifacts }} - BeforeTestSteps: - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'conda' - targetPath: $(Build.ArtifactStagingDirectory) + From 2955932cb3bea35be8bf92e92bcf14a3dee38b1f Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 16:42:07 -0700 Subject: [PATCH 005/126] remove updates to archetype-conda-release --- .../stages/archetype-conda-release.yml | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-conda-release.yml b/eng/pipelines/templates/stages/archetype-conda-release.yml index 454cc36a7663..350beefd5b1c 100644 --- a/eng/pipelines/templates/stages/archetype-conda-release.yml +++ b/eng/pipelines/templates/stages/archetype-conda-release.yml @@ -32,26 +32,3 @@ stages: Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}} workingDirectory: $(Pipeline.Workspace) displayName: Output Visible Conda Artifacts - - stage: Test_${{ replace(artifact.name, '-', '_') }}_Distribution - displayName: 'Conda Release: ${{artifact.name}}' - dependsOn: Release_${{ replace(artifact.name, '-', '_') }}_To_Blob - condition: and(succeeded(), ne(variables['SetDevVersion'], 'true'), ne(variables['Skip.Release'], 'true'), ne(variables['Build.Repository.Name'], 'Azure/azure-sdk-for-python-pr')) - jobs: - - deployment: CondaTest - displayName: "Test" - condition: ne(variables['Skip.TagRepository'], 'true') - environment: pypi - - pool: - name: azsdk-pool-mms-ubuntu-1804-general - vmImage: MMSUbuntu18.04 - - strategy: - runOnce: - deploy: - steps: - - checkout: self - - pwsh: | - Get-ChildItem -Recurse $(Pipeline.Workspace)/${{parameters.ArtifactName}}/${{artifact.name}} - workingDirectory: $(Pipeline.Workspace) - displayName: Output Visible Conda Artifacts \ No newline at end of file From e64a44ece97ca7459bd2fcea54aee439d506f0b9 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 16:44:11 -0700 Subject: [PATCH 006/126] remove double argument --- eng/pipelines/templates/jobs/ci.tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 6372325324cc..8de711ad091b 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -121,5 +121,4 @@ jobs: TestMarkArgument: ${{ parameters.TestMarkArgument }} OSVmImage: $(OSVmImage) PythonVersion: $(PythonVersion) - CondaArtifacts: ${{ parameters.CondaArtifacts }} From bbe623ae6aa3010bca4527237b26bcf4b0719871 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:15:42 -0700 Subject: [PATCH 007/126] remove extraneous stuff --- eng/pipelines/templates/steps/test-conda.yml | 30 +------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 044d1fbe1aba..3ae20af34adf 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -36,41 +36,13 @@ steps: versionSpec: $(PythonVersion) - ${{ each artifact in parameters.CondaArtifacts }}: - # there may be multiple CondaArtifacts. Be certain $(conda.build) is clean just in case! - - pwsh: - Write-Host "Clean up Conda Build Directory $(conda.build)" - Remove-Item $(conda.build)/* -Recurse -Force - displayName: 'Clean Up Before Building ${{ artifact.name }}' - - - ${{ each checkout in artifact.checkout }}: - - template: /eng/pipelines/templates/steps/get-tagged-code.yml - parameters: - DestinationDirectory: $(conda.build)/${{checkout.package}} - Package: ${{checkout.package}} - CheckoutPath: ${{checkout.checkout_path}} - Version: ${{checkout.version}} - - - task: PythonScript@0 - displayName: 'Build Source Distribution for ${{ artifact.name }}' - inputs: - scriptPath: 'scripts/devops_tasks/build_conda_artifacts.py' - arguments: >- - -d "$(conda.output)" - -b "$(conda.build)" - -m "$(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/${{ artifact.meta_source }}" - -r "${{ artifact.common_root }}" - -n "${{ artifact.name }}" - -s "${{ parameters.ServiceDirectory }}" - -e "$(Build.SourcesDirectory)/eng/conda_env.yml" - -c "$(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/ci.yml" - - bash: | echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - bash: | conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} - conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' - bash: | From 7be9322c57f92e8dfa55e7cc435c761d608b0099 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:25:26 -0700 Subject: [PATCH 008/126] disable doc gen and real test frameworks to speed up the core loop --- eng/pipelines/templates/jobs/ci.tests.yml | 42 +++++++++++------------ sdk/core/ci.yml | 1 + 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 8de711ad091b..58bb43640053 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -91,28 +91,28 @@ jobs: echo "##vso[task.setvariable variable=toxenv]$toxenvvar" displayName: "Set Tox Environment" - - template: ../steps/build-test.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - TestMarkArgument: ${{ parameters.TestMarkArgument }} - AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' - OSVmImage: $(OSVmImage) - CoverageArg: $(CoverageArg) - PythonVersion: $(PythonVersion) - BuildTargetingString: ${{ parameters.BuildTargetingString }} - ToxTestEnv: $(toxenv) - ToxEnvParallel: ${{ parameters.ToxEnvParallel }} - InjectedPackages: $(InjectedPackages) - BeforeTestSteps: - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'packages' - targetPath: $(Build.ArtifactStagingDirectory) + # - template: ../steps/build-test.yml + # parameters: + # ServiceDirectory: ${{ parameters.ServiceDirectory }} + # TestMarkArgument: ${{ parameters.TestMarkArgument }} + # AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' + # OSVmImage: $(OSVmImage) + # CoverageArg: $(CoverageArg) + # PythonVersion: $(PythonVersion) + # BuildTargetingString: ${{ parameters.BuildTargetingString }} + # ToxTestEnv: $(toxenv) + # ToxEnvParallel: ${{ parameters.ToxEnvParallel }} + # InjectedPackages: $(InjectedPackages) + # BeforeTestSteps: + # - task: DownloadPipelineArtifact@2 + # inputs: + # artifactName: 'packages' + # targetPath: $(Build.ArtifactStagingDirectory) - - template: ../steps/set-dev-build.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - BuildTargetingString: ${{ parameters.BuildTargetingString }} + # - template: ../steps/set-dev-build.yml + # parameters: + # ServiceDirectory: ${{ parameters.ServiceDirectory }} + # BuildTargetingString: ${{ parameters.BuildTargetingString }} - template: ../steps/test-conda.yml parameters: diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index d3800432f4ba..85d79e25dcbe 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -31,6 +31,7 @@ pr: extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + GenerateDocs: false parameters: ServiceDirectory: core Artifacts: From f00e054fc4e8949484d4066cef73c655e1bef158 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:31:47 -0700 Subject: [PATCH 009/126] undo changes to core/ci.yml so as to not trigger the world --- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- sdk/core/ci.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index c37d5581f11a..916a66057c62 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: true + default: false - name: DevFeedName type: string default: public/azure-sdk-for-python diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 85d79e25dcbe..d3800432f4ba 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -31,7 +31,6 @@ pr: extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml - GenerateDocs: false parameters: ServiceDirectory: core Artifacts: From 0c658f156589de25dcd69e947e072397d295068c Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:47:15 -0700 Subject: [PATCH 010/126] can't use conda index without conda build --- eng/pipelines/templates/steps/test-conda.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 3ae20af34adf..8fbd95c51cb8 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -40,9 +40,14 @@ steps: echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' + - pwsh: | + Write-Host Get-ChildItem $(Build.ArtifactStagingDirectory)/conda -R + displayName: 'Prepend PATH with Conda and INIT' + - bash: | + conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda install --yes --quiet --name ${{ artifact.name }} conda-build conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} - conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' - bash: | From 00a229ff06370677b7386981fcb9a8d5bbbb2c77 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 20:01:40 -0700 Subject: [PATCH 011/126] clean up --- eng/pipelines/templates/steps/test-conda.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 8fbd95c51cb8..eb7d67831997 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -35,15 +35,15 @@ steps: inputs: versionSpec: $(PythonVersion) + - pwsh: | + Get-ChildItem $(Build.ArtifactStagingDirectory) -R + displayName: 'Dump contents of the artifact staging directory' + - ${{ each artifact in parameters.CondaArtifacts }}: - bash: | echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - pwsh: | - Write-Host Get-ChildItem $(Build.ArtifactStagingDirectory)/conda -R - displayName: 'Prepend PATH with Conda and INIT' - - bash: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --yes --quiet --name ${{ artifact.name }} conda-build @@ -55,7 +55,6 @@ steps: pip install -r eng/ci_tools.txt conda install {{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - workingDirectory: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }} - ${{ each checkout in artifact.checkout }}: - bash: | @@ -64,9 +63,3 @@ steps: pytest . displayName: 'Run tests for ' workingDirectory: $(Build.SourcesDirectory)/sdk/${{ checkout.path }}/${{ checkout.package }} - - - bash: | - source activate ${{ artifact.name }} - displayName: 'Activate Conda Environment and Build ${{ artifact.name }}' - workingDirectory: $(Build.SourcesDirectory) - From 088df5064ec02824bc927b491641cb21c55baa3c Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 20:18:54 -0700 Subject: [PATCH 012/126] change locations --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index eb7d67831997..d6db3dc4d16f 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,9 +45,9 @@ steps: displayName: 'Prepend PATH with Conda and INIT' - bash: | - conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml - conda install --yes --quiet --name ${{ artifact.name }} conda-build + conda install --yes --quiet --name conda-build conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} + conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' - bash: | From b6e75cd0973a83f40d8b8d30ee9a8ce74596f366 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 20:27:32 -0700 Subject: [PATCH 013/126] remove erroneous targeting --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d6db3dc4d16f..8ff6e6667e20 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,7 +45,7 @@ steps: displayName: 'Prepend PATH with Conda and INIT' - bash: | - conda install --yes --quiet --name conda-build + conda install --yes --quiet conda-build conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' From 9effa73c3c369604889a3a04e3b1cd936aae456e Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 20:43:42 -0700 Subject: [PATCH 014/126] properly activate the environment so we have write access to it --- eng/pipelines/templates/steps/test-conda.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 8ff6e6667e20..0840149e2896 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,9 +45,10 @@ steps: displayName: 'Prepend PATH with Conda and INIT' - bash: | - conda install --yes --quiet conda-build - conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda install --name ${{ artifact.name }} --yes --quiet conda-build + source activate ${{ artifact.name }} + conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' - bash: | From 028b7574b349ba5221bf7005ab29f50ec9feb70e Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 22:27:18 -0700 Subject: [PATCH 015/126] build --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 0840149e2896..5e4bd4c53ed9 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -48,7 +48,7 @@ steps: conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build source activate ${{ artifact.name }} - conda index $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} + conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' - bash: | From c25490197b29a02ae814c70b1e2bdcf8a4f5c203 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 27 Apr 2021 22:45:28 -0700 Subject: [PATCH 016/126] get bad conda naming out of install --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 5e4bd4c53ed9..e47dfbe81cdd 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -54,7 +54,7 @@ steps: - bash: | source activate ${{ artifact.name }} pip install -r eng/ci_tools.txt - conda install {{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/conda/${{ artifact.name }} + conda install {{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - ${{ each checkout in artifact.checkout }}: From f33f1f65c505603c7d0d3cc67f3159be6939aa3f Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Tue, 27 Apr 2021 23:48:13 -0700 Subject: [PATCH 017/126] install the actual artifact --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index e47dfbe81cdd..df56b78755e0 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -54,7 +54,7 @@ steps: - bash: | source activate ${{ artifact.name }} pip install -r eng/ci_tools.txt - conda install {{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} + conda install ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - ${{ each checkout in artifact.checkout }}: From 0acc7d0e689d972487a95b4f8e906344ab455678 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 10:56:52 -0700 Subject: [PATCH 018/126] move meta.yml into its own folder. change working directory for creating conda package --- eng/conda_env.yml | 2 +- eng/pipelines/templates/steps/build-conda-artifacts.yml | 2 +- scripts/devops_tasks/build_conda_artifacts.py | 2 +- sdk/core/ci.yml | 2 +- sdk/core/{ => conda-recipe}/meta.yaml | 0 5 files changed, 4 insertions(+), 4 deletions(-) rename sdk/core/{ => conda-recipe}/meta.yaml (100%) diff --git a/eng/conda_env.yml b/eng/conda_env.yml index 960c090a9339..4c674de246a3 100644 --- a/eng/conda_env.yml +++ b/eng/conda_env.yml @@ -1,2 +1,2 @@ variables: - AZURESDK_CONDA_VERSION: '2021.05.01' + AZURESDK_CONDA_VERSION: '2021.05.01b1' diff --git a/eng/pipelines/templates/steps/build-conda-artifacts.yml b/eng/pipelines/templates/steps/build-conda-artifacts.yml index e7f9bd53d485..3881062f5063 100644 --- a/eng/pipelines/templates/steps/build-conda-artifacts.yml +++ b/eng/pipelines/templates/steps/build-conda-artifacts.yml @@ -76,7 +76,7 @@ steps: source activate ${{ artifact.name }} conda-build . --output-folder "$(Agent.BuildDirectory)/conda/output/${{ artifact.name }}" -c $(AzureSDKCondaChannel) displayName: 'Activate Conda Environment and Build ${{ artifact.name }}' - workingDirectory: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }} + workingDirectory: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}/conda-recipe - template: /eng/common/pipelines/templates/steps/publish-artifact.yml parameters: diff --git a/scripts/devops_tasks/build_conda_artifacts.py b/scripts/devops_tasks/build_conda_artifacts.py index 090932f56192..6f47c9e86087 100644 --- a/scripts/devops_tasks/build_conda_artifacts.py +++ b/scripts/devops_tasks/build_conda_artifacts.py @@ -33,7 +33,7 @@ VERSION_REGEX = re.compile(r"\s*AZURESDK_CONDA_VERSION\s*:\s*[\'](.*)[\']\s*") -SUMMARY_TEMPLATE = "- Generated from {}." +SUMMARY_TEMPLATE = " - Generated from {}." NAMESPACE_EXTENSION_TEMPLATE = """__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str """ diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index d3800432f4ba..8aec1202e559 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -46,7 +46,7 @@ extends: safeName: azurecommon CondaArtifacts: - name: azure-core - meta_source: meta.yaml + meta_source: recipe/meta.yaml common_root: azure checkout: - package: azure-core diff --git a/sdk/core/meta.yaml b/sdk/core/conda-recipe/meta.yaml similarity index 100% rename from sdk/core/meta.yaml rename to sdk/core/conda-recipe/meta.yaml From 1a83adcb24094ffcfc9c0973ca0ab52a34b64086 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 11:54:32 -0700 Subject: [PATCH 019/126] it's hanging waiting for user intervention. need to apply argument --yes to conda install of artifact --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index df56b78755e0..2a2fa56f9e32 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -54,7 +54,7 @@ steps: - bash: | source activate ${{ artifact.name }} pip install -r eng/ci_tools.txt - conda install ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - ${{ each checkout in artifact.checkout }}: From b21ab2610aa6e31b4fb960d287e12adb73de79bb Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 12:09:56 -0700 Subject: [PATCH 020/126] get the working directory correct. almost ready to pytest! --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 2a2fa56f9e32..6fb3fc19cfcc 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -62,5 +62,5 @@ steps: source activate ${{ artifact.name }} pip install -r dev_requirements.txt pytest . - displayName: 'Run tests for ' - workingDirectory: $(Build.SourcesDirectory)/sdk/${{ checkout.path }}/${{ checkout.package }} + displayName: 'Run tests for ${{ checkout.package }}' + workingDirectory: $(Build.SourcesDirectory)/${{ checkout.checkout_path }}/${{ checkout.package }} From 798cefb7e547d79dec016a93d9c6032a10505095 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 12:35:53 -0700 Subject: [PATCH 021/126] need to run tests _as they were_ --- eng/pipelines/templates/steps/test-conda.yml | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 6fb3fc19cfcc..22425bc966a6 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -57,10 +57,30 @@ steps: conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' + - pwsh: | + mkdir $(Agent.BuildDirectory)/conda/ + Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" + displayName: 'Create Conda Working Directory for Testing' + - ${{ each checkout in artifact.checkout }}: + - pwsh: + Write-Host "Clean up Conda Build Directory $(conda.build)" + Remove-Item $(conda.build)/* -Recurse -Force + displayName: 'Clean Up Before Testing ${{ artifact.name }}' + + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - "${{ checkout.CheckoutPath }}/${{ checkout.Package }}" + Repositories: + - Name: "Azure/azure-sdk-for-python" + Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" + WorkingDirectory: "$(conda.build)" + SkipDefaultCheckout: true + - bash: | source activate ${{ artifact.name }} pip install -r dev_requirements.txt pytest . displayName: 'Run tests for ${{ checkout.package }}' - workingDirectory: $(Build.SourcesDirectory)/${{ checkout.checkout_path }}/${{ checkout.package }} + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From d07e7a699f7975657b6210249c6210408d90f006 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 12:57:25 -0700 Subject: [PATCH 022/126] find paths --- eng/pipelines/templates/steps/test-conda.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 22425bc966a6..c52802512199 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -35,10 +35,6 @@ steps: inputs: versionSpec: $(PythonVersion) - - pwsh: | - Get-ChildItem $(Build.ArtifactStagingDirectory) -R - displayName: 'Dump contents of the artifact staging directory' - - ${{ each artifact in parameters.CondaArtifacts }}: - bash: | echo "##vso[task.prependpath]$CONDA/bin" @@ -78,6 +74,10 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true + - pwsh: | + Get-ChildItem $(conda.build) -R + displayName: 'Dump contents of the artifact staging directory' + - bash: | source activate ${{ artifact.name }} pip install -r dev_requirements.txt From 976c1ad456da367ee47ac421fda05d42d94be135 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:09:21 -0700 Subject: [PATCH 023/126] correct the path being pass --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index c52802512199..8fbd03055341 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -67,7 +67,7 @@ steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: Paths: - - "${{ checkout.CheckoutPath }}/${{ checkout.Package }}" + - "${{ checkout.checkout_path }}/${{ checkout.package }}" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" From b2cbe75c48ac51874e8bc700e377d833bd7d91e8 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:23:36 -0700 Subject: [PATCH 024/126] install tools from correct directory --- eng/pipelines/templates/steps/test-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 8fbd03055341..acfc63fb555e 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -68,6 +68,7 @@ steps: parameters: Paths: - "${{ checkout.checkout_path }}/${{ checkout.package }}" + - "tools/" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" From 4aabe9e27061ab2e7eb8bfbb51655edf2a69b0c6 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:41:22 -0700 Subject: [PATCH 025/126] update storage to store meta.yml in its own folder --- eng/pipelines/templates/steps/test-conda.yml | 11 ++++++++--- sdk/storage/ci.yml | 2 +- sdk/storage/{ => conda-recipe}/meta.yaml | 0 3 files changed, 9 insertions(+), 4 deletions(-) rename sdk/storage/{ => conda-recipe}/meta.yaml (100%) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index acfc63fb555e..05fc8dd1c7d0 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,12 +45,11 @@ steps: conda install --name ${{ artifact.name }} --yes --quiet conda-build source activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} - displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Artifact' + displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - bash: | source activate ${{ artifact.name }} pip install -r eng/ci_tools.txt - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | @@ -82,6 +81,12 @@ steps: - bash: | source activate ${{ artifact.name }} pip install -r dev_requirements.txt + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes + displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + + - bash: | + source activate ${{ artifact.name }} pytest . - displayName: 'Run tests for ${{ checkout.package }}' + displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index cb7389b84345..57d6db8ab90d 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -58,7 +58,7 @@ extends: safeName: azuremgmtstorageimportexport CondaArtifacts: - name: azure-storage - meta_source: meta.yaml + meta_source: conda-recipe/meta.yaml common_root: azure/storage checkout: - package: azure-storage-blob diff --git a/sdk/storage/meta.yaml b/sdk/storage/conda-recipe/meta.yaml similarity index 100% rename from sdk/storage/meta.yaml rename to sdk/storage/conda-recipe/meta.yaml From ba0e9dce5481caef4b05edccc1589a75849a259f Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 14:16:47 -0700 Subject: [PATCH 026/126] first attempt at crossplat solution --- eng/pipelines/templates/steps/test-conda.yml | 34 ++++++++++++-------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 05fc8dd1c7d0..5e32b35ccebc 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -36,19 +36,25 @@ steps: versionSpec: $(PythonVersion) - ${{ each artifact in parameters.CondaArtifacts }}: - - bash: | + - script: | echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - bash: | + - script: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build - source activate ${{ artifact.name }} + ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + source activate ${{ artifact.name }} + ${{ if contains(parameters.OSVmImage, 'windows') }}: + call activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - - bash: | - source activate ${{ artifact.name }} + - script: | + ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + source activate ${{ artifact.name }} + ${{ if contains(parameters.OSVmImage, 'windows') }}: + call activate ${{ artifact.name }} pip install -r eng/ci_tools.txt displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -74,19 +80,21 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true - - pwsh: | - Get-ChildItem $(conda.build) -R - displayName: 'Dump contents of the artifact staging directory' - - - bash: | - source activate ${{ artifact.name }} + - script: | + ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + source activate ${{ artifact.name }} + ${{ if contains(parameters.OSVmImage, 'windows') }}: + call activate ${{ artifact.name }} pip install -r dev_requirements.txt conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - bash: | - source activate ${{ artifact.name }} + - script: | + ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + source activate ${{ artifact.name }} + ${{ if contains(parameters.OSVmImage, 'windows') }}: + call activate ${{ artifact.name }} pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 99cba749ddd65653496b79b75c18947a80aefde5 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 14:24:51 -0700 Subject: [PATCH 027/126] Revert "first attempt at crossplat solution" This reverts commit ba0e9dce5481caef4b05edccc1589a75849a259f. --- eng/pipelines/templates/steps/test-conda.yml | 34 ++++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 5e32b35ccebc..05fc8dd1c7d0 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -36,25 +36,19 @@ steps: versionSpec: $(PythonVersion) - ${{ each artifact in parameters.CondaArtifacts }}: - - script: | + - bash: | echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - script: | + - bash: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: - source activate ${{ artifact.name }} - ${{ if contains(parameters.OSVmImage, 'windows') }}: - call activate ${{ artifact.name }} + source activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - - script: | - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: - source activate ${{ artifact.name }} - ${{ if contains(parameters.OSVmImage, 'windows') }}: - call activate ${{ artifact.name }} + - bash: | + source activate ${{ artifact.name }} pip install -r eng/ci_tools.txt displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -80,21 +74,19 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true - - script: | - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: - source activate ${{ artifact.name }} - ${{ if contains(parameters.OSVmImage, 'windows') }}: - call activate ${{ artifact.name }} + - pwsh: | + Get-ChildItem $(conda.build) -R + displayName: 'Dump contents of the artifact staging directory' + + - bash: | + source activate ${{ artifact.name }} pip install -r dev_requirements.txt conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - script: | - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: - source activate ${{ artifact.name }} - ${{ if contains(parameters.OSVmImage, 'windows') }}: - call activate ${{ artifact.name }} + - bash: | + source activate ${{ artifact.name }} pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 6fa0220551017dc9e0c5e32e951e08f0ee3f2cd8 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 14:34:26 -0700 Subject: [PATCH 028/126] handle cross-plat --- eng/pipelines/templates/steps/test-conda.yml | 29 +++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 05fc8dd1c7d0..10d0c3cae7c5 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -35,20 +35,27 @@ steps: inputs: versionSpec: $(PythonVersion) + - pwsh: | + $activateMethod = "source" + if ($IsWindows) { $activateMethod = "call" } + + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" + displayName: 'Evaluate OS Specific Activate Parameter' + - ${{ each artifact in parameters.CondaArtifacts }}: - - bash: | + - script: | echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - bash: | + - script: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build - source activate ${{ artifact.name }} + $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - - bash: | - source activate ${{ artifact.name }} + - script: | + $(activate.method) activate ${{ artifact.name }} pip install -r eng/ci_tools.txt displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -74,19 +81,15 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true - - pwsh: | - Get-ChildItem $(conda.build) -R - displayName: 'Dump contents of the artifact staging directory' - - - bash: | - source activate ${{ artifact.name }} + - script: | + $(activate.method) activate ${{ artifact.name }} pip install -r dev_requirements.txt conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - bash: | - source activate ${{ artifact.name }} + - script: | + $(activate.method) activate ${{ artifact.name }} pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From ec3612594e6e9ad2d9541d229ace43a40e625fd6 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 14:51:49 -0700 Subject: [PATCH 029/126] we need to add a different scripts directory on windows vs ubuntu/mac --- eng/pipelines/templates/steps/test-conda.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 10d0c3cae7c5..e2ecb5281d2c 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -43,9 +43,17 @@ steps: displayName: 'Evaluate OS Specific Activate Parameter' - ${{ each artifact in parameters.CondaArtifacts }}: - - script: | - echo "##vso[task.prependpath]$CONDA/bin" - displayName: 'Prepend PATH with Conda and INIT' + - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + - script: | + echo "##vso[task.prependpath]$CONDA/bin" + displayName: 'Prepend PATH with Conda and INIT' + - ${{ if contains(parameters.OSVmImage, 'windows') }}: + - powershell: | + Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + displayName: 'Prepend PATH with Conda and INIT' + + - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + displayName: Add conda to PATH - script: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml @@ -90,6 +98,6 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} - pytest . + python -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From f5f73b1cc7f1fa9a4b05194522a7a1e7b77b078d Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 15:12:08 -0700 Subject: [PATCH 030/126] update pip install for windows such that it will run user specific if necessary --- eng/pipelines/templates/steps/test-conda.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index e2ecb5281d2c..55a018d9b879 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -37,9 +37,14 @@ steps: - pwsh: | $activateMethod = "source" - if ($IsWindows) { $activateMethod = "call" } - + $requirementSuffix = "" + if ($IsWindows) { + $activateMethod = "call" + $requirementSuffix = " --user" + } + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" + Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific Activate Parameter' - ${{ each artifact in parameters.CondaArtifacts }}: @@ -64,7 +69,7 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} - pip install -r eng/ci_tools.txt + pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | From 37487c2ccb60d2f4e73c80f12df398618db913f7 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 15:21:47 -0700 Subject: [PATCH 031/126] remove unnecessary script. some cleanup. time to get these python environments specific --- eng/pipelines/templates/steps/test-conda.yml | 9 +- scripts/devops_tasks/test_conda_artifacts.py | 347 ------------------- 2 files changed, 3 insertions(+), 353 deletions(-) delete mode 100644 scripts/devops_tasks/test_conda_artifacts.py diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 55a018d9b879..2af79c001741 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -53,13 +53,10 @@ steps: echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - ${{ if contains(parameters.OSVmImage, 'windows') }}: - - powershell: | + - pwsh: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: 'Prepend PATH with Conda and INIT' - - powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: Add conda to PATH - - script: | conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build @@ -69,7 +66,7 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} - pip install -r eng/ci_tools.txt $(requirement.suffix) + python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | @@ -96,7 +93,7 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} - pip install -r dev_requirements.txt + python -m pip install -r dev_requirements.txt conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} diff --git a/scripts/devops_tasks/test_conda_artifacts.py b/scripts/devops_tasks/test_conda_artifacts.py deleted file mode 100644 index cba0561be287..000000000000 --- a/scripts/devops_tasks/test_conda_artifacts.py +++ /dev/null @@ -1,347 +0,0 @@ -#!/usr/bin/env python - -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------------------------- - -# Used to test conda artifacts generated by build_conda_artifacts - - -import argparse -import sys -import os -import shutil -import re -import yaml - -from common_tasks import process_glob_string, run_check_call, str_to_bool, parse_setup -from subprocess import check_call -from distutils.dir_util import copy_tree - -VERSION_REGEX = re.compile(r"\s*AZURESDK_CONDA_VERSION\s*:\s*[\'](.*)[\']\s*") - -SUMMARY_TEMPLATE = "- Generated from {}." - -NAMESPACE_EXTENSION_TEMPLATE = """__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str -""" - -MANIFEST_TEMPLATE = """include *.md -{namespace_includes} -recursive-include tests *.py -recursive-include samples *.py *.md -""" - -SETUP_CFG = """ -[bdist_wheel] -universal=1 -""" - -CONDA_PKG_SETUP_TEMPLATE = """from setuptools import find_packages, setup - -setup( - name=\"{conda_package_name}\", - version=\"{version}\", - description='Microsoft Azure SDK For Python {service} Combined Conda Library', - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/{service}/', - classifiers=[ - "Development Status :: 5 - Production/Stable", - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'License :: OSI Approved :: MIT License', - ], - zip_safe=False, - packages=find_packages(), - install_requires=[] -) -""" - - -def create_package(pkg_directory, output_directory): - check_call( - [ - sys.executable, - "setup.py", - "sdist", - "--format", - "zip", - "-d", - output_directory, - ], - cwd=pkg_directory, - ) - - -def create_namespace_extension(target_directory): - with open(os.path.join(target_directory, "__init__.py"), "w") as f: - f.write(NAMESPACE_EXTENSION_TEMPLATE) - - -def get_pkgs_from_build_directory(build_directory, artifact_name): - return [ - os.path.join(build_directory, p) - for p in os.listdir(build_directory) - if p != artifact_name - ] - - -def create_sdist_skeleton(build_directory, artifact_name, common_root): - sdist_directory = os.path.join(build_directory, artifact_name) - - if os.path.exists(sdist_directory): - shutil.rmtree(sdist_directory) - os.makedirs(sdist_directory) - namespaces = common_root.split("/") - - # after the below function, ns_dir will be the target destination for copying from our pkgs_from_consumption - ns_dir = sdist_directory - - for ns in namespaces: - ns_dir = os.path.join(ns_dir, ns) - if not os.path.exists(ns_dir): - os.mkdir(ns_dir) - create_namespace_extension(ns_dir) - - # get all the directories in the build folder, we will pull in all of them - pkgs_for_consumption = get_pkgs_from_build_directory(build_directory, artifact_name) - - print("I see the following packages in the build directory") - print(pkgs_for_consumption) - - for pkg in pkgs_for_consumption: - pkg_till_common_root = os.path.join(pkg, common_root) - - if os.path.exists(pkg_till_common_root): - directories_for_copy = [ - file - for file in os.listdir(pkg_till_common_root) - if os.path.isdir(os.path.join(pkg_till_common_root, file)) - ] - - for directory in directories_for_copy: - src = os.path.join(pkg_till_common_root, directory) - dest = os.path.join(ns_dir, directory) - shutil.copytree(src, dest) - - -def get_version_from_config(environment_config): - with open(os.path.abspath((environment_config)), "r") as f: - lines = f.readlines() - for line in lines: - result = VERSION_REGEX.match(line) - if result: - return result.group(1) - return "0.0.0" - - -def get_manifest_includes(common_root): - levels = common_root.split("/") - breadcrumbs = [] - breadcrumb_string = "" - - for ns in levels: - breadcrumb_string += ns + "/" - breadcrumbs.append(breadcrumb_string + "__init__.py") - - return breadcrumbs - - -def create_setup_files( - build_directory, common_root, artifact_name, service, meta_yaml, environment_config -): - sdist_directory = os.path.join(build_directory, artifact_name) - setup_location = os.path.join(sdist_directory, "setup.py") - manifest_location = os.path.join(sdist_directory, "MANIFEST.in") - cfg_location = os.path.join(sdist_directory, "setup.cfg") - - setup_template = CONDA_PKG_SETUP_TEMPLATE.format( - conda_package_name=artifact_name, - version=get_version_from_config(environment_config), - service=service, - package_excludes="'azure', 'tests', '{}'".format(common_root.replace("/", ".")), - ) - - with open(setup_location, "w") as f: - f.write(setup_template) - - manifest_template = MANIFEST_TEMPLATE.format( - namespace_includes="\n".join( - ["include " + ns for ns in get_manifest_includes(common_root)] - ) - ) - - with open(manifest_location, "w") as f: - f.write(manifest_template) - - with open(cfg_location, "w") as f: - f.write(SETUP_CFG) - - -def create_combined_sdist( - output_directory, - build_directory, - artifact_name, - common_root, - service, - meta_yaml, - environment_config, -): - singular_dependency = ( - len(get_pkgs_from_build_directory(build_directory, artifact_name)) == 0 - ) - - if not singular_dependency: - create_sdist_skeleton(build_directory, artifact_name, common_root) - create_setup_files( - build_directory, - common_root, - artifact_name, - service, - meta_yaml, - environment_config, - ) - - sdist_location = os.path.join(build_directory, artifact_name) - - output_sdist_location = os.path.join(output_directory, "sdist", artifact_name) - - create_package(sdist_location, output_sdist_location) - output_location = os.path.join( - output_sdist_location, os.listdir(output_sdist_location)[0] - ) - - print( - "Generated Sdist for artifact {} is present at {}".format( - artifact_name, output_location - ) - ) - return output_location - - -def get_summary(ci_yml, artifact_name): - pkg_list = [] - with open(ci_yml, "r") as f: - data = f.read() - - config = yaml.safe_load(data) - - conda_artifact = [ - conda_artifact - for conda_artifact in config["extends"]["parameters"]["CondaArtifacts"] - if conda_artifact["name"] == artifact_name - ] - - if conda_artifact: - dependencies = conda_artifact[0]["checkout"] - - for dep in dependencies: - pkg_list.append("{}=={}".format(dep["package"], dep["version"])) - - return SUMMARY_TEMPLATE.format(", ".join(pkg_list)) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Build a Conda Package, given a properly formatted build directory, and input configuration. This script assumes that the build directory has been set up w/ the necessary sdists in each location." - ) - - parser.add_argument( - "-d", - "--distribution-directory", - dest="distribution_directory", - help="The output conda sdist will be dropped into this directory under a folder named the same as argument artifact_name.", - required=True, - ) - - parser.add_argument( - "-b", - "--build-directory", - dest="build_directory", - help="The 'working' directory. This top level path will contain all the necessary sdist code from the appropriate historical tag. EG: /azure-storage-blob, Date: Wed, 28 Apr 2021 15:22:58 -0700 Subject: [PATCH 032/126] ensure that we create conda with the correct python version --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 2af79c001741..c6fe186be14d 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -58,7 +58,7 @@ steps: displayName: 'Prepend PATH with Conda and INIT' - script: | - conda env create --name ${{ artifact.name }} --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From dc6af3acea2ebc73af3ca39314c4c0e35a25aee5 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 15:42:08 -0700 Subject: [PATCH 033/126] apparently moving to pwsh from powershell changes things. somehow --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index c6fe186be14d..ffae214a5f42 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -53,7 +53,7 @@ steps: echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - ${{ if contains(parameters.OSVmImage, 'windows') }}: - - pwsh: | + - powershell: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: 'Prepend PATH with Conda and INIT' From 20810fc44e4749adebef939f8bd4133204888200 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 15:58:02 -0700 Subject: [PATCH 034/126] outputting which version is running --- eng/pipelines/templates/steps/test-conda.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index ffae214a5f42..62efaa2cdaaf 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,18 +45,24 @@ steps: Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - displayName: 'Evaluate OS Specific Activate Parameter' + displayName: 'Evaluate OS Specific Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: - script: | + echo "Prepending with $($CONDA/bin)" echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - ${{ if contains(parameters.OSVmImage, 'windows') }}: - powershell: | + Write-Host "Prepending with $($env:CONDA\Scripts)" Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: 'Prepend PATH with Conda and INIT' + - powershell: | + Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + displayName: 'Prepend PATH with Conda and INIT' + - script: | conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build From 71ea1b6fd7b8d57ab4044c2c4a9224509b878b3f Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 15:58:31 -0700 Subject: [PATCH 035/126] debugging for windows --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 62efaa2cdaaf..c71e8d14c1c3 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -61,7 +61,7 @@ steps: - powershell: | Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: 'Prepend PATH with Conda and INIT' + displayName: 'Prepend PATH with Conda Script Directory' - script: | conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml From d4103f291e801d127ed15b9de1287b3dde6b2894 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 28 Apr 2021 16:11:23 -0700 Subject: [PATCH 036/126] add dumping of environment information --- eng/pipelines/templates/steps/test-conda.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index c71e8d14c1c3..6ab57c5725e6 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -63,6 +63,10 @@ steps: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: 'Prepend PATH with Conda Script Directory' + - powershell: | + Write-Host "$(PythonVersion)" + displayName: 'Dump Python Version Info' + - script: | conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build @@ -75,6 +79,12 @@ steps: python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' + - pwsh: | + mkdir $(Agent.BuildDirectory)/conda/ + Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" + displayName: 'Create Conda Working Directory for Testing' + + - pwsh: | mkdir $(Agent.BuildDirectory)/conda/ Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" From f21baf8ca1c5921b9fb2071e3be6b42f80e3971b Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 18:59:26 -0700 Subject: [PATCH 037/126] removing extra activate --- eng/pipelines/templates/steps/test-conda.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 6ab57c5725e6..5513f2244cc6 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -65,6 +65,7 @@ steps: - powershell: | Write-Host "$(PythonVersion)" + Write-Host $(OSVmImage) displayName: 'Dump Python Version Info' - script: | @@ -79,12 +80,6 @@ steps: python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - - pwsh: | - mkdir $(Agent.BuildDirectory)/conda/ - Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" - displayName: 'Create Conda Working Directory for Testing' - - - pwsh: | mkdir $(Agent.BuildDirectory)/conda/ Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" From 33e1487793020d12ce25cc48cd64ef66dfe94eaf Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 19:17:24 -0700 Subject: [PATCH 038/126] dump additional variables. does windows need to only be activated once? --- eng/pipelines/templates/steps/test-conda.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 5513f2244cc6..d40563e2820a 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -48,24 +48,22 @@ steps: displayName: 'Evaluate OS Specific Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - ${{ if not(contains(parameters.OSVmImage, 'windows')) }}: + - ${{ if not(contains(parameters.OSVmImage, 'MMS2019')) }}: - script: | echo "Prepending with $($CONDA/bin)" echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - ${{ if contains(parameters.OSVmImage, 'windows') }}: + - ${{ if contains(parameters.OSVmImage, 'MMS2019') }}: - powershell: | Write-Host "Prepending with $($env:CONDA\Scripts)" Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" displayName: 'Prepend PATH with Conda and INIT' - - powershell: | - Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: 'Prepend PATH with Conda Script Directory' - - powershell: | Write-Host "$(PythonVersion)" - Write-Host $(OSVmImage) + Write-Host "$(OSVmImage)"" + Write Host "$(activate.method)" + Write-Host "$(requirement.suffix)" displayName: 'Dump Python Version Info' - script: | From fc663d305723c6fa609fb0eddad58f92886cc6e4 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 19:29:06 -0700 Subject: [PATCH 039/126] bad formatting pwsh --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d40563e2820a..90412fe94dbd 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -61,7 +61,7 @@ steps: - powershell: | Write-Host "$(PythonVersion)" - Write-Host "$(OSVmImage)"" + Write-Host "$(OSVmImage)" Write Host "$(activate.method)" Write-Host "$(requirement.suffix)" displayName: 'Dump Python Version Info' From 12f626a51694cbed643c64163d96172773b417c5 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 19:42:46 -0700 Subject: [PATCH 040/126] if we change the order does this thing work? --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 90412fe94dbd..124c6e74cbf1 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -101,9 +101,9 @@ steps: SkipDefaultCheckout: true - script: | + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes $(activate.method) activate ${{ artifact.name }} python -m pip install -r dev_requirements.txt - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 1345a77837f4846f4faf211960237d4c4765f871 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 20:02:30 -0700 Subject: [PATCH 041/126] fixing error --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 124c6e74cbf1..dd4dd164172c 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -62,7 +62,7 @@ steps: - powershell: | Write-Host "$(PythonVersion)" Write-Host "$(OSVmImage)" - Write Host "$(activate.method)" + Write-Host "$(activate.method)" Write-Host "$(requirement.suffix)" displayName: 'Dump Python Version Info' From 52f4d26d51b0386ca12f45779874916933f2b1fb Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 28 Apr 2021 20:42:11 -0700 Subject: [PATCH 042/126] OsVmImage is a variable --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index dd4dd164172c..9c1e3feb2cf2 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -48,12 +48,12 @@ steps: displayName: 'Evaluate OS Specific Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - ${{ if not(contains(parameters.OSVmImage, 'MMS2019')) }}: + - ${{ if not(contains(variables.OSVmImage, 'MMS2019')) }}: - script: | echo "Prepending with $($CONDA/bin)" echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - ${{ if contains(parameters.OSVmImage, 'MMS2019') }}: + - ${{ if contains(variables.OSVmImage, 'MMS2019') }}: - powershell: | Write-Host "Prepending with $($env:CONDA\Scripts)" Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" From ce17d1bba3f327f2c3c4cf52ed267d654379bb8b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 09:43:54 -0700 Subject: [PATCH 043/126] adjusting conditional back to parameter. adding to dump script --- eng/pipelines/templates/steps/test-conda.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 9c1e3feb2cf2..940d1c588839 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -48,12 +48,12 @@ steps: displayName: 'Evaluate OS Specific Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - ${{ if not(contains(variables.OSVmImage, 'MMS2019')) }}: + - ${{ if not(contains(parameters.OSVmImage, 'MMS2019')) }}: - script: | echo "Prepending with $($CONDA/bin)" echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - ${{ if contains(variables.OSVmImage, 'MMS2019') }}: + - ${{ if contains(parameters.OSVmImage, 'MMS2019') }}: - powershell: | Write-Host "Prepending with $($env:CONDA\Scripts)" Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" @@ -61,12 +61,14 @@ steps: - powershell: | Write-Host "$(PythonVersion)" + Write-Host "${{ parameters.OSVmImage }}" Write-Host "$(OSVmImage)" Write-Host "$(activate.method)" Write-Host "$(requirement.suffix)" displayName: 'Dump Python Version Info' - script: | + echo "conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml" conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} From 6044540df7c7c7d98858b4ceb8eb2a0de7a712b7 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:38:09 -0700 Subject: [PATCH 044/126] ensure we are running the python from the environment --- eng/pipelines/templates/steps/test-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 940d1c588839..dc68391a14c2 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -77,6 +77,7 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} + python -c "import sys; print(sys.executable)" python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' From 76b0062e72a5d7f6f2d0b4ffda0ee8b7412d5687 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:40:42 -0700 Subject: [PATCH 045/126] switch from contains to eq --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index dc68391a14c2..e7264e5e0608 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -48,12 +48,12 @@ steps: displayName: 'Evaluate OS Specific Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - ${{ if not(contains(parameters.OSVmImage, 'MMS2019')) }}: + - ${{ if not(eq(parameters.OSVmImage, 'MMS2019')) }}: - script: | echo "Prepending with $($CONDA/bin)" echo "##vso[task.prependpath]$CONDA/bin" displayName: 'Prepend PATH with Conda and INIT' - - ${{ if contains(parameters.OSVmImage, 'MMS2019') }}: + - ${{ if eq(parameters.OSVmImage, 'MMS2019') }}: - powershell: | Write-Host "Prepending with $($env:CONDA\Scripts)" Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" From 0df4a7331cc502ac583efc8af9cdbce3740f6b08 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:49:16 -0700 Subject: [PATCH 046/126] daniel gave assist with wonky parameter expansion --- eng/pipelines/templates/steps/test-conda.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index e7264e5e0608..884d41e5ba7d 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -41,24 +41,19 @@ steps: if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" + Write-Host "Prepending with $($env:CONDA\Scripts)" + Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + } + else { + Write-Host "Prepending with $($CONDA/bin)" + Write-Host "##vso[task.prependpath]$CONDA/bin" } Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - displayName: 'Evaluate OS Specific Parameters' + displayName: 'Evaluate OS Specific PATH and Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - ${{ if not(eq(parameters.OSVmImage, 'MMS2019')) }}: - - script: | - echo "Prepending with $($CONDA/bin)" - echo "##vso[task.prependpath]$CONDA/bin" - displayName: 'Prepend PATH with Conda and INIT' - - ${{ if eq(parameters.OSVmImage, 'MMS2019') }}: - - powershell: | - Write-Host "Prepending with $($env:CONDA\Scripts)" - Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" - displayName: 'Prepend PATH with Conda and INIT' - - powershell: | Write-Host "$(PythonVersion)" Write-Host "${{ parameters.OSVmImage }}" From bfc2fb6658a86a815b181b1575cda0e8f748e3be Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:02:17 -0700 Subject: [PATCH 047/126] easier attempt at prepend --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 884d41e5ba7d..f8b6adef01de 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -41,8 +41,8 @@ steps: if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" - Write-Host "Prepending with $($env:CONDA\Scripts)" - Write-Host "##vso[task.prependpath]$env:CONDA\Scripts" + Write-Host "Prepending with $($env:CONDA/Scripts)" + Write-Host "##vso[task.prependpath]$($env:CONDA/Scripts)" } else { Write-Host "Prepending with $($CONDA/bin)" From 79363e582677953e5424e040af7399f5c5897566 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:15:16 -0700 Subject: [PATCH 048/126] correct pshell call --- eng/pipelines/templates/steps/test-conda.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index f8b6adef01de..7f8c8be5f4c9 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -41,12 +41,12 @@ steps: if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" - Write-Host "Prepending with $($env:CONDA/Scripts)" - Write-Host "##vso[task.prependpath]$($env:CONDA/Scripts)" + Write-Host "Prepending with $($env:CONDA)/Scripts" + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } else { - Write-Host "Prepending with $($CONDA/bin)" - Write-Host "##vso[task.prependpath]$CONDA/bin" + Write-Host "Prepending with $($env:CONDA)/bin" + Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" } Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" From b4a27afb7f920d9757b710e3e5249061e32b03c1 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:44:56 -0700 Subject: [PATCH 049/126] prepend path with bin and scripts. scripts last. --- eng/pipelines/templates/steps/test-conda.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 7f8c8be5f4c9..2c76c0e2a850 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -41,14 +41,17 @@ steps: if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" - Write-Host "Prepending with $($env:CONDA)/Scripts" - Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + # Write-Host "Prepending with $($env:CONDA)/Scripts" + # Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } else { - Write-Host "Prepending with $($env:CONDA)/bin" - Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" + # Write-Host "Prepending with $($env:CONDA)/bin" + # Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" } + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' From f9e9b1fbc58a4def79448ab3a1d5b3e1b4b5650c Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 16:57:19 -0700 Subject: [PATCH 050/126] try create instead of env create --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 2c76c0e2a850..8555b48b0118 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -49,8 +49,8 @@ steps: # Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" } - Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" @@ -67,7 +67,7 @@ steps: - script: | echo "conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml" - conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From 98c4c00dd1a16f2fbabc95c92972e7b7fcc6e83d Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 17:00:28 -0700 Subject: [PATCH 051/126] change ordering --- eng/pipelines/templates/steps/test-conda.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 8555b48b0118..d0ba69ed3279 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -38,19 +38,20 @@ steps: - pwsh: | $activateMethod = "source" $requirementSuffix = "" + + Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" # Write-Host "Prepending with $($env:CONDA)/Scripts" # Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } else { # Write-Host "Prepending with $($env:CONDA)/bin" # Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" } - Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" - Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" From 8673dc496ad34649d52dd933b5897821bbedae6b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 17:21:13 -0700 Subject: [PATCH 052/126] I think I got it! --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d0ba69ed3279..76dfc6f4e359 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -68,7 +68,7 @@ steps: - script: | echo "conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml" - conda create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml + conda create --name ${{ artifact.name }} python=$(PythonVersion) conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From 71e6b86b0daae1154d5090ff9799f85077a7f519 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:19:07 -0700 Subject: [PATCH 053/126] clean up. --- eng/pipelines/templates/steps/test-conda.yml | 27 +++++++------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 76dfc6f4e359..150185c33253 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -35,40 +35,32 @@ steps: inputs: versionSpec: $(PythonVersion) + - pwsh: | + python -c "import sys; print(sys.executable)" + displayName: Find installed version of pypy3 + - pwsh: | $activateMethod = "source" $requirementSuffix = "" - + + # always need to add conda bin Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { $activateMethod = "call" $requirementSuffix = " --user" - # Write-Host "Prepending with $($env:CONDA)/Scripts" - # Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + + # on windows only, need to prepend with the scripts directory as well Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } - else { - # Write-Host "Prepending with $($env:CONDA)/bin" - # Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" - } - Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: - - powershell: | - Write-Host "$(PythonVersion)" - Write-Host "${{ parameters.OSVmImage }}" - Write-Host "$(OSVmImage)" - Write-Host "$(activate.method)" - Write-Host "$(requirement.suffix)" - displayName: 'Dump Python Version Info' - - script: | echo "conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml" - conda create --name ${{ artifact.name }} python=$(PythonVersion) + conda create --name ${{ artifact.name }} python=$(PythonVersion) --yes conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} @@ -76,7 +68,6 @@ steps: - script: | $(activate.method) activate ${{ artifact.name }} - python -c "import sys; print(sys.executable)" python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' From 7fa1e11ca74c056386414877cbbb5fa2cee0d950 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:31:02 -0700 Subject: [PATCH 054/126] update the platform matrixs to go after pypy3 --- .../stages/platform-matrix-cryptography-dependency.json | 2 +- eng/pipelines/templates/stages/platform-matrix.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json b/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json index 6c61b0415c97..83bb0598d4e5 100644 --- a/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json +++ b/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json @@ -6,7 +6,7 @@ "Agent": { "ubuntu-18.04": { "OSVmImage": "MMSUbuntu18.04", "Pool": "azsdk-pool-mms-ubuntu-1804-general" } }, - "PythonVersion": [ "pypy3", "3.6", "3.7", "3.8", "3.9" ], + "PythonVersion": [ "pypy3.6", "3.6", "3.7", "3.8", "3.9" ], "CoverageArg": "--disablecov" }, "include": [ diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index 1ef5e76aa7e4..45e4a2f11b6d 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -8,7 +8,7 @@ "windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" }, "macOS-10.15": { "OSVmImage": "macOS-10.15", "Pool": "Azure Pipelines" } }, - "PythonVersion": [ "pypy3", "2.7", "3.6", "3.7", "3.8" ], + "PythonVersion": [ "pypy3.7", "2.7", "3.6", "3.7", "3.8" ], "CoverageArg": "--disablecov" }, "include": [ From a0bc94dad94b5bbe59ab0ddbdbb61e9fa87ad0a4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:35:43 -0700 Subject: [PATCH 055/126] output the command we're actually running --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 150185c33253..1ce9d811c111 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -59,7 +59,7 @@ steps: - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda env create --name ${{ artifact.name }} python=$(PythonVersion) --file $(Build.SourcesDirectory)/eng/conda_env.yml" + echo "conda create --name ${{ artifact.name }} python=$(PythonVersion) --yes" conda create --name ${{ artifact.name }} python=$(PythonVersion) --yes conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} From 9ee7daff6a05a84dc0d3ae407a9e6c3a76063636 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 18:53:48 -0700 Subject: [PATCH 056/126] restore pypy3.6 to pypy3. hosted tool cache is named that way --- .../stages/platform-matrix-cryptography-dependency.json | 2 +- eng/pipelines/templates/stages/platform-matrix.json | 2 +- eng/pipelines/templates/steps/test-conda.yml | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json b/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json index 83bb0598d4e5..6c61b0415c97 100644 --- a/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json +++ b/eng/pipelines/templates/stages/platform-matrix-cryptography-dependency.json @@ -6,7 +6,7 @@ "Agent": { "ubuntu-18.04": { "OSVmImage": "MMSUbuntu18.04", "Pool": "azsdk-pool-mms-ubuntu-1804-general" } }, - "PythonVersion": [ "pypy3.6", "3.6", "3.7", "3.8", "3.9" ], + "PythonVersion": [ "pypy3", "3.6", "3.7", "3.8", "3.9" ], "CoverageArg": "--disablecov" }, "include": [ diff --git a/eng/pipelines/templates/stages/platform-matrix.json b/eng/pipelines/templates/stages/platform-matrix.json index 45e4a2f11b6d..1ef5e76aa7e4 100644 --- a/eng/pipelines/templates/stages/platform-matrix.json +++ b/eng/pipelines/templates/stages/platform-matrix.json @@ -8,7 +8,7 @@ "windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" }, "macOS-10.15": { "OSVmImage": "macOS-10.15", "Pool": "Azure Pipelines" } }, - "PythonVersion": [ "pypy3.7", "2.7", "3.6", "3.7", "3.8" ], + "PythonVersion": [ "pypy3", "2.7", "3.6", "3.7", "3.8" ], "CoverageArg": "--disablecov" }, "include": [ diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 1ce9d811c111..61a85b9e4017 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -52,6 +52,12 @@ steps: # on windows only, need to prepend with the scripts directory as well Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } + + # pypy3.7 is not in the hosted tool cache. to use the correct pypy3 version in conda + # we have to patch it to a version that actually does work + if("$(PythonVersion)" -eq "pypy3"){ + Write-Host "##vso[task.setvariable variable=PythonVersion]pypy3.7" + } Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" From 07e767771e82df1984700ea814256422d9d79b09 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 19:07:31 -0700 Subject: [PATCH 057/126] override the python version to use pypy3.7 if necessary --- eng/pipelines/templates/steps/test-conda.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 61a85b9e4017..04a919b145cb 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -56,7 +56,10 @@ steps: # pypy3.7 is not in the hosted tool cache. to use the correct pypy3 version in conda # we have to patch it to a version that actually does work if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PythonVersion]pypy3.7" + Write-Host "##vso[task.setvariable variable=PyVersion]pypy3.7" + } + else { + Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" } Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" @@ -65,8 +68,8 @@ steps: - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda create --name ${{ artifact.name }} python=$(PythonVersion) --yes" - conda create --name ${{ artifact.name }} python=$(PythonVersion) --yes + echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" + conda create --name ${{ artifact.name }} python=$(PyVersion) --yes conda install --name ${{ artifact.name }} --yes --quiet conda-build $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From 71ec768034c76bd74485a08fcc7cf28653f7c0b2 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 29 Apr 2021 19:29:04 -0700 Subject: [PATCH 058/126] go after conda forge. last remaining item is to get the order of ops right --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 04a919b145cb..47bc6a000b3b 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -56,7 +56,7 @@ steps: # pypy3.7 is not in the hosted tool cache. to use the correct pypy3 version in conda # we have to patch it to a version that actually does work if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]pypy3.7" + Write-Host "##vso[task.setvariable variable=PyVersion]pypy3.7 -c conda-forge" } else { Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" From f2c330a4f600302613ee91677ac5ba23ab31ab16 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 15:52:30 -0700 Subject: [PATCH 059/126] need to figure out why the bin prepend isn't working --- eng/pipelines/templates/steps/test-conda.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 47bc6a000b3b..75214736beba 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -43,7 +43,10 @@ steps: $activateMethod = "source" $requirementSuffix = "" - # always need to add conda bin + # always need to add conda bin + Write-Host "$($env:CONDA)/bin" + Write-Host "$env:CONDA" + Write-Host "$CONDA" Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { $activateMethod = "call" @@ -56,7 +59,7 @@ steps: # pypy3.7 is not in the hosted tool cache. to use the correct pypy3 version in conda # we have to patch it to a version that actually does work if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]pypy3.7 -c conda-forge" + Write-Host "##vso[task.setvariable variable=PyVersion]pypy -c conda-forge" } else { Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" From 6f63ae51feb8af7a792539c4668d1ee8aa32e329 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 16:21:45 -0700 Subject: [PATCH 060/126] this is getting hilariously more complex --- eng/pipelines/templates/steps/test-conda.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 75214736beba..d2fe7ca43029 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -47,6 +47,7 @@ steps: Write-Host "$($env:CONDA)/bin" Write-Host "$env:CONDA" Write-Host "$CONDA" + Write-Host "##vso[task.setvariable variable=CONDABASE]$($env:CONDA)" Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { $activateMethod = "call" @@ -65,6 +66,7 @@ steps: Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" } + Write-Host "$env:PATH" Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' @@ -74,6 +76,7 @@ steps: echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" conda create --name ${{ artifact.name }} python=$(PyVersion) --yes conda install --name ${{ artifact.name }} --yes --quiet conda-build + echo "$(activate.method) activate ${{ artifact.name }}" $(activate.method) activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' From 9700a76dca2c8ae3361e3c5b52c24c543945bbc6 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 16:43:16 -0700 Subject: [PATCH 061/126] change how we call this thing --- eng/pipelines/templates/steps/test-conda.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d2fe7ca43029..9b957d98c1e9 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -73,11 +73,11 @@ steps: - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" - conda create --name ${{ artifact.name }} python=$(PyVersion) --yes + echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}}" + conda create --name ${{ artifact.name }} python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}} conda install --name ${{ artifact.name }} --yes --quiet conda-build echo "$(activate.method) activate ${{ artifact.name }}" - $(activate.method) activate ${{ artifact.name }} + $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' From 9ed0262bcfc782efb5238c64d1084d18e1fc0a7a Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 16:58:02 -0700 Subject: [PATCH 062/126] update the calls to directl use the path instead of the environment name --- eng/pipelines/templates/steps/test-conda.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 9b957d98c1e9..32b50311a4a6 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -65,18 +65,24 @@ steps: else { Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" } - - Write-Host "$env:PATH" + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' + - pwsh: | + Write-Host "$env:PATH" + displayName: 'Dump PAth' + - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}}" - conda create --name ${{ artifact.name }} python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}} - conda install --name ${{ artifact.name }} --yes --quiet conda-build - echo "$(activate.method) activate ${{ artifact.name }}" + echo "conda create python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}}" + conda create python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}} + + echo "conda install -p $(CONDABASE)/envs/${{ artifact.name}}" --yes --quiet conda-build" + conda install -p $(CONDABASE)/envs/${{ artifact.name}}" --yes --quiet conda-build + + echo "$(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }}" $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' From 7bae2d1afdc93b907be4308ef4cc890f50792839 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 17:14:11 -0700 Subject: [PATCH 063/126] attempting referencing the correct bin --- eng/pipelines/templates/steps/test-conda.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 32b50311a4a6..a1eb218205ec 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -65,23 +65,16 @@ steps: else { Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" } - + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' - - pwsh: | - Write-Host "$env:PATH" - displayName: 'Dump PAth' - - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda create python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}}" - conda create python=$(PyVersion) --yes -p $(CONDABASE)/envs/${{ artifact.name}} - - echo "conda install -p $(CONDABASE)/envs/${{ artifact.name}}" --yes --quiet conda-build" - conda install -p $(CONDABASE)/envs/${{ artifact.name}}" --yes --quiet conda-build - + echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" + conda create --name ${{ artifact.name }} python=$(PyVersion) --yes + conda install --name ${{ artifact.name }} --yes --quiet conda-build echo "$(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }}" $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From ec233f21cfac2c3256744215c1b0ac3133e633d0 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 17:23:55 -0700 Subject: [PATCH 064/126] the activate hack works --- eng/pipelines/templates/steps/test-conda.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index a1eb218205ec..02602c1c2627 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -81,7 +81,7 @@ steps: displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - script: | - $(activate.method) activate ${{ artifact.name }} + $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -109,13 +109,13 @@ steps: - script: | conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes - $(activate.method) activate ${{ artifact.name }} + $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} python -m pip install -r dev_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | - $(activate.method) activate ${{ artifact.name }} + $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} python -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From a596bf79ff70cc7c4748cce115dd63939bdadb73 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 17:29:21 -0700 Subject: [PATCH 065/126] output the path. on linux, use conda/bin/activate, on windows, use just the activate keyword --- eng/pipelines/templates/steps/test-conda.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 02602c1c2627..652c67cc15ec 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -70,6 +70,10 @@ steps: Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' + - pwsh: | + Write-Host $env:PATH + displayName: 'Evaluate OS Specific PATH and Parameters' + - ${{ each artifact in parameters.CondaArtifacts }}: - script: | echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" From b7f1db2fd7b03be586522a228247b00e1cba17d1 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 17:41:27 -0700 Subject: [PATCH 066/126] the path prepend isn't working is it --- eng/pipelines/templates/steps/test-conda.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 652c67cc15ec..d4cd372a8ba5 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -40,7 +40,7 @@ steps: displayName: Find installed version of pypy3 - pwsh: | - $activateMethod = "source" + $activateMethod = "source $($env:CONDA)/bin/activate" $requirementSuffix = "" # always need to add conda bin @@ -50,9 +50,12 @@ steps: Write-Host "##vso[task.setvariable variable=CONDABASE]$($env:CONDA)" Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { - $activateMethod = "call" + $activateMethod = "call activate" $requirementSuffix = " --user" + Write-Host $activateMethod + Write-Host "In windows" + # on windows only, need to prepend with the scripts directory as well Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } @@ -79,13 +82,13 @@ steps: echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" conda create --name ${{ artifact.name }} python=$(PyVersion) --yes conda install --name ${{ artifact.name }} --yes --quiet conda-build - echo "$(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }}" - $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - script: | - $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} + $(activate.method) ${{ artifact.name }} python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -113,13 +116,13 @@ steps: - script: | conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes - $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} + $(activate.method) ${{ artifact.name }} python -m pip install -r dev_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | - $(activate.method) $(CONDABASE)/bin/activate ${{ artifact.name }} + $(activate.method) ${{ artifact.name }} python -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 88a644fae9348fb27eb07fbcd063548222d15c80 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 18:00:04 -0700 Subject: [PATCH 067/126] clean up pass. time to get pypy3 working --- eng/pipelines/templates/steps/test-conda.yml | 43 ++++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d4cd372a8ba5..8a06bb5ef1da 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -36,26 +36,25 @@ steps: versionSpec: $(PythonVersion) - pwsh: | - python -c "import sys; print(sys.executable)" - displayName: Find installed version of pypy3 - - - pwsh: | + # due to faulty deployed scripts/how the path gets manipulated by conda actions on + # ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see + # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 $activateMethod = "source $($env:CONDA)/bin/activate" + + # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to + # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. $requirementSuffix = "" - # always need to add conda bin - Write-Host "$($env:CONDA)/bin" - Write-Host "$env:CONDA" - Write-Host "$CONDA" - Write-Host "##vso[task.setvariable variable=CONDABASE]$($env:CONDA)" + # we always want to prepend the path with conda bin, but windows requires an additional path Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" - if ($IsWindows) { + + if ($IsWindows) { + # powershell is does not have an equivalent of call/source, which is necessary when + # using conda in azure devops. Note that we use `activate` natively here, as + # a later path prepend of the /scripts directory actually works. $activateMethod = "call activate" $requirementSuffix = " --user" - Write-Host $activateMethod - Write-Host "In windows" - # on windows only, need to prepend with the scripts directory as well Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } @@ -69,26 +68,31 @@ steps: Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" } + # we will use these two variables extensively later Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" displayName: 'Evaluate OS Specific PATH and Parameters' - - pwsh: | - Write-Host $env:PATH - displayName: 'Evaluate OS Specific PATH and Parameters' - - ${{ each artifact in parameters.CondaArtifacts }}: - script: | echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" conda create --name ${{ artifact.name }} python=$(PyVersion) --yes + + echo "conda install --name ${{ artifact.name }} --yes --quiet conda-build" conda install --name ${{ artifact.name }} --yes --quiet conda-build + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} + + echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - script: | + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} + + echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' @@ -115,13 +119,18 @@ steps: SkipDefaultCheckout: true - script: | + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes" conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes + + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} + python -m pip install -r dev_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} python -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' From adea764944b8ba0b82ce2b8ff9cffaa837d47c6b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 18:28:38 -0700 Subject: [PATCH 068/126] more clean up --- eng/pipelines/templates/steps/test-conda.yml | 9 +++++---- sdk/core/ci.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 8a06bb5ef1da..666a85bb3bd1 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -45,11 +45,11 @@ steps: # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. $requirementSuffix = "" - # we always want to prepend the path with conda bin, but windows requires an additional path + # we always want to prepend the path with conda bin Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" if ($IsWindows) { - # powershell is does not have an equivalent of call/source, which is necessary when + # powershell does not have an equivalent of call/source, which is necessary when # using conda in azure devops. Note that we use `activate` natively here, as # a later path prepend of the /scripts directory actually works. $activateMethod = "call activate" @@ -59,8 +59,9 @@ steps: Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } - # pypy3.7 is not in the hosted tool cache. to use the correct pypy3 version in conda - # we have to patch it to a version that actually does work + # pypy3.7, for devops we are forced to use the term 'pypy3' + # however, conda has no comprehension of such a thing. + if("$(PythonVersion)" -eq "pypy3"){ Write-Host "##vso[task.setvariable variable=PyVersion]pypy -c conda-forge" } diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 8aec1202e559..c569bf00fc25 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -46,7 +46,7 @@ extends: safeName: azurecommon CondaArtifacts: - name: azure-core - meta_source: recipe/meta.yaml + meta_source: conda-recipe/meta.yaml common_root: azure checkout: - package: azure-core From 322113b2117335d7a1443b34cb06cc01a2ee100d Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 18:48:49 -0700 Subject: [PATCH 069/126] try creating the environment slightly differently by changing how we install the package --- eng/pipelines/templates/steps/test-conda.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 666a85bb3bd1..c56924002212 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -63,10 +63,10 @@ steps: # however, conda has no comprehension of such a thing. if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]pypy -c conda-forge" + Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3" } else { - Write-Host "##vso[task.setvariable variable=PyVersion]$(PythonVersion)" + Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" } # we will use these two variables extensively later @@ -76,8 +76,8 @@ steps: - ${{ each artifact in parameters.CondaArtifacts }}: - script: | - echo "conda create --name ${{ artifact.name }} python=$(PyVersion) --yes" - conda create --name ${{ artifact.name }} python=$(PyVersion) --yes + echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" + conda create --name ${{ artifact.name }} $(PyVersion) --yes echo "conda install --name ${{ artifact.name }} --yes --quiet conda-build" conda install --name ${{ artifact.name }} --yes --quiet conda-build From ee0409700eae198b7f2b83ecd8f2518a76d0f142 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 19:03:57 -0700 Subject: [PATCH 070/126] update the target from pypy3 to pypy3.7 --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index c56924002212..56d575532324 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -63,7 +63,7 @@ steps: # however, conda has no comprehension of such a thing. if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3" + Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7" } else { Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" From 67defee8689d8ec9f61868b0690a0dd265bb1f96 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 19:17:11 -0700 Subject: [PATCH 071/126] index _first_ using conda build in the base environment. then install pypy3 --- eng/pipelines/templates/steps/test-conda.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 56d575532324..2c89194f62ad 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -79,11 +79,8 @@ steps: echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" conda create --name ${{ artifact.name }} $(PyVersion) --yes - echo "conda install --name ${{ artifact.name }} --yes --quiet conda-build" - conda install --name ${{ artifact.name }} --yes --quiet conda-build - - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} + echo "conda install --yes --quiet conda-build" + conda install --yes --quiet conda-build echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From e1326cc5f4a4a2ceb24417507bb48507c6dc2ea4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 19:28:09 -0700 Subject: [PATCH 072/126] prep for having to call executable pypy3. create a build env that is separate from our test env that can be used to index --- eng/pipelines/templates/steps/test-conda.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 2c89194f62ad..116fdbf91778 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -41,6 +41,9 @@ steps: # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 $activateMethod = "source $($env:CONDA)/bin/activate" + # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python + # $pythonInvocation = "python" + # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. $requirementSuffix = "" @@ -64,6 +67,7 @@ steps: if("$(PythonVersion)" -eq "pypy3"){ Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7" + # $pythonInvocation = "pypy3" } else { Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" @@ -79,8 +83,14 @@ steps: echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" conda create --name ${{ artifact.name }} $(PyVersion) --yes - echo "conda install --yes --quiet conda-build" - conda install --yes --quiet conda-build + echo "conda create --name index-env --yes" + conda create --name index-env --yes + + echo "conda install --name index-env --yes --quiet conda-build" + conda install --name index-env --yes --quiet conda-build + + echo "$(activate.method) index-env" + $(activate.method) index-env echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} From 1d3a254d68f802d354efa7d803ab94cf2f18d765 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 19:39:57 -0700 Subject: [PATCH 073/126] swap over to invoking the correct python --- eng/pipelines/templates/steps/test-conda.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 116fdbf91778..b527bf9e9643 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -42,7 +42,7 @@ steps: $activateMethod = "source $($env:CONDA)/bin/activate" # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python - # $pythonInvocation = "python" + $pythonInvocation = "python" # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. @@ -67,15 +67,16 @@ steps: if("$(PythonVersion)" -eq "pypy3"){ Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7" - # $pythonInvocation = "pypy3" + $pythonInvocation = "pypy3" } else { Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" } - # we will use these two variables extensively later + # we will use these variables extensively later Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" + Write-Host "##vso[task.setvariable variable=python.invocation]$pythonInvocation" displayName: 'Evaluate OS Specific PATH and Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: @@ -100,8 +101,8 @@ steps: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" - python -m pip install -r eng/ci_tools.txt $(requirement.suffix) + echo "$(python.invocation) -m pip install -r eng/ci_tools.txt $(requirement.suffix)" + $(python.invocation) -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | @@ -133,13 +134,13 @@ steps: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - python -m pip install -r dev_requirements.txt + $(python.invocation) -m pip install -r dev_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - python -m pytest . + $(python.invocation) -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From e633f10de3f56ec8223d721af0b71df42497b666 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 19:50:27 -0700 Subject: [PATCH 074/126] ensure we also install pip on pypy3 --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index b527bf9e9643..edf115e00a18 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -66,7 +66,7 @@ steps: # however, conda has no comprehension of such a thing. if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7" + Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" $pythonInvocation = "pypy3" } else { From 877e1db7d7b42175b10fb2c885d82dd792e3bf15 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 20:00:04 -0700 Subject: [PATCH 075/126] checking to see if pypy3 properly aliases python --- eng/pipelines/templates/steps/test-conda.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index edf115e00a18..38dc398d4b37 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -42,7 +42,7 @@ steps: $activateMethod = "source $($env:CONDA)/bin/activate" # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python - $pythonInvocation = "python" + # $pythonInvocation = "python" # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. @@ -67,7 +67,7 @@ steps: if("$(PythonVersion)" -eq "pypy3"){ Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" - $pythonInvocation = "pypy3" + # $pythonInvocation = "pypy3" } else { Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" @@ -76,7 +76,7 @@ steps: # we will use these variables extensively later Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - Write-Host "##vso[task.setvariable variable=python.invocation]$pythonInvocation" + # Write-Host "##vso[task.setvariable variable=python.invocation]$pythonInvocation" displayName: 'Evaluate OS Specific PATH and Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: @@ -101,8 +101,8 @@ steps: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - echo "$(python.invocation) -m pip install -r eng/ci_tools.txt $(requirement.suffix)" - $(python.invocation) -m pip install -r eng/ci_tools.txt $(requirement.suffix) + echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" + python -m pip install -r eng/ci_tools.txt $(requirement.suffix) displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | @@ -134,13 +134,13 @@ steps: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - $(python.invocation) -m pip install -r dev_requirements.txt + python -m pip install -r dev_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - $(python.invocation) -m pytest . + python -m pytest . displayName: 'Run Tests for ${{ checkout.package }}' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 7821f379eb523a789cf79df843e77efce891fe71 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 20:16:31 -0700 Subject: [PATCH 076/126] remove extraneous comments now that we know that python is aliased properly in pypy3 env. re-enable tests --- eng/pipelines/templates/jobs/ci.tests.yml | 42 ++++++++++---------- eng/pipelines/templates/steps/test-conda.yml | 8 +--- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 58bb43640053..8de711ad091b 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -91,28 +91,28 @@ jobs: echo "##vso[task.setvariable variable=toxenv]$toxenvvar" displayName: "Set Tox Environment" - # - template: ../steps/build-test.yml - # parameters: - # ServiceDirectory: ${{ parameters.ServiceDirectory }} - # TestMarkArgument: ${{ parameters.TestMarkArgument }} - # AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' - # OSVmImage: $(OSVmImage) - # CoverageArg: $(CoverageArg) - # PythonVersion: $(PythonVersion) - # BuildTargetingString: ${{ parameters.BuildTargetingString }} - # ToxTestEnv: $(toxenv) - # ToxEnvParallel: ${{ parameters.ToxEnvParallel }} - # InjectedPackages: $(InjectedPackages) - # BeforeTestSteps: - # - task: DownloadPipelineArtifact@2 - # inputs: - # artifactName: 'packages' - # targetPath: $(Build.ArtifactStagingDirectory) + - template: ../steps/build-test.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' + OSVmImage: $(OSVmImage) + CoverageArg: $(CoverageArg) + PythonVersion: $(PythonVersion) + BuildTargetingString: ${{ parameters.BuildTargetingString }} + ToxTestEnv: $(toxenv) + ToxEnvParallel: ${{ parameters.ToxEnvParallel }} + InjectedPackages: $(InjectedPackages) + BeforeTestSteps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'packages' + targetPath: $(Build.ArtifactStagingDirectory) - # - template: ../steps/set-dev-build.yml - # parameters: - # ServiceDirectory: ${{ parameters.ServiceDirectory }} - # BuildTargetingString: ${{ parameters.BuildTargetingString }} + - template: ../steps/set-dev-build.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + BuildTargetingString: ${{ parameters.BuildTargetingString }} - template: ../steps/test-conda.yml parameters: diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 38dc398d4b37..615371c43600 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -42,7 +42,6 @@ steps: $activateMethod = "source $($env:CONDA)/bin/activate" # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python - # $pythonInvocation = "python" # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. @@ -62,12 +61,8 @@ steps: Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" } - # pypy3.7, for devops we are forced to use the term 'pypy3' - # however, conda has no comprehension of such a thing. - if("$(PythonVersion)" -eq "pypy3"){ Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" - # $pythonInvocation = "pypy3" } else { Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" @@ -76,10 +71,11 @@ steps: # we will use these variables extensively later Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - # Write-Host "##vso[task.setvariable variable=python.invocation]$pythonInvocation" displayName: 'Evaluate OS Specific PATH and Parameters' - ${{ each artifact in parameters.CondaArtifacts }}: + # due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create + # a separate env to install `conda-build` and use that to `conda index` the local file channel - script: | echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" conda create --name ${{ artifact.name }} $(PyVersion) --yes From 3013d5052587ec2a7a170166f6f8912554e0a751 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 1 May 2021 20:19:59 -0700 Subject: [PATCH 077/126] restore buildDocs default. originally changed to speed up iterations --- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 916a66057c62..c37d5581f11a 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: false + default: true - name: DevFeedName type: string default: public/azure-sdk-for-python From 1a7f0c6462fcc9c44849b65f7bb492ca81c55e73 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 14:06:44 -0700 Subject: [PATCH 078/126] install an established set of dev requirements --- eng/conda_test_requirements.txt | 7 +++++++ eng/pipelines/templates/steps/test-conda.yml | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 eng/conda_test_requirements.txt diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt new file mode 100644 index 000000000000..49fbebe7e88e --- /dev/null +++ b/eng/conda_test_requirements.txt @@ -0,0 +1,7 @@ +aiohttp>=3.0; python_version >= '3.5' +../../../tools/azure-devtools +../../../tools/azure-sdk-tools +mock;python_version<="2.7" +aiodns>=2.0; python_version >= '3.5' +parameterized>=0.7.3; python_version >= '3.0' + diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 615371c43600..d1036a541205 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -130,7 +130,8 @@ steps: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - python -m pip install -r dev_requirements.txt + echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" + python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From e4a267271157f545d83242cf17b2247691784dc5 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 14:42:20 -0700 Subject: [PATCH 079/126] install mock, trio --- eng/conda_test_requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index 49fbebe7e88e..da95e67300c9 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -1,7 +1,8 @@ aiohttp>=3.0; python_version >= '3.5' ../../../tools/azure-devtools ../../../tools/azure-sdk-tools -mock;python_version<="2.7" +mock; aiodns>=2.0; python_version >= '3.5' parameterized>=0.7.3; python_version >= '3.0' +trio; python_version >= '3.5' From 1c1e481b4fba07519228da48f6161c0c08c5e712 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 15:26:15 -0700 Subject: [PATCH 080/126] adding installation of azure-identity by default. --- eng/conda_test_requirements.txt | 2 +- eng/pipelines/templates/steps/test-conda.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index da95e67300c9..bf78dd7ce419 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -5,4 +5,4 @@ mock; aiodns>=2.0; python_version >= '3.5' parameterized>=0.7.3; python_version >= '3.0' trio; python_version >= '3.5' - +typing_extensions>=3.7.2 diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index d1036a541205..e9e4ea4f6251 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -124,6 +124,9 @@ steps: SkipDefaultCheckout: true - script: | + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKChannel) --yes + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes" conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes From 12313428fa8eab2c781b0fa5dbf82d0fa441d419 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 16:16:09 -0700 Subject: [PATCH 081/126] add explicit utures requirement as it's being incidentally installed in our standard py27 environments --- eng/conda_test_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index bf78dd7ce419..c381b0ae4335 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -6,3 +6,4 @@ aiodns>=2.0; python_version >= '3.5' parameterized>=0.7.3; python_version >= '3.0' trio; python_version >= '3.5' typing_extensions>=3.7.2 +futures==3.3.0; pyton_version <= '2.7' From f4d655460990fa56d25e4bfc6b9416ba2de76765 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 16:20:52 -0700 Subject: [PATCH 082/126] ensure that we also pass in the channel such that the artifact dependencies can be resolved --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index e9e4ea4f6251..116f3d28d012 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -128,7 +128,7 @@ steps: conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKChannel) --yes echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKChannel) echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From a28b1a8bf70c5aba01c6a2acd17ddee703fdeee4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 17:08:38 -0700 Subject: [PATCH 083/126] name the azure conda channel appropriately --- eng/pipelines/templates/steps/test-conda.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 116f3d28d012..63787e509885 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -124,11 +124,11 @@ steps: SkipDefaultCheckout: true - script: | - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKChannel) --yes + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKChannel) + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From 25f690df883277a1d1442327b230385273dcf5fb Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 17:57:51 -0700 Subject: [PATCH 084/126] resolve the issue with python_version requres for futures --- eng/conda_test_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index c381b0ae4335..3adfe9a23c7c 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -6,4 +6,4 @@ aiodns>=2.0; python_version >= '3.5' parameterized>=0.7.3; python_version >= '3.0' trio; python_version >= '3.5' typing_extensions>=3.7.2 -futures==3.3.0; pyton_version <= '2.7' +futures==3.3.0; python_version <= '2.7' From 8f8f735c9b65a0a24128c23dc989fb024a373d43 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Tue, 4 May 2021 18:57:22 -0700 Subject: [PATCH 085/126] add cryptography dependency set --- eng/conda_test_requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index 3adfe9a23c7c..c9cecfddfb7f 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -7,3 +7,4 @@ parameterized>=0.7.3; python_version >= '3.0' trio; python_version >= '3.5' typing_extensions>=3.7.2 futures==3.3.0; python_version <= '2.7' +cryptography \ No newline at end of file From 5f5bcaa2203eb46dc1bb7f253935db784c9b438b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 5 May 2021 10:24:53 -0700 Subject: [PATCH 086/126] ensure the echo matches --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 63787e509885..ed062f0f5a6f 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -127,7 +127,7 @@ steps: echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes" + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) echo "$(activate.method) ${{ artifact.name }}" From 8e17e5268acf55631dafc6cf401905a7d67424a6 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 5 May 2021 10:40:25 -0700 Subject: [PATCH 087/126] add debugging step to dump environment variables, pip environment, and sys.executable location --- eng/pipelines/templates/steps/test-conda.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index ed062f0f5a6f..0dbd04dc9b19 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -138,6 +138,25 @@ steps: displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + - bash: | + echo "what do we see in the working directory" + ls -A + + echo "what about executable location?" + python -c "import sys; print(sys.executable)" + + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + echo "what about pip freeze" + python -m pip freeze + + echo "dumping env" + printenv + displayName: 'Dump Environment Variables' + continueOnError: true + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From 997f94ca2a2cbf89e8744e12bb84090ebba5c61e Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 5 May 2021 10:40:46 -0700 Subject: [PATCH 088/126] disable regular testing --- eng/pipelines/templates/jobs/ci.tests.yml | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 8de711ad091b..58bb43640053 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -91,28 +91,28 @@ jobs: echo "##vso[task.setvariable variable=toxenv]$toxenvvar" displayName: "Set Tox Environment" - - template: ../steps/build-test.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - TestMarkArgument: ${{ parameters.TestMarkArgument }} - AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' - OSVmImage: $(OSVmImage) - CoverageArg: $(CoverageArg) - PythonVersion: $(PythonVersion) - BuildTargetingString: ${{ parameters.BuildTargetingString }} - ToxTestEnv: $(toxenv) - ToxEnvParallel: ${{ parameters.ToxEnvParallel }} - InjectedPackages: $(InjectedPackages) - BeforeTestSteps: - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'packages' - targetPath: $(Build.ArtifactStagingDirectory) + # - template: ../steps/build-test.yml + # parameters: + # ServiceDirectory: ${{ parameters.ServiceDirectory }} + # TestMarkArgument: ${{ parameters.TestMarkArgument }} + # AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' + # OSVmImage: $(OSVmImage) + # CoverageArg: $(CoverageArg) + # PythonVersion: $(PythonVersion) + # BuildTargetingString: ${{ parameters.BuildTargetingString }} + # ToxTestEnv: $(toxenv) + # ToxEnvParallel: ${{ parameters.ToxEnvParallel }} + # InjectedPackages: $(InjectedPackages) + # BeforeTestSteps: + # - task: DownloadPipelineArtifact@2 + # inputs: + # artifactName: 'packages' + # targetPath: $(Build.ArtifactStagingDirectory) - - template: ../steps/set-dev-build.yml - parameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - BuildTargetingString: ${{ parameters.BuildTargetingString }} + # - template: ../steps/set-dev-build.yml + # parameters: + # ServiceDirectory: ${{ parameters.ServiceDirectory }} + # BuildTargetingString: ${{ parameters.BuildTargetingString }} - template: ../steps/test-conda.yml parameters: From 00af21cf16c3b20d1846ca46aad65e62a381f8f4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Wed, 5 May 2021 11:01:45 -0700 Subject: [PATCH 089/126] bring in sdk/conftest.py --- eng/pipelines/templates/steps/test-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 0dbd04dc9b19..a7471ce1315b 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -117,6 +117,7 @@ steps: Paths: - "${{ checkout.checkout_path }}/${{ checkout.package }}" - "tools/" + - "sdk/confest.py" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" @@ -160,6 +161,5 @@ steps: - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - python -m pytest . + python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} displayName: 'Run Tests for ${{ checkout.package }}' - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 25e885991c04ad877c07c1259d43a2f795d67ca2 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 11:09:21 -0700 Subject: [PATCH 090/126] additional debugging. swapping the clone to grab everything in the repo --- eng/pipelines/templates/steps/test-conda.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index a7471ce1315b..567082054dd3 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -115,9 +115,7 @@ steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: Paths: - - "${{ checkout.checkout_path }}/${{ checkout.package }}" - - "tools/" - - "sdk/confest.py" + - "/*" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" @@ -139,16 +137,17 @@ steps: displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - bash: | - echo "what do we see in the working directory" - ls -A + - pwsh: | + Get-ChildItem -R $(conda.build) + displayName: What did we clone down? + - bash: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + echo "what about executable location?" python -c "import sys; print(sys.executable)" - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - echo "what about pip freeze" python -m pip freeze From 97fac59909ac9e910c623df327f141e8dd67bda4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 11:40:44 -0700 Subject: [PATCH 091/126] dumping what we cloned down before we attempt to access it --- eng/pipelines/templates/jobs/ci.yml | 2 +- eng/pipelines/templates/steps/test-conda.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index e8bd6656d291..85f1226774ba 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: true + default: false - name: DevFeedName type: string default: 'public/azure-sdk-for-python' diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 567082054dd3..5956ccc5e0ff 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -122,6 +122,10 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true + - pwsh: | + Get-ChildItem -R $(conda.build) + displayName: What did we clone down? + - script: | echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes @@ -137,10 +141,6 @@ steps: displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - pwsh: | - Get-ChildItem -R $(conda.build) - displayName: What did we clone down? - - bash: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From c7955cf8b2e4c0f5bb782e57c3858af73ec94821 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 12:02:13 -0700 Subject: [PATCH 092/126] instead grab everything in sdk --- eng/pipelines/templates/steps/test-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 5956ccc5e0ff..6762ca617c50 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -115,7 +115,7 @@ steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: Paths: - - "/*" + - "sdk/" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" From 1c9a590b98a66ba824ea460e7952da8220fa6bba Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 12:35:42 -0700 Subject: [PATCH 093/126] disable doc building, add tools back into what gets cloned down --- eng/pipelines/templates/jobs/ci.yml | 2 +- eng/pipelines/templates/stages/archetype-sdk-client.yml | 2 +- eng/pipelines/templates/steps/test-conda.yml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 85f1226774ba..e8bd6656d291 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: false + default: true - name: DevFeedName type: string default: 'public/azure-sdk-for-python' diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index c37d5581f11a..916a66057c62 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: true + default: false - name: DevFeedName type: string default: public/azure-sdk-for-python diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 6762ca617c50..9f5cd468dfc0 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -116,6 +116,7 @@ steps: parameters: Paths: - "sdk/" + - "tools/" Repositories: - Name: "Azure/azure-sdk-for-python" Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" From c1fffcf2258f455759cd59774f3dbc089c59ef65 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 13:03:26 -0700 Subject: [PATCH 094/126] eliminate extra debugging output. narrow the scope down to sdk/service. include sdk/conftest.py --- eng/pipelines/templates/steps/test-conda.yml | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 9f5cd468dfc0..2b57e9f6c2eb 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -115,7 +115,8 @@ steps: - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml parameters: Paths: - - "sdk/" + - "${{ checkout.checkout_path }}" + - "sdk/conftest.py" - "tools/" Repositories: - Name: "Azure/azure-sdk-for-python" @@ -142,21 +143,21 @@ steps: displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - bash: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} + # - bash: | + # echo "$(activate.method) ${{ artifact.name }}" + # $(activate.method) ${{ artifact.name }} - echo "what about executable location?" - python -c "import sys; print(sys.executable)" + # echo "what about executable location?" + # python -c "import sys; print(sys.executable)" - echo "what about pip freeze" - python -m pip freeze + # echo "what about pip freeze" + # python -m pip freeze - echo "dumping env" - printenv - displayName: 'Dump Environment Variables' - continueOnError: true - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + # echo "dumping env" + # printenv + # displayName: 'Dump Environment Variables' + # continueOnError: true + # workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | echo "$(activate.method) ${{ artifact.name }}" From b791c91b935c470251f19e54bd526a1c372bcb5b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 13:04:16 -0700 Subject: [PATCH 095/126] add adal to conda test environment --- eng/conda_test_requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index c9cecfddfb7f..7776948f043a 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -7,4 +7,5 @@ parameterized>=0.7.3; python_version >= '3.0' trio; python_version >= '3.5' typing_extensions>=3.7.2 futures==3.3.0; python_version <= '2.7' -cryptography \ No newline at end of file +cryptography +adal \ No newline at end of file From a75f9c61812e9f86591a17ce531269ac20856a28 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 15:12:49 -0700 Subject: [PATCH 096/126] updating docs to reflect support --- doc/dev/conda-builds.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/dev/conda-builds.md b/doc/dev/conda-builds.md index 05a1affeaf6a..6034a02f66f1 100644 --- a/doc/dev/conda-builds.md +++ b/doc/dev/conda-builds.md @@ -4,6 +4,8 @@ Follow the instructions [here](https://docs.conda.io/projects/conda-build/en/latest/install-conda-build.html) to install `conda` and `conda-build`. +**The Azure SDK Conda artifacts support `python3.8` and `python3.9` only.** + ## CI Build Process There will be a `CondaArtifact` defined in the `ci.yml` of each service directory. (`sdk/`) From 3440d5a9d3b6ec531e7754290c78a3126558cfc0 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 15:33:34 -0700 Subject: [PATCH 097/126] abstract at job level --- eng/pipelines/templates/jobs/ci.tests.yml | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 58bb43640053..735d0e204791 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -114,6 +114,39 @@ jobs: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} + +- job: + displayName: 'Test Conda' + condition: | + and( + succeededOrFailed(), + ne(variables['Skip.Test'], 'true'), + ne(${{ parameters.Matrix }}, '{}'), + ne(${{ parameters.CondaArtifacts }}, []) + or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) + ) + timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + + dependsOn: + - ${{ parameters.DependsOn }} + + strategy: + matrix: $[ ${{ parameters.Matrix }} ] + + pool: + name: $(Pool) + vmImage: $(OSVmImage) + + ${{ if eq(parameters.UsePlatformContainer, 'true') }}: + # Add a default so the job doesn't fail when the matrix is empty + container: $[ variables['Container'] ] + + variables: + - template: ../variables/globals.yml + - name: InjectedPackages + value: ${{ parameters.InjectedPackages }} + + steps: - template: ../steps/test-conda.yml parameters: CondaArtifacts: ${{ parameters.CondaArtifacts }} From 64e3a1cef7213978d6e62e1c69dbe114c6cd12e7 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 15:47:34 -0700 Subject: [PATCH 098/126] fix indendtation of additional job --- eng/pipelines/templates/jobs/ci.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 735d0e204791..7a6ca997a107 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -115,7 +115,7 @@ jobs: # BuildTargetingString: ${{ parameters.BuildTargetingString }} -- job: + - job: displayName: 'Test Conda' condition: | and( From e8be18331baca8929ab6568889ffe3a5c3b113b7 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 15:49:10 -0700 Subject: [PATCH 099/126] make entire step optional --- eng/pipelines/templates/jobs/ci.tests.yml | 79 +++++++++++------------ 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 7a6ca997a107..2550d2064b8a 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -114,44 +114,43 @@ jobs: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} - - - job: - displayName: 'Test Conda' - condition: | - and( - succeededOrFailed(), - ne(variables['Skip.Test'], 'true'), - ne(${{ parameters.Matrix }}, '{}'), - ne(${{ parameters.CondaArtifacts }}, []) - or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) - ) - timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - - dependsOn: - - ${{ parameters.DependsOn }} - - strategy: - matrix: $[ ${{ parameters.Matrix }} ] - - pool: - name: $(Pool) - vmImage: $(OSVmImage) - - ${{ if eq(parameters.UsePlatformContainer, 'true') }}: - # Add a default so the job doesn't fail when the matrix is empty - container: $[ variables['Container'] ] - - variables: - - template: ../variables/globals.yml - - name: InjectedPackages - value: ${{ parameters.InjectedPackages }} - - steps: - - template: ../steps/test-conda.yml - parameters: - CondaArtifacts: ${{ parameters.CondaArtifacts }} - ServiceDirectory: ${{ parameters.ServiceDirectory }} - TestMarkArgument: ${{ parameters.TestMarkArgument }} - OSVmImage: $(OSVmImage) - PythonVersion: $(PythonVersion) + - ${{ if ne(parameters.CondaArtifacts, [])}}: + - job: + displayName: 'Test Conda' + condition: | + and( + succeededOrFailed(), + ne(variables['Skip.Test'], 'true'), + ne(${{ parameters.Matrix }}, '{}'), + or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) + ) + timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + + dependsOn: + - ${{ parameters.DependsOn }} + + strategy: + matrix: $[ ${{ parameters.Matrix }} ] + + pool: + name: $(Pool) + vmImage: $(OSVmImage) + + ${{ if eq(parameters.UsePlatformContainer, 'true') }}: + # Add a default so the job doesn't fail when the matrix is empty + container: $[ variables['Container'] ] + + variables: + - template: ../variables/globals.yml + - name: InjectedPackages + value: ${{ parameters.InjectedPackages }} + + steps: + - template: ../steps/test-conda.yml + parameters: + CondaArtifacts: ${{ parameters.CondaArtifacts }} + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + OSVmImage: $(OSVmImage) + PythonVersion: $(PythonVersion) From 370fc65f48d37edb18b8ec0f27afc1bf3ef7f90a Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 15:51:06 -0700 Subject: [PATCH 100/126] use default --- eng/pipelines/templates/jobs/ci.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 2550d2064b8a..4f26771c42b8 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -114,7 +114,7 @@ jobs: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} - - ${{ if ne(parameters.CondaArtifacts, [])}}: + - ${{ if ne(parameters.CondaArtifacts, '[]')}}: - job: displayName: 'Test Conda' condition: | From 915a1f0f9357a3d5d2e312221884dd31336f3a4b Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 16:19:12 -0700 Subject: [PATCH 101/126] job steps are still skipping --- eng/pipelines/templates/jobs/ci.tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 4f26771c42b8..bd32c6ba5e36 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -114,15 +114,15 @@ jobs: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} - - ${{ if ne(parameters.CondaArtifacts, '[]')}}: + - ${{ if parameters.CondaArtifacts, '[]' }}: - job: displayName: 'Test Conda' condition: | and( succeededOrFailed(), - ne(variables['Skip.Test'], 'true'), + ne(variables['Skip.TestConda'], 'true'), ne(${{ parameters.Matrix }}, '{}'), - or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) + or(eq(variables['PythonVersion'],'3.8'), eq(variables['PythonVersion'],'3.9')) ) timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} From 972c5eb42419096cd7679cd099b49c03ddade5c3 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 16:46:58 -0700 Subject: [PATCH 102/126] remove one of the conditions so we can see what is evaluating --- eng/pipelines/templates/jobs/ci.tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index bd32c6ba5e36..1484b7ed2640 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -121,7 +121,6 @@ jobs: and( succeededOrFailed(), ne(variables['Skip.TestConda'], 'true'), - ne(${{ parameters.Matrix }}, '{}'), or(eq(variables['PythonVersion'],'3.8'), eq(variables['PythonVersion'],'3.9')) ) timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} From 3ba32fcb5d14e68f4dc149088cceb910657b9ac0 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Thu, 6 May 2021 16:49:51 -0700 Subject: [PATCH 103/126] there are conda tests to be run --- eng/pipelines/templates/jobs/ci.tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 1484b7ed2640..c23d6d459575 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -114,14 +114,14 @@ jobs: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} - - ${{ if parameters.CondaArtifacts, '[]' }}: + - ${{ if ne(parameters.CondaArtifacts, '[]')}}: - job: displayName: 'Test Conda' condition: | and( succeededOrFailed(), ne(variables['Skip.TestConda'], 'true'), - or(eq(variables['PythonVersion'],'3.8'), eq(variables['PythonVersion'],'3.9')) + or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) ) timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} From c1cd932fc1f8e5974fcdec93096634ffc525dd48 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 15:59:00 -0700 Subject: [PATCH 104/126] splitting this entire thing into a conditional --- eng/pipelines/templates/steps/test-conda.yml | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml index 2b57e9f6c2eb..847a89bb7df4 100644 --- a/eng/pipelines/templates/steps/test-conda.yml +++ b/eng/pipelines/templates/steps/test-conda.yml @@ -124,10 +124,6 @@ steps: WorkingDirectory: "$(conda.build)" SkipDefaultCheckout: true - - pwsh: | - Get-ChildItem -R $(conda.build) - displayName: What did we clone down? - - script: | echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes @@ -143,22 +139,6 @@ steps: displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - # - bash: | - # echo "$(activate.method) ${{ artifact.name }}" - # $(activate.method) ${{ artifact.name }} - - # echo "what about executable location?" - # python -c "import sys; print(sys.executable)" - - # echo "what about pip freeze" - # python -m pip freeze - - # echo "dumping env" - # printenv - # displayName: 'Dump Environment Variables' - # continueOnError: true - # workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From ac08e2da875894af2d5d22c8bf75570d8d8f2f44 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:13:15 -0700 Subject: [PATCH 105/126] instead of hacking some expression evaluation at run time, split up the conda environments into their own jobs --- .../templates/jobs/ci.conda.tests.yml | 180 ++++++++++++++++++ eng/pipelines/templates/jobs/ci.tests.yml | 43 ----- eng/pipelines/templates/jobs/ci.yml | 21 ++ .../stages/platform-matrix-conda-support.json | 10 + eng/pipelines/templates/steps/test-conda.yml | 146 -------------- 5 files changed, 211 insertions(+), 189 deletions(-) create mode 100644 eng/pipelines/templates/jobs/ci.conda.tests.yml create mode 100644 eng/pipelines/templates/stages/platform-matrix-conda-support.json delete mode 100644 eng/pipelines/templates/steps/test-conda.yml diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml new file mode 100644 index 000000000000..742a00bc02da --- /dev/null +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -0,0 +1,180 @@ +parameters: + - name: TestPipeline + type: boolean + default: false + - name: ServiceDirectory + type: string + default: '' + - name: CondaArtifacts + type: object + default: [] + - name: TestMarkArgument + type: string + default: '' + - name: PythonVersion + type: string + default: '' + - name: OSVmImage + type: string + default: '' + - name: Matrix + type: string + - name: DependsOn + type: string + default: '' + - name: UsePlatformContainer + type: boolean + default: false + + - job: + displayName: 'Test Conda' + condition: | + and( + succeededOrFailed(), + ne(variables['Skip.TestConda'], 'true') + ) + timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + + dependsOn: + - ${{ parameters.DependsOn }} + + strategy: + matrix: $[ ${{ parameters.Matrix }} ] + + pool: + name: $(Pool) + vmImage: $(OSVmImage) + + ${{ if eq(parameters.UsePlatformContainer, 'true') }}: + # Add a default so the job doesn't fail when the matrix is empty + container: $[ variables['Container'] ] + + variables: + - template: ../variables/globals.yml + + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'conda' + targetPath: $(Build.ArtifactStagingDirectory) + + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "azure-template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} + + - task: UsePythonVersion@0 + displayName: 'Use Python $(PythonVersion)' + inputs: + versionSpec: $(PythonVersion) + + - pwsh: | + # due to faulty deployed scripts/how the path gets manipulated by conda actions on + # ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see + # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 + $activateMethod = "source $($env:CONDA)/bin/activate" + + # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python + + # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to + # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. + $requirementSuffix = "" + + # we always want to prepend the path with conda bin + Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" + + if ($IsWindows) { + # powershell does not have an equivalent of call/source, which is necessary when + # using conda in azure devops. Note that we use `activate` natively here, as + # a later path prepend of the /scripts directory actually works. + $activateMethod = "call activate" + $requirementSuffix = " --user" + + # on windows only, need to prepend with the scripts directory as well + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + } + + if("$(PythonVersion)" -eq "pypy3"){ + Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" + } + else { + Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" + } + + # we will use these variables extensively later + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" + Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" + displayName: 'Evaluate OS Specific PATH and Parameters' + + - ${{ each artifact in parameters.CondaArtifacts }}: + # due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create + # a separate env to install `conda-build` and use that to `conda index` the local file channel + - script: | + echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" + conda create --name ${{ artifact.name }} $(PyVersion) --yes + + echo "conda create --name index-env --yes" + conda create --name index-env --yes + + echo "conda install --name index-env --yes --quiet conda-build" + conda install --name index-env --yes --quiet conda-build + + echo "$(activate.method) index-env" + $(activate.method) index-env + + echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" + conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} + displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' + + - script: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" + python -m pip install -r eng/ci_tools.txt $(requirement.suffix) + displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' + + - pwsh: | + mkdir $(Agent.BuildDirectory)/conda/ + Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" + displayName: 'Create Conda Working Directory for Testing' + + - ${{ each checkout in artifact.checkout }}: + - pwsh: + Write-Host "Clean up Conda Build Directory $(conda.build)" + Remove-Item $(conda.build)/* -Recurse -Force + displayName: 'Clean Up Before Testing ${{ artifact.name }}' + + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - "${{ checkout.checkout_path }}" + - "sdk/conftest.py" + - "tools/" + Repositories: + - Name: "Azure/azure-sdk-for-python" + Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" + WorkingDirectory: "$(conda.build)" + SkipDefaultCheckout: true + + - script: | + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" + python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt + displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + + - script: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + displayName: 'Run Tests for ${{ checkout.package }}' diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index c23d6d459575..8ce1829b3907 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -31,9 +31,6 @@ parameters: - name: CloudConfig type: object default: {} - - name: CondaArtifacts - type: object - default: [] jobs: - job: @@ -113,43 +110,3 @@ jobs: # parameters: # ServiceDirectory: ${{ parameters.ServiceDirectory }} # BuildTargetingString: ${{ parameters.BuildTargetingString }} - - - ${{ if ne(parameters.CondaArtifacts, '[]')}}: - - job: - displayName: 'Test Conda' - condition: | - and( - succeededOrFailed(), - ne(variables['Skip.TestConda'], 'true'), - or(eq(variables['PythonVersion'],'3.8'),eq(variables['PythonVersion'],'3.9')) - ) - timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - - dependsOn: - - ${{ parameters.DependsOn }} - - strategy: - matrix: $[ ${{ parameters.Matrix }} ] - - pool: - name: $(Pool) - vmImage: $(OSVmImage) - - ${{ if eq(parameters.UsePlatformContainer, 'true') }}: - # Add a default so the job doesn't fail when the matrix is empty - container: $[ variables['Container'] ] - - variables: - - template: ../variables/globals.yml - - name: InjectedPackages - value: ${{ parameters.InjectedPackages }} - - steps: - - template: ../steps/test-conda.yml - parameters: - CondaArtifacts: ${{ parameters.CondaArtifacts }} - ServiceDirectory: ${{ parameters.ServiceDirectory }} - TestMarkArgument: ${{ parameters.TestMarkArgument }} - OSVmImage: $(OSVmImage) - PythonVersion: $(PythonVersion) - diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 608f0d7e31f0..00ab37c73bcd 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -125,6 +125,27 @@ jobs: TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} ToxEnvParallel: ${{ parameters.ToxEnvParallel }} InjectedPackages: ${{ parameters.InjectedPackages }} + + - template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml + parameters: + JobTemplatePath: /eng/pipelines/templates/jobs/ci.conda.tests.yml + DependsOn: + - 'Build' + MatrixConfigs: + - Name: Python_ci_conda_envs + Path: eng/pipelines/templates/stages/platform-matrix-conda-support.json + Selection: sparse + GenerateVMJobs: true + MatrixFilters: ${{ parameters.MatrixFilters }} + MatrixReplace: ${{ parameters.MatrixReplace }} + CloudConfig: + Cloud: Public + AdditionalParameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestPipeline: ${{ parameters.TestPipeline }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + InjectedPackages: ${{ parameters.InjectedPackages }} CondaArtifacts: ${{ parameters.CondaArtifacts}} - job: 'RunRegression' diff --git a/eng/pipelines/templates/stages/platform-matrix-conda-support.json b/eng/pipelines/templates/stages/platform-matrix-conda-support.json new file mode 100644 index 000000000000..301bffddee63 --- /dev/null +++ b/eng/pipelines/templates/stages/platform-matrix-conda-support.json @@ -0,0 +1,10 @@ +{ + "matrix": { + "Agent": { + "ubuntu-18.04": { "OSVmImage": "MMSUbuntu18.04", "Pool": "azsdk-pool-mms-ubuntu-1804-general" }, + "windows-2019": { "OSVmImage": "MMS2019", "Pool": "azsdk-pool-mms-win-2019-general" }, + "macOS-10.15": { "OSVmImage": "macOS-10.15", "Pool": "Azure Pipelines" } + }, + "PythonVersion": [ "3.6", "3.8", "3.9" ] + } +} diff --git a/eng/pipelines/templates/steps/test-conda.yml b/eng/pipelines/templates/steps/test-conda.yml deleted file mode 100644 index 847a89bb7df4..000000000000 --- a/eng/pipelines/templates/steps/test-conda.yml +++ /dev/null @@ -1,146 +0,0 @@ -parameters: - - name: TestPipeline - type: boolean - default: false - - name: ServiceDirectory - type: string - default: '' - - name: CondaArtifacts - type: object - default: [] - - name: TestMarkArgument - type: string - default: '' - - name: PythonVersion - type: string - default: '' - - name: OSVmImage - type: string - default: '' - -steps: - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'conda' - targetPath: $(Build.ArtifactStagingDirectory) - - - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml - parameters: - PackageName: "azure-template" - ServiceDirectory: "template" - TestPipeline: ${{ parameters.TestPipeline }} - - - task: UsePythonVersion@0 - displayName: 'Use Python $(PythonVersion)' - inputs: - versionSpec: $(PythonVersion) - - - pwsh: | - # due to faulty deployed scripts/how the path gets manipulated by conda actions on - # ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see - # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 - $activateMethod = "source $($env:CONDA)/bin/activate" - - # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python - - # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to - # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. - $requirementSuffix = "" - - # we always want to prepend the path with conda bin - Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" - - if ($IsWindows) { - # powershell does not have an equivalent of call/source, which is necessary when - # using conda in azure devops. Note that we use `activate` natively here, as - # a later path prepend of the /scripts directory actually works. - $activateMethod = "call activate" - $requirementSuffix = " --user" - - # on windows only, need to prepend with the scripts directory as well - Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" - } - - if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" - } - else { - Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" - } - - # we will use these variables extensively later - Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" - Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - displayName: 'Evaluate OS Specific PATH and Parameters' - - - ${{ each artifact in parameters.CondaArtifacts }}: - # due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create - # a separate env to install `conda-build` and use that to `conda index` the local file channel - - script: | - echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" - conda create --name ${{ artifact.name }} $(PyVersion) --yes - - echo "conda create --name index-env --yes" - conda create --name index-env --yes - - echo "conda install --name index-env --yes --quiet conda-build" - conda install --name index-env --yes --quiet conda-build - - echo "$(activate.method) index-env" - $(activate.method) index-env - - echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" - conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} - displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' - - - script: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - - echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" - python -m pip install -r eng/ci_tools.txt $(requirement.suffix) - displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - - - pwsh: | - mkdir $(Agent.BuildDirectory)/conda/ - Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" - displayName: 'Create Conda Working Directory for Testing' - - - ${{ each checkout in artifact.checkout }}: - - pwsh: - Write-Host "Clean up Conda Build Directory $(conda.build)" - Remove-Item $(conda.build)/* -Recurse -Force - displayName: 'Clean Up Before Testing ${{ artifact.name }}' - - - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml - parameters: - Paths: - - "${{ checkout.checkout_path }}" - - "sdk/conftest.py" - - "tools/" - Repositories: - - Name: "Azure/azure-sdk-for-python" - Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" - WorkingDirectory: "$(conda.build)" - SkipDefaultCheckout: true - - - script: | - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - - echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" - python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt - displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - - script: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - displayName: 'Run Tests for ${{ checkout.package }}' From 4d854f633768651c932cf975ca75ee98dbed1d79 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:15:43 -0700 Subject: [PATCH 106/126] update the alignment --- .../templates/jobs/ci.conda.tests.yml | 285 +++++++++--------- 1 file changed, 143 insertions(+), 142 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 742a00bc02da..3aa251cc27b6 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -26,155 +26,156 @@ parameters: type: boolean default: false - - job: - displayName: 'Test Conda' - condition: | - and( - succeededOrFailed(), - ne(variables['Skip.TestConda'], 'true') - ) - timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - - dependsOn: - - ${{ parameters.DependsOn }} - - strategy: - matrix: $[ ${{ parameters.Matrix }} ] - - pool: - name: $(Pool) - vmImage: $(OSVmImage) - - ${{ if eq(parameters.UsePlatformContainer, 'true') }}: - # Add a default so the job doesn't fail when the matrix is empty - container: $[ variables['Container'] ] - - variables: - - template: ../variables/globals.yml - - steps: - - task: DownloadPipelineArtifact@2 - inputs: - artifactName: 'conda' - targetPath: $(Build.ArtifactStagingDirectory) - - - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml - parameters: - PackageName: "azure-template" - ServiceDirectory: "template" - TestPipeline: ${{ parameters.TestPipeline }} - - - task: UsePythonVersion@0 - displayName: 'Use Python $(PythonVersion)' - inputs: - versionSpec: $(PythonVersion) +jobs: + - job: + displayName: 'Test Conda' + condition: | + and( + succeededOrFailed(), + ne(variables['Skip.TestConda'], 'true') + ) + timeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + + dependsOn: + - ${{ parameters.DependsOn }} + + strategy: + matrix: $[ ${{ parameters.Matrix }} ] + + pool: + name: $(Pool) + vmImage: $(OSVmImage) + + ${{ if eq(parameters.UsePlatformContainer, 'true') }}: + # Add a default so the job doesn't fail when the matrix is empty + container: $[ variables['Container'] ] + + variables: + - template: ../variables/globals.yml + + steps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'conda' + targetPath: $(Build.ArtifactStagingDirectory) + + - template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml + parameters: + PackageName: "azure-template" + ServiceDirectory: "template" + TestPipeline: ${{ parameters.TestPipeline }} + + - task: UsePythonVersion@0 + displayName: 'Use Python $(PythonVersion)' + inputs: + versionSpec: $(PythonVersion) + + - pwsh: | + # due to faulty deployed scripts/how the path gets manipulated by conda actions on + # ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see + # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 + $activateMethod = "source $($env:CONDA)/bin/activate" + + # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python + + # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to + # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. + $requirementSuffix = "" + + # we always want to prepend the path with conda bin + Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" + + if ($IsWindows) { + # powershell does not have an equivalent of call/source, which is necessary when + # using conda in azure devops. Note that we use `activate` natively here, as + # a later path prepend of the /scripts directory actually works. + $activateMethod = "call activate" + $requirementSuffix = " --user" + + # on windows only, need to prepend with the scripts directory as well + Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" + } + + if("$(PythonVersion)" -eq "pypy3"){ + Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" + } + else { + Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" + } + + # we will use these variables extensively later + Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" + Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" + displayName: 'Evaluate OS Specific PATH and Parameters' + + - ${{ each artifact in parameters.CondaArtifacts }}: + # due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create + # a separate env to install `conda-build` and use that to `conda index` the local file channel + - script: | + echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" + conda create --name ${{ artifact.name }} $(PyVersion) --yes + + echo "conda create --name index-env --yes" + conda create --name index-env --yes + + echo "conda install --name index-env --yes --quiet conda-build" + conda install --name index-env --yes --quiet conda-build + + echo "$(activate.method) index-env" + $(activate.method) index-env + + echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" + conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} + displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' + + - script: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" + python -m pip install -r eng/ci_tools.txt $(requirement.suffix) + displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - pwsh: | - # due to faulty deployed scripts/how the path gets manipulated by conda actions on - # ubuntu and mac, we can't rely on bin/scripts being referenced correctly. see - # https://github.com/MicrosoftDocs/azure-devops-docs/issues/3812 - $activateMethod = "source $($env:CONDA)/bin/activate" - - # pypy3 is not a true python executable. in conda-land, we need to call it using pypy3, NOT python - - # on windows, we need to add "--user" as otherwise pip won't successfully install/uninstall due to - # how windows holds reservation on pip.exe. this is unnecessary on ubuntu/mac. - $requirementSuffix = "" - - # we always want to prepend the path with conda bin - Write-Host "##vso[task.prependpath]]$($env:CONDA)/bin" - - if ($IsWindows) { - # powershell does not have an equivalent of call/source, which is necessary when - # using conda in azure devops. Note that we use `activate` natively here, as - # a later path prepend of the /scripts directory actually works. - $activateMethod = "call activate" - $requirementSuffix = " --user" - - # on windows only, need to prepend with the scripts directory as well - Write-Host "##vso[task.prependpath]$($env:CONDA)/Scripts" - } - - if("$(PythonVersion)" -eq "pypy3"){ - Write-Host "##vso[task.setvariable variable=PyVersion]-c conda-forge pypy3.7 pip" - } - else { - Write-Host "##vso[task.setvariable variable=PyVersion]python=$(PythonVersion)" - } - - # we will use these variables extensively later - Write-Host "##vso[task.setvariable variable=activate.method]$activateMethod" - Write-Host "##vso[task.setvariable variable=requirement.suffix]$requirementSuffix" - displayName: 'Evaluate OS Specific PATH and Parameters' - - - ${{ each artifact in parameters.CondaArtifacts }}: - # due to the fact that `pypy3` and `conda-build` conda packages are INCOMPATIBLE, we have to create - # a separate env to install `conda-build` and use that to `conda index` the local file channel - - script: | - echo "conda create --name ${{ artifact.name }} $(PyVersion) --yes" - conda create --name ${{ artifact.name }} $(PyVersion) --yes + mkdir $(Agent.BuildDirectory)/conda/ + Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" + displayName: 'Create Conda Working Directory for Testing' + + - ${{ each checkout in artifact.checkout }}: + - pwsh: + Write-Host "Clean up Conda Build Directory $(conda.build)" + Remove-Item $(conda.build)/* -Recurse -Force + displayName: 'Clean Up Before Testing ${{ artifact.name }}' + + - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml + parameters: + Paths: + - "${{ checkout.checkout_path }}" + - "sdk/conftest.py" + - "tools/" + Repositories: + - Name: "Azure/azure-sdk-for-python" + Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" + WorkingDirectory: "$(conda.build)" + SkipDefaultCheckout: true - echo "conda create --name index-env --yes" - conda create --name index-env --yes + - script: | + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - echo "conda install --name index-env --yes --quiet conda-build" - conda install --name index-env --yes --quiet conda-build + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - echo "$(activate.method) index-env" - $(activate.method) index-env + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} - echo "conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }}" - conda index $(Build.ArtifactStagingDirectory)/${{ artifact.name }} - displayName: 'Prepare Conda Environment for Testing ${{ artifact.name }}, Index the Target Local Artifact' + echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" + python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt + displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - - echo "python -m pip install -r eng/ci_tools.txt $(requirement.suffix)" - python -m pip install -r eng/ci_tools.txt $(requirement.suffix) - displayName: 'Activate Conda Environment and Install General Dependencies ${{ artifact.name }}' - - - pwsh: | - mkdir $(Agent.BuildDirectory)/conda/ - Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" - displayName: 'Create Conda Working Directory for Testing' - - - ${{ each checkout in artifact.checkout }}: - - pwsh: - Write-Host "Clean up Conda Build Directory $(conda.build)" - Remove-Item $(conda.build)/* -Recurse -Force - displayName: 'Clean Up Before Testing ${{ artifact.name }}' - - - template: /eng/common/pipelines/templates/steps/sparse-checkout.yml - parameters: - Paths: - - "${{ checkout.checkout_path }}" - - "sdk/conftest.py" - - "tools/" - Repositories: - - Name: "Azure/azure-sdk-for-python" - Commitish: "${{ checkout.Package }}_${{ checkout.Version }}" - WorkingDirectory: "$(conda.build)" - SkipDefaultCheckout: true - - - script: | - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - - echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" - python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt - displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - - script: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - displayName: 'Run Tests for ${{ checkout.package }}' + python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + displayName: 'Run Tests for ${{ checkout.package }}' From a62bdb1b6573a07d90d9c742e1a2527475b33bff Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:17:55 -0700 Subject: [PATCH 107/126] remove references or add missing argument --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 3 +++ eng/pipelines/templates/jobs/ci.yml | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 3aa251cc27b6..06213b555b9f 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -25,6 +25,9 @@ parameters: - name: UsePlatformContainer type: boolean default: false + - name: TestTimeoutInMinutes + type: number + default: 0 jobs: - job: diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 00ab37c73bcd..639ae7453d7f 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -138,14 +138,11 @@ jobs: GenerateVMJobs: true MatrixFilters: ${{ parameters.MatrixFilters }} MatrixReplace: ${{ parameters.MatrixReplace }} - CloudConfig: - Cloud: Public AdditionalParameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} TestPipeline: ${{ parameters.TestPipeline }} TestMarkArgument: ${{ parameters.TestMarkArgument }} TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - InjectedPackages: ${{ parameters.InjectedPackages }} CondaArtifacts: ${{ parameters.CondaArtifacts}} - job: 'RunRegression' From 5500af18df18e947232e0f6eb46a4291772a84d8 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:19:20 -0700 Subject: [PATCH 108/126] assent to forced cloudconfig --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 3 +++ eng/pipelines/templates/jobs/ci.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 06213b555b9f..a284eed329dc 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -28,6 +28,9 @@ parameters: - name: TestTimeoutInMinutes type: number default: 0 + - name: CloudConfig + type: object + default: {} jobs: - job: diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 639ae7453d7f..c84cccd23c8b 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -138,6 +138,8 @@ jobs: GenerateVMJobs: true MatrixFilters: ${{ parameters.MatrixFilters }} MatrixReplace: ${{ parameters.MatrixReplace }} + CloudConfig: + Cloud: Public AdditionalParameters: ServiceDirectory: ${{ parameters.ServiceDirectory }} TestPipeline: ${{ parameters.TestPipeline }} From 5ff0b5cab8da9119387fcefc853c277a4826d77f Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:26:29 -0700 Subject: [PATCH 109/126] ability to run multiple matrices in place --- .../jobs/archetype-sdk-tests-generate.yml | 13 +++--- eng/pipelines/templates/jobs/ci.yml | 42 ++++++++++--------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml index 0ad592b07367..d5d820bce2c8 100644 --- a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml +++ b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml @@ -31,9 +31,12 @@ parameters: - name: OsVmImage type: string default: MMSUbuntu18.04 +- name: GeneratedJobName + type: string + default: 'generate_matrix' jobs: -- job: generate_matrix +- job: ${{ parameters.GeneratedJobName }} variables: displayNameFilter: $[ coalesce(variables.jobMatrixFilter, '.*') ] pool: @@ -89,8 +92,8 @@ jobs: - template: ${{ parameters.JobTemplatePath }} parameters: UsePlatformContainer: false - Matrix: dependencies.generate_matrix.outputs['generate_vm_job_matrix_${{ config.Name }}.matrix'] - DependsOn: generate_matrix + Matrix: dependencies.${{ parameters.GeneratedJobName }}.outputs['generate_vm_job_matrix_${{ config.Name }}.matrix'] + DependsOn: ${{ parameters.GeneratedJobName }} CloudConfig: ${{ parameters.CloudConfig }} ${{ each param in parameters.AdditionalParameters }}: ${{ param.key }}: ${{ param.value }} @@ -99,8 +102,8 @@ jobs: - template: ${{ parameters.JobTemplatePath }} parameters: UsePlatformContainer: true - Matrix: dependencies.generate_matrix.outputs['generate_container_job_matrix_${{ config.Name }}.matrix'] - DependsOn: generate_matrix + Matrix: dependencies.${{ parameters.GeneratedJobName }}.outputs['generate_container_job_matrix_${{ config.Name }}.matrix'] + DependsOn: ${{ parameters.GeneratedJobName }} CloudConfig: ${{ parameters.CloudConfig }} ${{ each param in parameters.AdditionalParameters }}: ${{ param.key }}: ${{ param.value }} diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index c84cccd23c8b..630a844a6e42 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -126,26 +126,28 @@ jobs: ToxEnvParallel: ${{ parameters.ToxEnvParallel }} InjectedPackages: ${{ parameters.InjectedPackages }} - - template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml - parameters: - JobTemplatePath: /eng/pipelines/templates/jobs/ci.conda.tests.yml - DependsOn: - - 'Build' - MatrixConfigs: - - Name: Python_ci_conda_envs - Path: eng/pipelines/templates/stages/platform-matrix-conda-support.json - Selection: sparse - GenerateVMJobs: true - MatrixFilters: ${{ parameters.MatrixFilters }} - MatrixReplace: ${{ parameters.MatrixReplace }} - CloudConfig: - Cloud: Public - AdditionalParameters: - ServiceDirectory: ${{ parameters.ServiceDirectory }} - TestPipeline: ${{ parameters.TestPipeline }} - TestMarkArgument: ${{ parameters.TestMarkArgument }} - TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} - CondaArtifacts: ${{ parameters.CondaArtifacts}} + - ${{ if gt(length(parameters.CondaArtifacts), 0 }}: + - template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml + parameters: + JobTemplatePath: /eng/pipelines/templates/jobs/ci.conda.tests.yml + GeneratedJobName: generate_conda_matrix + DependsOn: + - 'Build' + MatrixConfigs: + - Name: Python_ci_conda_envs + Path: eng/pipelines/templates/stages/platform-matrix-conda-support.json + Selection: sparse + GenerateVMJobs: true + MatrixFilters: ${{ parameters.MatrixFilters }} + MatrixReplace: ${{ parameters.MatrixReplace }} + CloudConfig: + Cloud: Public + AdditionalParameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestPipeline: ${{ parameters.TestPipeline }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + TestTimeoutInMinutes: ${{ parameters.TestTimeoutInMinutes }} + CondaArtifacts: ${{ parameters.CondaArtifacts}} - job: 'RunRegression' condition: and(succeededOrFailed(), or(eq(variables['Run.Regression'], 'true'), and(eq(variables['Build.Reason'], 'Schedule'), eq(variables['System.TeamProject'],'internal')))) From e9aa584bf9d71c553db597878acece66e8a549f2 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:27:14 -0700 Subject: [PATCH 110/126] close gt() --- eng/pipelines/templates/jobs/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index 630a844a6e42..c58b11a874d1 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -126,7 +126,7 @@ jobs: ToxEnvParallel: ${{ parameters.ToxEnvParallel }} InjectedPackages: ${{ parameters.InjectedPackages }} - - ${{ if gt(length(parameters.CondaArtifacts), 0 }}: + - ${{ if gt(length(parameters.CondaArtifacts), 0) }}: - template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml parameters: JobTemplatePath: /eng/pipelines/templates/jobs/ci.conda.tests.yml From c10e2620fc63c7e287fea76da3b6994752d96b41 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Sat, 8 May 2021 16:45:14 -0700 Subject: [PATCH 111/126] undo all the testing changes. --- .../jobs/archetype-sdk-tests-generate.yml | 12 +++--- eng/pipelines/templates/jobs/ci.tests.yml | 42 +++++++++---------- eng/pipelines/templates/jobs/ci.yml | 2 +- .../templates/stages/archetype-sdk-client.yml | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml index d5d820bce2c8..5a504144424d 100644 --- a/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml +++ b/eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml @@ -31,12 +31,12 @@ parameters: - name: OsVmImage type: string default: MMSUbuntu18.04 -- name: GeneratedJobName +- name: GenerateJobName type: string default: 'generate_matrix' jobs: -- job: ${{ parameters.GeneratedJobName }} +- job: ${{ parameters.GenerateJobName }} variables: displayNameFilter: $[ coalesce(variables.jobMatrixFilter, '.*') ] pool: @@ -92,8 +92,8 @@ jobs: - template: ${{ parameters.JobTemplatePath }} parameters: UsePlatformContainer: false - Matrix: dependencies.${{ parameters.GeneratedJobName }}.outputs['generate_vm_job_matrix_${{ config.Name }}.matrix'] - DependsOn: ${{ parameters.GeneratedJobName }} + Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['generate_vm_job_matrix_${{ config.Name }}.matrix'] + DependsOn: ${{ parameters.GenerateJobName }} CloudConfig: ${{ parameters.CloudConfig }} ${{ each param in parameters.AdditionalParameters }}: ${{ param.key }}: ${{ param.value }} @@ -102,8 +102,8 @@ jobs: - template: ${{ parameters.JobTemplatePath }} parameters: UsePlatformContainer: true - Matrix: dependencies.${{ parameters.GeneratedJobName }}.outputs['generate_container_job_matrix_${{ config.Name }}.matrix'] - DependsOn: ${{ parameters.GeneratedJobName }} + Matrix: dependencies.${{ parameters.GenerateJobName }}.outputs['generate_container_job_matrix_${{ config.Name }}.matrix'] + DependsOn: ${{ parameters.GenerateJobName }} CloudConfig: ${{ parameters.CloudConfig }} ${{ each param in parameters.AdditionalParameters }}: ${{ param.key }}: ${{ param.value }} diff --git a/eng/pipelines/templates/jobs/ci.tests.yml b/eng/pipelines/templates/jobs/ci.tests.yml index 8ce1829b3907..86ace67ed00d 100644 --- a/eng/pipelines/templates/jobs/ci.tests.yml +++ b/eng/pipelines/templates/jobs/ci.tests.yml @@ -88,25 +88,25 @@ jobs: echo "##vso[task.setvariable variable=toxenv]$toxenvvar" displayName: "Set Tox Environment" - # - template: ../steps/build-test.yml - # parameters: - # ServiceDirectory: ${{ parameters.ServiceDirectory }} - # TestMarkArgument: ${{ parameters.TestMarkArgument }} - # AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' - # OSVmImage: $(OSVmImage) - # CoverageArg: $(CoverageArg) - # PythonVersion: $(PythonVersion) - # BuildTargetingString: ${{ parameters.BuildTargetingString }} - # ToxTestEnv: $(toxenv) - # ToxEnvParallel: ${{ parameters.ToxEnvParallel }} - # InjectedPackages: $(InjectedPackages) - # BeforeTestSteps: - # - task: DownloadPipelineArtifact@2 - # inputs: - # artifactName: 'packages' - # targetPath: $(Build.ArtifactStagingDirectory) + - template: ../steps/build-test.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + TestMarkArgument: ${{ parameters.TestMarkArgument }} + AdditionalTestArgs: '--wheel_dir="$(Build.ArtifactStagingDirectory)"' + OSVmImage: $(OSVmImage) + CoverageArg: $(CoverageArg) + PythonVersion: $(PythonVersion) + BuildTargetingString: ${{ parameters.BuildTargetingString }} + ToxTestEnv: $(toxenv) + ToxEnvParallel: ${{ parameters.ToxEnvParallel }} + InjectedPackages: $(InjectedPackages) + BeforeTestSteps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: 'packages' + targetPath: $(Build.ArtifactStagingDirectory) - # - template: ../steps/set-dev-build.yml - # parameters: - # ServiceDirectory: ${{ parameters.ServiceDirectory }} - # BuildTargetingString: ${{ parameters.BuildTargetingString }} + - template: ../steps/set-dev-build.yml + parameters: + ServiceDirectory: ${{ parameters.ServiceDirectory }} + BuildTargetingString: ${{ parameters.BuildTargetingString }} diff --git a/eng/pipelines/templates/jobs/ci.yml b/eng/pipelines/templates/jobs/ci.yml index c58b11a874d1..71d5b0fcb93f 100644 --- a/eng/pipelines/templates/jobs/ci.yml +++ b/eng/pipelines/templates/jobs/ci.yml @@ -130,7 +130,7 @@ jobs: - template: /eng/common/pipelines/templates/jobs/archetype-sdk-tests-generate.yml parameters: JobTemplatePath: /eng/pipelines/templates/jobs/ci.conda.tests.yml - GeneratedJobName: generate_conda_matrix + GenerateJobName: generate_conda_matrix DependsOn: - 'Build' MatrixConfigs: diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 916a66057c62..c37d5581f11a 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -31,7 +31,7 @@ parameters: default: '' - name: BuildDocs type: boolean - default: false + default: true - name: DevFeedName type: string default: public/azure-sdk-for-python From 35ad3c9cef30f094d167642d43a307b250e29795 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Fri, 14 May 2021 16:05:00 -0700 Subject: [PATCH 112/126] swap to newer version of azure core --- sdk/core/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index c569bf00fc25..d1bd0d730621 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -51,4 +51,4 @@ extends: checkout: - package: azure-core checkout_path: sdk/core - version: 1.12.0 \ No newline at end of file + version: 1.14.0 \ No newline at end of file From 0e2a8f627d4edc8188f4dd097d7081699fe34369 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Fri, 14 May 2021 16:38:43 -0700 Subject: [PATCH 113/126] even newer version of azure-core --- sdk/core/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index d1bd0d730621..b35190b91f45 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -51,4 +51,4 @@ extends: checkout: - package: azure-core checkout_path: sdk/core - version: 1.14.0 \ No newline at end of file + version: 1.15.0b1 \ No newline at end of file From ca88f4fbcd759f85e9e43e7a00f1d2b699bf2339 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Fri, 14 May 2021 17:06:25 -0700 Subject: [PATCH 114/126] revert back ot 1.12.0 --- sdk/core/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index b35190b91f45..c569bf00fc25 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -51,4 +51,4 @@ extends: checkout: - package: azure-core checkout_path: sdk/core - version: 1.15.0b1 \ No newline at end of file + version: 1.12.0 \ No newline at end of file From bd9d6fbad6215e635d4d34eb2cab172cb25a3fa2 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 11:22:51 -0700 Subject: [PATCH 115/126] re-order installation. add pip freeze --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index a284eed329dc..8368f070f457 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -166,12 +166,12 @@ jobs: SkipDefaultCheckout: true - script: | - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} @@ -183,5 +183,6 @@ jobs: - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} + python -m pip freeze python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} displayName: 'Run Tests for ${{ checkout.package }}' From 3cee356dab42ed7e90ebd39e9899a446bf75a0a4 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 12:45:12 -0700 Subject: [PATCH 116/126] ensure that the correct version of azure_core is installed --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 8368f070f457..8b65687fcf6b 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -166,12 +166,12 @@ jobs: SkipDefaultCheckout: true - script: | - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} From 6a9b5dfb00fb8bf760bb43548276d48a6be4dd72 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 13:34:19 -0700 Subject: [PATCH 117/126] force-reinstall isn't doing anything --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 8b65687fcf6b..7ed06712654d 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -169,7 +169,7 @@ jobs: echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) echo "$(activate.method) ${{ artifact.name }}" From 107f7f094ba36716d10abd0c19b41ce2591ca0af Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 16:38:07 -0700 Subject: [PATCH 118/126] activate env and install dependencies first, then install azure-identity, then install the target package with force reinstall --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 7ed06712654d..0963acba975b 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -166,17 +166,17 @@ jobs: SkipDefaultCheckout: true - script: | - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes - - echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt + + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + + echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From a599c0acb415e62d9fc0b4881b831367685a929d Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 17:01:14 -0700 Subject: [PATCH 119/126] split environment prep and package installation into separate steps --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 0963acba975b..b73b2e63f689 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -174,10 +174,13 @@ jobs: echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + displayName: 'Prep Conda Environment w/ Dependencies' + workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} + - script: | echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - displayName: 'Install ${{ checkout.package }} Conda Package and Dev Requirements' + displayName: 'Install ${{ checkout.package }} Conda Package' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | From 0179567343727c12138a1239102139eb47230977 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 17:32:21 -0700 Subject: [PATCH 120/126] change ordering --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index b73b2e63f689..3da8d0ab4bda 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -171,15 +171,15 @@ jobs: echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt - - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes displayName: 'Prep Conda Environment w/ Dependencies' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + + echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes displayName: 'Install ${{ checkout.package }} Conda Package' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 30ba4a680a66f7e334f82d22ae3a2bffb6791830 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 17:52:53 -0700 Subject: [PATCH 121/126] re-ordering is working. now we just gotta prevent reinstall of azure-core from azure-identity by giving it the local channel --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 3da8d0ab4bda..c9289e7ce538 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -171,15 +171,25 @@ jobs: echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt + + python -m pip uninstall azure-core -y displayName: 'Prep Conda Environment w/ Dependencies' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + + python -m pip freeze + echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - echo "conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(AzureSDKCondaChannel) --yes + python -m pip freeze + + echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes displayName: 'Install ${{ checkout.package }} Conda Package' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} From 237e172c942bafa209675a127194368a60fdd343 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 18:12:06 -0700 Subject: [PATCH 122/126] last cleanup, finally going to merge this! --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index c9289e7ce538..bc865b7cf11b 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -172,22 +172,14 @@ jobs: echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt - python -m pip uninstall azure-core -y + python -m pip uninstall azure-core -y displayName: 'Prep Conda Environment w/ Dependencies' workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - - - python -m pip freeze - echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - python -m pip freeze - echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes displayName: 'Install ${{ checkout.package }} Conda Package' From 72d651007af1a684dff9942f0194265e0289e232 Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 19:01:27 -0700 Subject: [PATCH 123/126] remove the --force-reinstall that I believe is making this thing not actually work --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index bc865b7cf11b..ff1e9005e840 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -177,8 +177,8 @@ jobs: workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - script: | - echo "conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --force-reinstall --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes From 1b395995a149e687d20994f99e3132457dcd27de Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 19:22:41 -0700 Subject: [PATCH 124/126] we do not need to reinstall all the dependencies each time. we just need to run the tests --- .../templates/jobs/ci.conda.tests.yml | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index ff1e9005e840..1409ed27ef5b 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -147,6 +147,28 @@ jobs: Write-Host "##vso[task.setvariable variable=conda.build]$(Agent.BuildDirectory)/conda_checkout" displayName: 'Create Conda Working Directory for Testing' + - script: | + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + + echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" + python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt + + python -m pip uninstall azure-core -y + displayName: 'Prep Conda Environment w/ Dependencies' + + - script: | + echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" + conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) + + echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" + conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes + + echo "$(activate.method) ${{ artifact.name }}" + $(activate.method) ${{ artifact.name }} + python -m pip freeze + displayName: 'Install ${{ checkout.package }} Conda Package' + - ${{ each checkout in artifact.checkout }}: - pwsh: Write-Host "Clean up Conda Build Directory $(conda.build)" @@ -168,26 +190,5 @@ jobs: - script: | echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} - - echo "python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt" - python -m pip install -r $(Build.SourcesDirectory)/eng/conda_test_requirements.txt - - python -m pip uninstall azure-core -y - displayName: 'Prep Conda Environment w/ Dependencies' - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - - script: | - echo "conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel)" - conda install --name ${{ artifact.name }} ${{ artifact.name }} -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} --yes -c $(AzureSDKCondaChannel) - - echo "conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes" - conda install --name ${{ artifact.name }} azure-identity -c $(Build.ArtifactStagingDirectory)/${{ artifact.name }} -c $(AzureSDKCondaChannel) --yes - displayName: 'Install ${{ checkout.package }} Conda Package' - workingDirectory: $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} - - - script: | - echo "$(activate.method) ${{ artifact.name }}" - $(activate.method) ${{ artifact.name }} - python -m pip freeze python -m pytest $(conda.build)/${{ checkout.checkout_path }}/${{ checkout.package }} displayName: 'Run Tests for ${{ checkout.package }}' From 114a69e36665801a6fa427705383fc50e4b57b1a Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 19:29:49 -0700 Subject: [PATCH 125/126] bad reference to checkout --- eng/pipelines/templates/jobs/ci.conda.tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/jobs/ci.conda.tests.yml b/eng/pipelines/templates/jobs/ci.conda.tests.yml index 1409ed27ef5b..dafeada3932a 100644 --- a/eng/pipelines/templates/jobs/ci.conda.tests.yml +++ b/eng/pipelines/templates/jobs/ci.conda.tests.yml @@ -167,7 +167,7 @@ jobs: echo "$(activate.method) ${{ artifact.name }}" $(activate.method) ${{ artifact.name }} python -m pip freeze - displayName: 'Install ${{ checkout.package }} Conda Package' + displayName: 'Install ${{ artifact.name }} Conda Package' - ${{ each checkout in artifact.checkout }}: - pwsh: From 12511fe40ee55b25300982af69d4629a9e446fbd Mon Sep 17 00:00:00 2001 From: scbedd <45376673+scbedd@users.noreply.github.com> Date: Mon, 17 May 2021 19:48:54 -0700 Subject: [PATCH 126/126] update the conda_test_requirements to be installable from root of repo --- eng/conda_test_requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/conda_test_requirements.txt b/eng/conda_test_requirements.txt index 7776948f043a..b359bbbf5b7c 100644 --- a/eng/conda_test_requirements.txt +++ b/eng/conda_test_requirements.txt @@ -1,6 +1,7 @@ +# install from root of repo aiohttp>=3.0; python_version >= '3.5' -../../../tools/azure-devtools -../../../tools/azure-sdk-tools +tools/azure-devtools +tools/azure-sdk-tools mock; aiodns>=2.0; python_version >= '3.5' parameterized>=0.7.3; python_version >= '3.0'