diff --git a/eng/ci/code-mirror.yml b/eng/ci/code-mirror.yml index fc916d393..bc010ab3f 100644 --- a/eng/ci/code-mirror.yml +++ b/eng/ci/code-mirror.yml @@ -3,6 +3,8 @@ trigger: include: - dev - release/* + - sdk/* # run for sdk and extension release branches + - extensions/* resources: repositories: diff --git a/eng/ci/integration-tests.yml b/eng/ci/integration-tests.yml index b94d7fd10..5cf0ab874 100644 --- a/eng/ci/integration-tests.yml +++ b/eng/ci/integration-tests.yml @@ -1,4 +1,9 @@ -trigger: none # ensure this is not ran as a CI build +trigger: # run for sdk and extension release branches + batch: true + branches: + include: + - sdk/* + - extensions/* pr: branches: diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml index 6d62ec288..39acfd217 100644 --- a/eng/ci/public-build.yml +++ b/eng/ci/public-build.yml @@ -3,6 +3,8 @@ trigger: branches: include: - dev + - sdk/* + - extensions/* pr: branches: @@ -24,6 +26,12 @@ resources: name: 1ESPipelineTemplates/1ESPipelineTemplates ref: refs/tags/release +variables: + - name: isSdkRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')] + - name: isExtensionsRelease + value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')] + extends: template: v1/1ES.Unofficial.PipelineTemplate.yml@1es parameters: diff --git a/eng/scripts/test-extensions.sh b/eng/scripts/test-extensions.sh new file mode 100644 index 000000000..033442bdf --- /dev/null +++ b/eng/scripts/test-extensions.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +python -m pip install --upgrade pip +if [[ $2 != "3.7" ]]; then + python -m pip install -e $1/PythonExtensionArtifact + python -m pip install --pre -U -e .[test-http-v2] +fi +if [[ $2 != "3.7" && $2 != "3.8" ]]; then + python -m pip install -e $1/PythonExtensionArtifact + python -m pip install --pre -U -e .[test-deferred-bindings] +fi + +python -m pip install -U -e .[dev] \ No newline at end of file diff --git a/eng/scripts/test-sdk.sh b/eng/scripts/test-sdk.sh new file mode 100644 index 000000000..530178882 --- /dev/null +++ b/eng/scripts/test-sdk.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +python -m pip install --upgrade pip +python -m pip install -e $1/PythonSdkArtifact +python -m pip install -U -e .[dev] + +if [[ $2 != "3.7" ]]; then + python -m pip install --pre -U -e .[test-http-v2] +fi +if [[ $2 != "3.7" && $2 != "3.8" ]]; then + python -m pip install --pre -U -e .[test-deferred-bindings] +fi \ No newline at end of file diff --git a/eng/templates/jobs/ci-unit-tests.yml b/eng/templates/jobs/ci-unit-tests.yml index 099084516..d41119940 100644 --- a/eng/templates/jobs/ci-unit-tests.yml +++ b/eng/templates/jobs/ci-unit-tests.yml @@ -32,6 +32,43 @@ jobs: eng/scripts/install-dependencies.sh $(PYTHON_VERSION) eng/scripts/test-setup.sh displayName: 'Install dependencies' + condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false)) + - task: DownloadPipelineArtifact@2 + displayName: 'Download Python SDK Artifact' + inputs: + buildType: specific + artifactName: 'azure-functions' + project: 'internal' + definition: 679 + buildVersionToDownload: latest + targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact' + condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) + - bash: | + chmod +x eng/scripts/test-sdk.sh + chmod +x eng/scripts/test-setup.sh + + eng/scripts/test-sdk.sh $(Pipeline.Workspace) $(PYTHON_VERSION) + eng/scripts/test-setup.sh + displayName: 'Install test python sdk, dependencies and the worker' + condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) + - task: DownloadPipelineArtifact@2 + displayName: 'Download Python Extension Artifact' + inputs: + buildType: specific + artifactName: $(PYTHONEXTENSIONNAME) + project: 'internal' + definition: 798 + buildVersionToDownload: latest + targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact' + condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) + - bash: | + chmod +x eng/scripts/test-setup.sh + chmod +x eng/scripts/test-extensions.sh + + eng/scripts/test-extensions.sh $(Pipeline.Workspace) $(PYTHON_VERSION) + eng/scripts/test-setup.sh + displayName: 'Install test python extension, dependencies and the worker' + condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) - bash: | python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch tests/unittests displayName: "Running $(PYTHON_VERSION) Unit Tests" diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index 9d12ee2e6..86386ab5f 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -90,18 +90,10 @@ jobs: targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact' condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) - bash: | - python -m pip install --upgrade pip - python -m pip install -e $(Pipeline.Workspace)/PythonSdkArtifact - python -m pip install -U -e .[dev] - - if [[ $(PYTHON_VERSION) != "3.7" ]]; then - python -m pip install --pre -U -e .[test-http-v2] - fi - if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install --pre -U -e .[test-deferred-bindings] - fi - + chmod +x eng/scripts/test-sdk.sh chmod +x eng/scripts/test-setup.sh + + eng/scripts/test-sdk.sh $(Pipeline.Workspace) $(PYTHON_VERSION) eng/scripts/test-setup.sh displayName: 'Install test python sdk, dependencies and the worker' condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) @@ -116,21 +108,10 @@ jobs: targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact' condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) - bash: | - python -m pip install --upgrade pip - - if [[ $(PYTHON_VERSION) != "3.7" ]]; then - python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact - python -m pip install --pre -U -e .[test-http-v2] - fi - if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then - python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact - python -m pip install --pre -U -e .[test-deferred-bindings] - fi - - python -m pip install -U -e .[dev] - - chmod +x eng/scripts/test-setup.sh + chmod +x eng/scripts/test-extensions.sh + + eng/scripts/test-extensions.sh $(Pipeline.Workspace) $(PYTHON_VERSION) eng/scripts/test-setup.sh displayName: 'Install test python extension, dependencies and the worker' condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true)) diff --git a/eng/templates/official/jobs/ci-lc-tests.yml b/eng/templates/official/jobs/ci-lc-tests.yml index f41946af3..42cc5008a 100644 --- a/eng/templates/official/jobs/ci-lc-tests.yml +++ b/eng/templates/official/jobs/ci-lc-tests.yml @@ -36,4 +36,5 @@ jobs: env: AzureWebJobsStorage: $(LinuxStorageConnectionString312) _DUMMY_CONT_KEY: $(_DUMMY_CONT_KEY) - displayName: "Running $(PYTHON_VERSION) Linux Consumption tests" \ No newline at end of file + displayName: "Running $(PYTHON_VERSION) Linux Consumption tests" + condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false)) \ No newline at end of file diff --git a/tests/extension_tests/deferred_bindings_tests/deferred_bindings_functions/deferred_bindings_enabled_dual/function_app.py b/tests/extension_tests/deferred_bindings_tests/deferred_bindings_functions/deferred_bindings_enabled_dual/function_app.py index 418021fb7..a22d8b7b7 100644 --- a/tests/extension_tests/deferred_bindings_tests/deferred_bindings_functions/deferred_bindings_enabled_dual/function_app.py +++ b/tests/extension_tests/deferred_bindings_tests/deferred_bindings_functions/deferred_bindings_enabled_dual/function_app.py @@ -8,24 +8,24 @@ app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) -@app.function_name(name="get_bc_blob_triggered") +@app.function_name(name="get_bc_blob_triggered_dual") @app.blob_input(arg_name="client", path="python-worker-tests/test-blobclient-triggered.txt", connection="AzureWebJobsStorage") -@app.route(route="get_bc_blob_triggered") -def get_bc_blob_triggered(req: func.HttpRequest, - client: blob.BlobClient) -> str: +@app.route(route="get_bc_blob_triggered_dual") +def get_bc_blob_triggered_dual(req: func.HttpRequest, + client: blob.BlobClient) -> str: return client.download_blob(encoding='utf-8').readall() -@app.function_name(name="blob_trigger") +@app.function_name(name="blob_trigger_dual") @app.blob_trigger(arg_name="file", path="python-worker-tests/test-blob-trigger.txt", connection="AzureWebJobsStorage") @app.blob_output(arg_name="$return", path="python-worker-tests/test-blob-triggered.txt", connection="AzureWebJobsStorage") -def blob_trigger(file: func.InputStream) -> str: +def blob_trigger_dual(file: func.InputStream) -> str: return json.dumps({ 'name': file.name, 'length': file.length,